Hi Everyone! My first time on here, so excited to join the community. I am having so much fun with my new crazy guitar rig. I jacked an old effects unit and hacked into the stomp buttons (and LEDs). I made room for my Pi4 and an USB audio interface… I am running Patchbox OS with the Modep module and controlling the rig through the patchbox.local network method. (but plan to run headless)
In the next phase of this project, I connected the stomp buttons to the GPIO on the Pi. I WAS successful in tricking Patchbox OS to use the Button feature from the pisound code: where you tap several clicks to choose the index of your pedalboard preset.
So… TWO THINGS:
(1) instead of multiple clicks to select a preset, is there a config setting that would allow me to just cycle through them?
(2) I see in MODEP web interface that I can map midi control keys to individual controls on the pedals on the pedal board. Can I programmically set a GPIO pin on interrupt to send a midi control command to the MODEP interface? I have four stomp-able buttons - I’d like to map each one to a different “MIDI event”. For example, the SOOPER LOOPER allows mapping for rec, play, undo, reset - I have my buttons wired to GPIO’s 27,22,23 and 24. I need to develop code to ‘listen’ for button presses and then virtually send a MIDI command to the MODEP module… IS THIS FEASIBLE?
Thanks so much for any help in advance. I’ve spent days learning python and RPi.GPIO and am getting close but the MIDI thing eludes me, so far.
You may edit /etc/pisound.conf and change different interactions to run /usr/modep/scripts/next_pedalboard.sh or /usr/modep/scripts/prev_pedalboard.sh. See modep-btn-scripts repo for source code.
As for GPIOs as mappable entries - you’d have to find some GPIO <-> MIDI bridge, I’m not aware of any ready to use option, there might be, but it’s also something that could be scripted on your own, to listen to GPIO events, and to send MIDI CC events from your virtual ALSA sequencer port (if I remember right, MOD reacts only to ports that declare their type as being hardware, so it thinks it’s an external controller, rather than a local virtual port. This may require tweaking, if using a 3rd party solution, as this option is usually not exposed to be set by users)
SO… WORK AROUND…
I figured I want as much CPU focus on low latency processing for the RPi - I decided to add an Arduino as a midi controller! So far so good. Right now everything works great but I’m going out a MIDI jack to USB into the RPi. I’m gonna see if I can write MIDI straight to the GPIO header - freeing up the USB plug and probably saving some processing time. I’ll keep you all posted if you wish!
If I remember right, you have to slightly change the clock of the Pi, by different amounts per model, to make the UART pins on the GPIO capable of 31250 baud rate required for MIDI.
Also, you’ll have to disable the CPU clock scaling when idle, as the communication frequencies on the GPIO pins would be scaling as well.
Firstly - have you any pics of your project? I’m really intrigued!
Secondly - I have had a little bit of success with using a python script to read button inputs via the GPIO pins and send MIDI commands via a virtual midi port.
It is possible without needing the arduino, as long as you only plan on reading digital inputs; if you want to read analog values from an expression pedal or a potentiometer you’ll need something with analog inputs like an arduino
Hiya Man, Yeah… the arduino turns out to be a pretty clean solution. I found some great code that I modified and I use the arduino to manage the MIDI and LEDs and I put in the stereo jack for the expression pedal. I like that it saves resources from the RPi. My current challenge is getting the arduino to pass the MIDI over the uart pins on the RPi, instead of routing everything through a USB port. I get delivery of some level converters tomorrow which should propel this phase…
PICS? well, blush blush, my proof of concept is pretty ugly at the moment! But I am getting/spec’ing out parts to make a tidy pedal box with some fancy upgrades (more coming soon). This first platform was re-jigging an old effects station from the 90’s I had lying around. I’m also doing a series of videos on my build.
That looks awesome!
I’m looking to build my own controller around a Raspberry Pi Pico but haven’t got the nerve to start cutting up and soldering boxes ha ha!
With regards to the UART jnce you have you level shifters and checked the UART is enabled in raspi-config you should be able to address it as /dev/ttyACM0, or something similar. .out examples suggest a baud rate of 115200.
got the level shifter in (from arduino Tx to RPi Rx to go from 5v down to 3.3v)… so far no luck.
I know I am sending out because it is the same I/O line from the Arduino whether it goes out level shifter to GPIO UART Rx on RPi or through the MIDI jack out to the MDI to USB converter and on to USB on the RPi.
I’m not sure how to monitor the MIDI/UART on the RPi EXCEPT by going to MODEP and trying to assign a MIDI control to one of the pedals. I have clicked on “MIDI PORTS” in the patchbox.local interface and selected ‘seperate mode: midi 1 through’ or whatever…
So, I don’t know where to go from here to debug this process.
I put some lines in my config.txt and edited my cmdline.txt…
I moved the bluetooth etc.
To config.txt I did the following:
#code added from “MIDI OVER UART” video
enable_uart=1
dtoverlay=pi3-miniuart-bt
dtoverlay=midi-uart0
#code added from “How I learned to love Pi MIDI” Website
init_uart_clock=2441406
inti_uart_baud=38400
I also deleted the console=0 and console ttyl=0 or whatever in the cmdline file
I am having no luck and no way to view the midi
I am running latest in Patchbox OS with the MODEP module - is there a way to set/troubleshoot the MIDI input??
…I should also mention, i suppose… I put in a couple over clocking statements in config.txt too:
over_voltage=2
arm_freq=1300
not sure if that messes stuff up…??
I figure part of my problem is matching my MIDI buad rate and the GPIO UART serial speed. Then I had the brain-flash!! just make the Arduino output MIDI at 115200!! Done deal!? Right?
Now, I’m not sure if there is any part of Patchbox OS that would assert the MIDI speed…? Or serial Uart?
I restored the cmdline.txt and hoped I’d get the RPi back to operating at 115200
is there a COMMAND LINE STATEMENT THAT RETURNS THE SERIAL BAUD RATE?
(I see there is one for clock speed)
I know you moved away from this and you are concentrating on MIDI UART now
but in case you’re still investigating using GPIO for Midi and Pedalboard navigation
I’ve managed to use 2 GPIO pins to navigate between pedalboards
and I use 4 other GPIO pins to send midi signals to MODEP
if you’re interested ping me and I’ll post you the code
That sounds really cool… I would love to see that code.
I have invested in some clone nanos and some level shiftrers but I AM running into this road block, at the moment.
I too have been trying to hack Modep for live work.
I have reached the conclusion that the way to go - my recommended workflow is:
To prepare
Use Modep the package to design pedal boards. I mean input to output via the simulated effects.
Shut down Modep (Thank you Modep, you rock)
Note the LV2 settings Modep uses and set them up in mod-hostHere is some Perl code I use. Very idiosyncratic, most people these days would use Python. May even be a Modep utility or API for this. @Giedrius will be able to advise on that, I expect
Note the Jack settings that Modep uses (my code does that too) and establish them, except for the inputs and outputs (to and from system:capture_[12] and system:playback_[12])
To use:
Whatever method you use at run time to select the pedal board, make it change only the connections to and from system:capture_[12] and system:playback_[12].
To maintain its services Modep has a big ball of Python code that uses the HTTP stack to communicate. It means that is is very useful for defining simulated pedal boards but its API will never be quick.