Hmm, that could help. I’ll take a look.
About the example with the rolling ball, I think that if the camera (the real audio listener) is too far from the ball, the effect of the spatialization is misleading. Maybe the audiolistener should be on the player?
As a side note, I think that unity spatialization is not so good
Maybe we should add examples using other spatial tools too? Feel free to update that example or add to it. I won’t take any offense
The settings about the Ambisonic Decoder Plugin are in ProjectSettings/Audio, we shouldn’t modify those from the examples!
And they recently were moved to external packages, so we should add a dependency… we have to stick to unity limited spatialization!
The distance of the camera just increases this limitation “feeling”, and also I wouldn’t suggest a big camera field of view with very far clipping plane. But for sure the sample was just started, we have time to tackle these problems.
Audio problems first! I can confirm that in macOS build it works without clicks or drops with Doppler set at 0 (and my macbook is not so recent, early 2013)
A quick google search for problems with Doppler effect seems to being up quite a few hits…
Yes! it’s something that never worked!
if we need it we could try to implement an example with:
and use the rigidbody velocity!
if we manage to obtain something good this could be a great promotion for the package
Good idea. Btw, do you know if this only happens with the child sources?
I don’t know really, but I think it happens in almost any case (audiosource with audio clip / audiosource with onAudioFilterRead implemented, moving listener with static sources / static listener and moving sources)
I can do some tests this afternoon to see what happens!
I found this: https://docs.unity3d.com/ScriptReference/AudioSource-velocityUpdateMode.html
maybe with the right settings also the Unity doppler works
You got it. Adding:
audioSource.velocityUpdateMode = AudioVelocityUpdateMode.Fixed;
To the Awake() method os CsoundUnityChild did the trick I just pushed.
Unity is a touchy guy, he needs things are done his way
I add a simple sequencer example. Please feel free to mod it, make it look better, etc!
Remember to update the json!
I managed to mantain the references in the scene when importing the samples.
The things I had to do were basically 2:
- change the Samples folder name to Samples~ , so that Unity completely excludes that folder from compilation (and of course update the path of the samples in the package.json)
- develop the Sample Scene in another project (inside a folder, say SimpleSequencer), then copy the whole folder content (and all the .meta files, to be sure also the SimpleSequencer.meta) in Samples~ (add the sample in the json if it’s not there)
Doing like this when imported the scene has all the references set correctly.
Hope they will change somehow this in future version of the package manager.
Shoot, I forgot to you’re the json. I also had references to the packages folder for the samples. It plays ok for me from that folder, but will break if I move it to another right?
Yes I had to change the samplePath to:
string samplePath = Path.Combine(Application.dataPath, "Samples/CsoundUnity/1.0.0/Simple Sequencer/Samples");
notice it is just to make it work, we should add two fields in CsoundUnity, the PackageName and the Version to have something more clean
I tried to build the sequencer scene on macOS. Apart from the fact that I had to manually copy the framework, Csound is hanging when setting the string channel for the samples.
It’s because the samples are compiled! They are not wave files, but instead binary files.
I think we should use Resources.Load, and use the bytes of the loaded clips to fill some tables (harder but cleaner way), or use the old and ugly StreamingAssets folder.
But for doing this we should make a copy of the files as soon as the package sample is imported. But there’s no callback to know when a sample from the package is imported in the project!
So last chance is to show a warning to the user if the files are not in the StreamingAssets folder, and let him copy the files there.
Btw in Editor the Sequencer works, and it is crazy!!! I could bring the BPM to above 6000 without any issues! that’s incredible!!
Then around 6500 I could hear some clicks and artefacts (my mac is old), but yeah, that’s crazy
You walked straight into the trap! I had a feeling this might be the case!
Using Resources.Load() would be cleaner, but we need to define the tables in Csound first, yet we won’t know their size? I need to check if the table will resize automatically, otherwise we won’t be able to set the pitch of playback correctly?
StreamingAssets works at least, although it’s ugly, and I would definitely like to drop it.
Wtf?! You have to be joking? That’s like a granular sequencer
I have an idea for the samples. Just need to figure out how to access them using Resources.Load(). Time for some reading I think…
 where should one put the resources folder when working with packages?
Yes we don’t have a native method to fill a table of unknown length. could we do this with an instrument passing the sample length for every audio file we add?
I’ll add an utility method to retrieve samples from the audioclips loaded from resources.
It remains as an option for the user, so we could just add this in the docs. Our problem is that we have hard time using it for the Samples for the problems mentioned above.
Yes I also thought about that! And also that we should add a granular example, that would be very cool