Cabbage Logo
Back to Cabbage Site

How to change pitch with a slider?

Hi there!

I’m brandy-spankin’ new to this - I started with the “play tone with a button” example, but now I want to use a slider to change the pitch of the instrument during performance. Is it possible to change a-rate variables with a slider?

what I have looks like this:
— Cabbage bits
vslider bounds(-20, 30, 100, 100), channel(“slider1”), text(“Tone 1”), range(100,800,100,1,1)
button bounds(10, 140, 40, 40), channel(“button1”), text(“1”), latched(0)

— Instrument
instr 1
aTone vco2 chnget:k(“button1”), chnget:a(“slider1”)
outs aTone, aTone
endin

— Score
f0 z
i1 0 z

This gives an error about wrong argument types. I’ve looked through the docs but they are rather voluminous. Can someone point me in the right direction? I’m probably missing something super simple.

Thanks!!

The problem here is that you are trying to control the frequency of your vco2 with an a-rate slider. The syntax for a vco2 is:

ares vco2 kamp, kcps [, imode] [, kpw] [, kphs] [, inyx]

As you can see kcps must be , well, k-rate :wink:

Try:

aTone vco2 chnget:k(“button1”), chnget:k(“slider1”)

hey! working on making a fine tune knob for my oscillator. Is there a certain way it works? is a 1v/oct sort of thing? or is it a different value? thanks in advance

Are you looking to have an additional sliders for fine tuning, or would you like to use one slider for both coarse and fine tuning? Btw, perhaps you should post to a new thread? so we don’t hijack the one @wankershim started, which is about a different topic…

D’oh! Guess I was too far past my bedtime when I was trying to figure this out :crazy_face:

Thank you so much for your help!! @rorywalsh