Volume Control with MIDI CC

Sebastien posted Sep 4, 15:07:

Hi everyone, (First, thanks to Joseph for the job ! It's working great.)

I would like to control the volume from my keyboard with a knob, I have tried two things but without success :

  • send a MIDI CC 7 ("Channel volume") -> without impact on the sound
  • send a MasterVolume Information -> mute the sound...

A MIDI CC 64 ("Sustain") works but not the volume. Has someone an idea to help me ?

AlexM posted Sep 7, 03:02:

I don't quite understand what you mean by channel volume without impacting on the sound...

But anyway - are you tinkering with samplerbox.py? If so, in the MidiCallback() function you could play with this:

^^globals and variables above here^^


ccnumber = 7
if (messagetype == 11) and (note == ccnumber):
globalvolume = (10 * (-12.0 / 20)) (float(velocity) / 127)

End volume

From that you could pretty easily create a mute toggle function.

AlexM posted Sep 7, 03:03:

Oops, not sure how to format code in this forum haha! (or edit for that matter!)

Turncoat posted Sep 10, 01:42:

I think you would be better off putting a stereo log pot between the output and amp.


  (not published)
  I want to post as guest