Closed corentoulf closed 7 years ago
For those looking for volume control, I got it working like this :
In the "import modules" part, add this :
from subprocess import call
In the audio and midi callbacks, add something like this :
elif (messagetype == 11) and (note == 7): # Ctrl change
vol = int(0.7402*velocity) # scales 0-->127 to 0-->100
call(["amixer", "-c", "0", "set", "HPOUT2 Digital", str(vol)+"%"]) # shell command to set the card n°0 to "volume" in %
print velocity
print vol
Replace the note number by the fader number you want to use, the card number by the one you use and you're set !
Hello, I was trying to add a volume control from a fader on my piano. Looking at your code, I'm trying to set the globalvolume variable with this peace of code (that I placed in the "audio and midi callbacks" section) :
Unfortunately, I can see that my fader acts but nothing changes on the audio volume. Could you guide me in handling this ?
Thank you !