Cabbage Logo
Back to Cabbage Site

CsoundUnity Package (UPM) development

should be this:

https://docs.unity3d.com/ScriptReference/EditorGUILayout.Popup.html

Iā€™ll take a look, I like doing editor stuff

By all means. That would be great. I am very tempted to start looking into the CsoundUnity child components, but Iā€™m kind of waiting till the dust settles on this stage of development. Am I correct in saying that the streaming assets folder is no longer needed?

Yes weā€™re not using it anymore!
Mission complete!

1 Like

We have all the methods to exchange buffers, so we could test if different instances of CsoundUnity can talk to each other exchanging data?

We donā€™t need to use any buffer stuff. Itā€™s much easier than that. If I get a chance over the weekend Iā€™ll try to put together a rough draft. If it works, Iā€™m sure youā€™ll laugh at how simple it is!

I hope so! Great weā€™re going fast and far!

combobox bounds(445, 20, 85, 20), channel("testCombobox"), value(1), text("Tri.","Random"), identchannel("ID10"), visible(0)

how does the identchannel in the combobox work?
what kind of message should I send to csound?

trying this code but it doesnā€™t compile on cabbage:

<Cabbage>
form caption ("Test Csound"), size(300, 200)
hslider bounds(0, 0, 300, 50) range(20, 16000, 440, 1, 0.001) valuetextbox(1) channel("freqSlider") value(440) velocity(50)
combobox bounds(0, 60, 85, 20), channel("testCombobox"), value(2), text("Sine", "Boh"), channeltype("string")
; EDIT: the value was wrong, it was value("1")
</Cabbage>

<CsoundSynthesizer>
<CsOptions>
;-n -d -m0d 
;-odac
-n ; -m0d
</CsOptions>
<CsInstruments> 
;sr 	= 	44100 
;ksmps 	= 	32
nchnls 	= 	2
0dbfs	=	1 

instr 1
a1 oscil .2, chnget:k("freqSlider"), chnget:i("testCombobox")
outs a1, a1

endin

</CsInstruments>
<CsScore>
f0 3600
f1 0 4096 10 1
f2 0 4096 10 1 .3 .15 .07
i1 0 5
</CsScore>

now it compiles on Cabbage, Iā€™ll try to make it work on the editor too

Donā€™t bother with string comboboxes, they are not really needed as far as I can tell, or at least not for now. Here is the one I was testing with. You can change tone with the combobox :wink:

SimpleSynth.csd (1.6 KB)

I am pushing the fixed intslider!
Then Iā€™ll add the dropdown!
Itā€™s done, it was easy! but the names are a bit ugly I have to split them better :sweat_smile:
ok itā€™s there to test!

2 Likes

Great. Iā€™ll try it it tomorrow and get back to you :+1:

Just trying this out now. It works great. Iā€™m very happy to have this, it will make porting Cabbage instruments much easier.

You know the one must drag a Csound file to the CsoundUnity component? Do you think it would be more intuitive to have the little circle on the right hand side to let one chose a file in the current project? This thing I mean:

The reason itā€™s not there is because I couldnā€™t figure out how to do it when I first started learning Unity. You like editor stuff right?! :laughing:

1 Like

Yes I can look into it, shouldnā€™t be difficult! Would you leave the Drag Area or should I remove it?
Btw Iā€™ve just finished implementing the FileWatcher feature, iā€™m testing this right now!
Want me to push so that you can try also this?

Yes please. I think it you implement the Unity way of browsing, then a file drag should also work right? Or?

Yes it should be sufficient to have just that field.
Iā€™ll remove the drag area then!

Btw, do you know how to change the number of audio channels in an AudioSource? CsoundUnity should probably match the number of channels set in the Csound instrument? Or do we force everything to be stereo?

I think AudioSource should do it alone! And when OnAudioFilterRead is called just a channel is passed.
Maybe we could read that value in Awake?

And thinking more about those fieldsā€¦
I think the problem is that those fields refer to unity assets, and csds are not!
Let me finish the FileWatcher then Iā€™ll look into it (maybe tomorrow)

I think the number of channels is set by the clip, and if no clip is given itā€™s 2. I couldnā€™t see any methods for setting the number of channels. But I didnā€™t look very hard!

I think this is the problem I faced the last time too. I was hoping the situation was different now. Anyhow, itā€™s not too bad the way it is, but itā€™s not very Unity-esqueā€¦

Now I remember that I saw something that could help: create an inspector field for a scene asset.

This should do it!

https://docs.unity3d.com/ScriptReference/AudioSpeakerMode.html this is not so useful :expressionless:
Thereā€™s no mention about channels other than this.