# unity3d – Change csound oscillator frequency while playing one note

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?