Cabbage Logo
Back to Cabbage Site

CsoundUnity for beat matching

I won’t be able to try it until next week, but I’ll certainly let you know what I find out.

No problem, thanks! Have a great weekend.

Hi Rory,

Another problem I got and haven’t told you yet is since I’ve imported CsoundUnity to Unity and using my .csd file to process the audio in Unity, every time I modify and compile my C# script to Unity will cause Unity to crash and auto quit.

Also I can’t click the “PLay” button on my CsoundQT IDE to compile my csd file anymore since it will crash even Unity is not opening. If I use terminal on my Mac to compile Csound file it still works (csound -odac my_csound_file_path).

I also tried some of my other Unity projects that didn’t import CsoundUnity, and compile a script won’t cause the Unity program to crash.

Did anybody have these problems before?

Are you editing the .csd file while Unity is running the game? What is your C# script? Perhaps it’s causing something to go astray? [quote=“Tao_Yao, post:23, topic:553”]
Also I can’t click the “PLay” button on my CsoundQT IDE to compile my csd file anymore since it will crash even Unity is not opening. If I use terminal on my Mac to compile Csound file it still works (csound -odac my_csound_file_path).
[/quote]

I’m not sure what’s going on here. Both CsoundUnity and CsoundQT should be using the same version of Csound. One thing I have noted about Unity in the past, is that you must close it and reopen it whenever you use any other audio software. it seems to like to grab audio focus away from other apps. It catches me out on Windows all the time.[quote=“Tao_Yao, post:23, topic:553”]
I also tried some of my other Unity projects that didn’t import CsoundUnity, and compile a script won’t cause the Unity program to crash.

Did anybody have these problems before?
[/quote]

Oh I’ve written quite a few scripts in my time that could take down Unity. You’re not alone there :wink: You should check the Unity editor log. That should may give you more details to work with.

I don’t have any such issues. I’ve attached the file I tested with. It loads a sound file to a table, which the next instrument reads using a temposcal opcode. When I move my Pitch slider to the negative in my AudioSource inspector I get the expected change in playback direction. TemposcaleTest.csd (514 Bytes)

Hi Rory,

I think I found another bug of CsoundUnity.

Did you remember the relative path you told me before?, the “AudioPath” channel in Csonund stand for Assets/Audio and use that channel to store in a String variable so that you don’t have to type the directory from the root in your computer? Although it works in Unity, but when you build the project if you use “AudioPath” %s, the audio processed by CsoundUnity won’t be played anymore. The I switched back to using the directory from the root “/user/…/UnityProject/Assets…”, and build the project, the audio will play.

Is that also happens to you? Maybe you can try it out sometime.

Sorry for so many questions, haha, but I really think CsoundUnity will help a lot of game audio developers.

Do you mean it won’t play when you build your game?

Yes, if you use relative path with “AudioPath” channel %s, it won’t play the audio when you build the game, but when I switch back to use the directory from /user… instead of using “AudioPath” channel it WILL play when you build the game, I actually tried both on PC and Mac.

Ok, I better sort that. It’s not something I ever tried myself.

Sure, let me know when you try it out, thanks!