Cabbage Logo
Back to Cabbage Site

Widget Rotary Slider Clicking Sounds

Hope I am in the right place. I have been working with Csound for about 6 months. Maybe someone can help me. When I turn the rotary widget slider each increment has a horrible clicking sound. I have done some research and found that maybe I should be using the linen opcode to try and take this sound out.
I have it set up so each increment is a different frequency by about 1000 khz… Now you can emagine why there would be so much popping with that much of a jump in khz. Does anyone have any suggestions on what opcodes might help with this? oh and I’m using the bqrez opcode for my filter .
Thanks everyone

Hi @DubChaos, welcome to the forum :slight_smile:

1000Hz jumps are large jumps, but there are lots of ways you can smoothen it out. The simplest is to pass the output of the slider into a portk opcode and then use its output to control the frequency. You can also use tonek which is a low pass filter for k-rate variables. If you use a very low cutoff frequency it will also smoothen the signal for you. :+1:

Okay great thank you so much. I will mess with it and see if I can get it to work right. The filter does sound really cool just those clicks. I will let you know later if I got it to work. Oh and thank you for your YouTube videos. They helped me a lot. Still have a lot to learn but it is sure fun. Thank you

1 Like

Hello Roy, I used the portk opcode and it did smooth it out quite a bit. I tried some other stuff worked also. Now I’m having trouble controlling the steps when I try it in Ableton. I’m using a x32 mixing board for my controller. It does turn the widget In Ableton but all my steps disappear. I changed some setting in the midi section of my preferences in Ableton and that didn’t work. Maybe you can give me some suggestions. I’m very new to Csound but here is an example of what I did. Thank you for your time.
;asig diskin “C:/Users/Dan/Desktop/TamaM.wav”
asig inch 1
khtim linseg 0.001, p30.1, 0.001, p30.1, 0.001 ; portamento-function: start with NO portamento - then portamento.

if kNotch == 0 then

kPort portk 1000, khtim ; pitch with portamento.
afilt bqrez asig, kPort, kRes, 1

elseif kNotch == 100 then

kPort portk 2000, khtim ; pitch with portamento.
afilt bqrez asig, kPort, kRes, 1

elseif kNotch == 200 then

kPort portk 3000, khtim ; pitch with portamento.
afilt bqrez asig, kPort, kRes, 1

Oh and one more thing. If I use the Mouse in Ableton it works. I’m thinking I may have to do some Identifier channels or chnset . Maybe Cabbage midi can only work from the widget section. You can let me know. Once again thank you. Oh and my Name is Daniel thanks

Sorry @DubChaos, I don’t follow the problem you are having? What do you mean when you say steps? Keep in mind that I don’t use Ableton all that much.

What works?

What about MIDI? This is the first mention of MIDI in this thread? Are you saying that automation lanes in Ableton don’t move the Cabbage widgets? They should, I’ve not had any reports of this not working before. But perhaps you are referring to a different issue?

Interesting problem DubChaos!

In a situation like that I would want to first have the hard data as to exactly what numbers my controller was outputting as turn the knob, wheel, or whatever it is. So to get this I would want to make in a separate file a version where I use the midiin opcode (one) as well as printk2 (four times) so that Csound gives you the 4 MIDI status bytes every time your controller does something. Tip: printk2 has an optional spacing parameter so that you can put the four different bytes in different columns.

You have to be able to see the command line interface for this - luckily, Cabbage has a widget for that, the console. An alternative would be to use foutk or a similar opcode to save the data to disk. Either way, you want to see those MIDI status bytes. One of them will be the actual number that gets sent as user input, like the 0-127 you would get from a cc controller.

Actually, you can apply this strategy to other midi opcodes, not just midin even though I recommend that one to see what’s coming in raw. You can also print to console whatever midi opcode you are currently using. It’s clear from your problem that something about how your MIDI controller is sending data and how Csound is reading it there might be a mismatch. Perhaps everything isn’t perfectly 1:1 and this is messing up the steps. Looking at the incoming MIDI data as an actual number value, which is being read by Csound, that might give you a clue as to why the mismatch is happening. Unfortunately with something like this you really need to think mathematically - is it a roundng error or something?

Can you code a more robust quantization by processing the MIDI input further? The table opcodes plus a custom f-table made with a GEN routine might be a possibility there.

iquantize ftgenonce 0,0,16,-2,0,8,16,32,40,48,56,64,72,80,88,96,104,112,120 ;custom f-table
ksketchy chnget "mid_input" ;in the range 0-127
kquantized table (ksketchy/127), iquantize, 1, 0, 0 ;no interpolation

Wow thank you so much for the Tip. I will give it a shot. What you say makes sense that I need to be absolutely sure it’s outputting MIDI. I will let you know if your suggestions work out thank you.