Indrajeet Raval Posted April 1 Share Posted April 1 import mido # Define MIDI port name (adjust as necessary) port_name = 'Digital Piano 1' # Open MIDI output port output_port = mido.open_output(port_name) # Define MIDI channel (1-16) channel = 0 # Note: MIDI channels are zero-indexed, so channel 1 corresponds to index 0 # Define Control Change message for volume (CC #7) volume_cc = 7 # Define volume value (0-127) volume_value = 1 # Adjust as needed print("Available MIDI output ports:") for port_name in mido.get_output_names(): print(port_name) # Create Control Change message for volume on the specified channel volume_message = mido.Message('control_change', channel=channel, control=volume_cc, value=volume_value) # Send the Control Change message output_port.send(volume_message) # Close MIDI output port output_port.close() OUTPUT: PS C:\Users\P125ab> python main.py Available MIDI output ports: Microsoft GS Wavetable Synth 0 Digital Piano 1 When I executed above code and pressed Yamaha digital piano P125ab keys, master volume wasn't changed at all. The same thing I can do if I connect Smart Pianist App. Open Balance Window at the bottom and move slider up and down to change master volume in android app. If I press any digital piano keys, as per fader the sound will come from digital piano. Is above code enough to test master volume? Or what else should be done to achieve the same functionality. Thanks, Indrajeet Raval Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now