Can I just copy the script and streaming assets folders into the old stuff?
Panning from Csound, relationship to AudioSource in Unity
You can just import the entire package. It should be fine. Make a copy first though.
Ok, that worked fine. The original Unity package that Iād used contained 3 example scene levels (which ran fine) but the new one doesnāt, thanks! much easier to import.
The link I originally used was from your CsoundUnity page. Inspecting the link gives me:
Version 2.0!
Yikes. Iāve updated now!
Ok, one more question. I was trying to get a smoother realtime update on panning and changed ksmps from 32 to 16. It completely changed my pitch to a screaming high pitch. I wonder why.
Iām not sure. 32 is pretty smaller though. Have you set your audio settings in Unity to be at best performance?
Not sure how to do this. Iām using the standard 44100, -B is 2048 and -b is 512 in Csound
hey Tom - the settings for Unity are in Project Settings>Audio. you can set the sample rate and latency performance in the Inspector.
Thanks Scott! So what is optimal?
Select Best Performance. That usually does the trick for me, with ksmps set to 32.
interesting, Rory. iāve usually found that Best Latency is what works, but that was for folks using Unity internally. perhaps itās different for streaming/OnAudioFilterRead functions.
Sorry, youāre right. Best Latency was the option I was trying to think of
OK, just to finish up, I set the System Sample Rate to match the Csound sample rate and set the DSP Buffer Size to Best Latency. I still get the high pitched screech when ksmps is 16, so Iāll stick with 32. I get little glitches occasionally, will have to investigate.
hey Rory just to mention i downloaded the package from that link and the 2D Panner from the AudioSource isnāt working for me at least. i also think that iām not hearing panning in 3D either. i wiped the CsoundUnity Scripts and CsoundLib64framework folders before installing your update but i did not remove meta files beforehand. i am hearing distance attenuation but iām not getting any kind of azimuth effect going. it just sounds like a single channel between both speakers no matter what.
I even tried the demo files and i could not get panning to happen in Unity in a clear way. also, on the PC in the same sequencer project iām only getting the left channel. iāll update once i try the demos on the PC.
Iāll try here now with a new project and see whatās going onā¦
Sorry guys. looks like you are right. It seems I fix this bug at least once a month, although Iām baffled by the current behaviour. Iāll take a look and see what I can seeā¦
This probably isnāt the problem, but the link on this forum page is still pointing to an older release, since I was trying to show that it was pointing to the wrong releaseā¦ and shouldnāt be used.
I just downloaded the latest packages into a new project and get an error because the Player.csd is not a part of the package.
I downloaded the .zip source as well and found the Player.csd there. When I brought it into the project assets folder and played the 1st or 2nd scene I got a constant buzz sound that doesnāt change when the character moves.
Hi @Marco_Polo, Iām just looking into this now. I download the latest release from here:
I then create a new project. I add a CsoundUnity component, edit and add the Basic.csd script to play back some sinewaves with panning:
instr PLAY_AUDIO_CLIP
a1 oscili 1, 400
a2 oscili .5, 1
outs a1*(a2+.5), a1*(1-(a2+.5))
endin
Start my scene and I get panning. No high pitched craziness, just good old school sine waves. I fail to recreate your issue here with the high pitched sounds, but I do note that panning in Unity doesnāt work, although the stereo image is coming from Csound just fine. A quick search of the issue shows that there is a long standing bug in Unity that causes this problem. The guys at Heavy also have the problem:
Also check here:
What I can do is programmatically retrieve the pan position and use it to alter the gain of the left and right channels. Iāll try it out and see how it works, although Iām afraid we may get some artifacts in the audio when the panning is changed. Iāll try it out and let you know. Unity really should look after this itself.
Iām afraid this approach wonāt work as I donāt have access to that info. I can look into some of the other solutions and see whatās possible. Just so weāre clear, we can easily pan from Csound, but not from Unityās AudioSource panning controlā¦