I’m currently working on a DJ game and trying to use CsoundUnity in my Unity project for beat matching, however got these following issues:
I. I used the “temposcal” opcode in Csound (coz I think beat matching is all about time scaling), the default temposcal first argument value (time stretch) is 1.0 in Csound (means the original time scale of the audio file). But when I pass it to Unity with hslider, the 1.0 in Unity become twice as fast than the original speed (the normal time scale become around 0.45 in CsoundUnity.cs slider), I tried to set different range() for the hslider in Csound but seems that’s not the problem, when I set a different range and adjust to 1.0 in Unity will still make it twice as fast. But open and play it in Csound with 1.0 value will be normal speed. (See the .csd file I uploaded if necessary)
II. When I keep the Time Scale slider in 0.5, and play my track through CsoundUnity in game, the time scale of the song is really unstable (sometimes fast and sometimes slow), but when I play it in Csound alone the time scale is stable, what should I do?
III. Are there any other opcode that better than temposcal for beat matching?
IV. I have to specify the very specific path of my audio files (songs) as the 5th argument of temposcal, but what is the best way to pass multiple audio files and let the user can choose these songs in game? (by passing the a string path from Unity to Csound? if so, what’s the function name?) And as you can see the 5th argument of temposcal, I even have to specify “/user/…/Desktop/…”, but if player download the game it would be a different path in his computer.
V. Can I feed audio signal from Unity to Csound instead? I found this link says there are some functions in CsoundUnity.cs that can do this, but when I opened my CsoundUnity.cs I didn’t found some functions showing in the link. If those functions are removed, can I still feed my songs to Csound?
I would really appreciate if someone can help me with it, thanks!
Csound_Time_Stretch.csd (1.3 KB)