This commit is contained in:
2021-01-24 18:45:40 +10:00
parent 49dce3004f
commit 5ecf09842c
2 changed files with 22 additions and 1 deletions

17
Midi-Expression-Pedal.py Normal file
View File

@@ -0,0 +1,17 @@
# Expression pedal settings
exp_min = 0 # Expression pedal minimum value
exp_max = 65535 #Expression pedal maximum value
# Midi settings
midi_channel = 1 # Target midi channel to write to
cc = 68 # Target Control Change number - this is for Behringer X32 Matrix 5
cc_min = 0 # Minimum desired CC output
cc_max = 100 # Maximum desired CC output (only want fader to go to unity gain - hence not 127)
# This function translates the expression pedal value to the equivalent CC value
def translate(exp_val):
return (((exp_val - exp_min) * (cc_max - cc_min)) / (exp_max - exp_min)) + cc_min
# Test the translate function:
for i in range(65535):
print (translate(i))

View File

@@ -1 +1,5 @@
# Py-Pico-Midi-Expression-Pedal # Py-Pico-Midi-Expression-Pedal
This is a Raspberry Pi Pico MicroPython project that takes an expression pedal input via a TRS 1/4" jack connected to ADC pins on the Pico, and outputs a Midi CC message equivalent via USB.
Midi channel, CC number, and maximum and minimum values can all be set as required.