Cabbage Logo
Back to Cabbage Site

VU Meters get reset to max volume


I implemented a VU meter design I found in a rather old post. The meters seems to be working for the most part but display ‘max volume’ when the audio signal is -inf, i.e. when you drag xy to 0,0, and set the dry output to 0. Give it a few seconds, the meters will jump to max. Any help would be appreciated.

I decided to use a global audio variable to use the meters since I had output from other instruments. I’m using the vincr/clear technique in a separate instrument (instrument 98).

For conveniences sake, I’ve commented “;READ HERE” for all the parts that concern the VU meters, so you can just cmd+f those.

(recommended) 1-2 delay.csd (7.3 KB)


I don’t have time right now to look into this, but I wonder if you can use the limit opcode to limit the signal so it stays between the expected range? More a workaround than a solution, but still. You might want to check the output from the xypad, and make sure it’s also only delivering values between min and max. I’m wondering if at some point it outputs something unexpected, which would cause this issue…

btw, welcome the to forum!

Thanks Rory, nice to be here! The limit opcode helped. I’m truncating the meters now, so that the minimum level is -50 dB. It never occurred to me to use printk2 to what was going on, but upon using it to check the values, I saw that the meters do indeed get set to max vol every time the audio signal goes to -inf.

I’m running into a similar problem with my synth, but as I’m generating the audio signal using an oscillator/envelope the methodology is different.

    aOut = kGain*aFilt*kEnv

I’m using the statement above as input for my meters. The problem is that my kEnv from my madsr object never goes to 0 after my note-off message (I’m assuming that’s what it would go to). I used printk2 again and saw that it converges to values like 0.00181. When I multiply all these by kGain(gain knob on my slider) the value is bound to increase to a much larger value. Is there anyway I can ‘quantise’ those values to 0 without ruining the ADSR?


I’m trying to see if I could help (since I spent some time on similar issues recently).

I can’t reproduce the issue with these params:

Capture d’écran 2023-05-14 à 09.48.18

Am I supposed to see the meter full once every x seconds?
Also, I replaced the alwayson opcode with a score infinite duration because it was not compatible with my csound version (it might be a plugin opcode)

;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7] 
i98 0 [60*60*24*7] 
i99 0 [60*60*24*7] 


Can you post your synth code? Btw, if you could reproduce this with a minimal example it would really help us understand what’s going wrong. :+1:

Hi Julien,

Here is what I was seeing before I fixed the patch. The R channel always went up before the left, but even the left got set to maximum volume a few seconds later.

You’ll notice in the (commented) code that I’ve now added a limit to kMeterL so that its minimum value is -50. That sort of fixed it for me.

Hi Rory,

Here’s an example :

I’m currently printing the cutoff frequency envelope in the console, which doesn’t drop to 0, just like the amplitude envelope. I’ve noticed that if I set both sustain levels from the ADSRs to 0 the meters go to 0. But aren’t the envelopes supposed to be set to 0 after any note-off message, regardless of the sustain levels?

supSaw.csd (7.1 KB) supSaw.snaps (1.8 KB)

Although I wrote that original example, I think I might have compensated for the levels of the signal:

kMeterLstuff = (80-abs(dbamp(kMeterLstuff)))/60

To me, this line doesn’t seem right. At 16bit the max dynamic range is around 90db. So it should be:


Or? I’m not sure it will fix your issues, but it’s a start.