I'm using CSound in the context of CSoundUnity to build a synthesizer with Unity. I would like to have the possibility to change the frequency of one note of quasi infinite duration during play-time. Not between notes.
The communication between the Unity C# script and csound is implemented via CSoundUnity "channels".
I implemented the oscillator in the csound-csd-file like this:
instr 1
kfreq chnget "freq"
iflg = p4
asig oscils .7, kfreq, 0, iflg
outs asig, asig
endin
This leads to a syntax error, because the parameter kfreq for the oscils-oscillator can only be changed per note and not during playing, so it cannot be a control parameter.
The script compiles in this form:
instr 1
ifreq chnget "freq"
iflg = p4
asig oscils .7, ifreq, 0, iflg
outs asig, asig
endin
but I want to have the possibility to change the frequency during playing.
Is there any possibility to achieve this?
CodePudding user response:
The channel reading at k-rate is fine, you just need to use a different oscillator that accepts k-rate frequency changes. Try oscili or oscil3 for example.