Cabbage Logo
Back to Cabbage Site

Change vco2 semitone

Hello all,

I want to change the semitone of a vco2 oscillator using a rslider. What is the simplest way to do this?

Thanks in advance

How about something like this:

<Cabbage>
form size(600, 600), caption("Csound"), pluginID("plu1")
rslider bounds(10, 10, 100, 100), channel("pitch"), range(-12, 12, 0, 1, 1)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1

instr 1001
a1 oscili .25, cpsmidinn(48+chnget:k("pitch"))
outs a1, a1
endin

</CsInstruments>  
<CsScore>
i1001 0 3600
</CsScore>
</CsoundSynthesizer>

Wow, my first question was answered by the frontend creator! Thanks!

Well, not sure if it is correct, but I wrote the following code:
<CsInstruments> instr 1 iFreq = p4 * semitone(chnget("Pitch")) iAmp = p5 iAtt = 0.39 iDec = 0.0 iSus = 1 iRel = 0.53 iShape = 10 ; Square wave kEnv madsr iAtt, iDec, iSus, iRel aOut vco2 iAmp, iFreq, iShape outs aOut*kEnv, aOut*kEnv endin </CsInstruments>

It seems to do the trick when I change the “Pitch” Knob. I don´t aimmed midi mapping yet (it´s the first time I code Csound/Cabbage, newbie, still learning…). Should I consider another important question?

I didn’t even know there was a semitone opcode! Your solution looks good.

1 Like

Well, then seems it´s solved for now. Thanks!