Hey!
I’ve repurposed some pedals from an organ (13 notes) and used ChatGPT to do the code.
All of the features I’ve added work fine but I can’t seem to get the Midi in to work.
I’m using an Arduino Mega Pro.
I also tried this code on a Nano that has Midi in/Out which I know is wired correctly, as I used some Echo code on it, which just passes stuff thru. But it didn’t pass.
That echo code didn’t work on the Mega, maybe my wiring is wrong but could someone check the code to see if it’s that also?
I’m willing to chuck some money to someone that can help me out.
13 notes
Up/down octave
Up/down program
Hold button
Hold midi button to use octave buttons to change midi channel
1x After touch expression with button to bypass
3x CC expressions each with a button to bypass
It’s gunna all go up on GitHub for anyone to use. That way it can be repurposed. Or someone can just use the CC expressions or something.
I happen to be working on something using this library right now, i’d never dare ask ChatGPT to figure it out… Way too niche a question, way too many wrong assumptions it would make…
The only thing it’s guaranteed to do is to give a plausible-looking answer wasting your time rather than ever admit it has no clue (that’s just how LLMs work).
How much of the code works? It is based on existing working code? How much of it is untested? Have you tried simplifying is as much as possible? What’s the circuit? Can you get any input or output to work at all?
If most of this code was written by the computer, it’s not worth the trouble whipping it into shape.
It all works as I wanted.
I’ve gone back and forth with it. Adding a piece at a time and testing it on my organ pedals.
Hardest one for it to get right was the program up and down, because I also misunderstood how it worked. As it’s actually 3 banks of 0-127. (Well for my synth but there are parameters in there to change how many banks you have and what patch to startup on) As it took me and it a while to get to the right explanation for moving up and down banks.
Eg when at bank 1, 127 the next number is bank 2, 0.
I’m willing to pay. Can’t find anyone on fiver who has experience with the midi library.
Or maybe I should be happy with it all working except the midi in and just buy an midi merge box, as that will achieve the same outcome.
The wiring scheme for the pins
This is an earlier version with a couple of bits missing and a little program to calibrate, (we’ll get the values to put in the main code) expression pedals.
I’m not going to wade through that code in detail (sorry, but as Aria says, it’s just not worth the effort attempting to work out what a LLM might or not might be attempting to do), but I can spot a few areas it might be worth looking into if you are persistent.
It initialises MIDI with MIDI_CHANNEL_OFF - so that won’t help reception.
It mixes up using Serial and MIDI - they both will be trying to use the serial port (I think this is still the case with the Mega, but it’s been a while since I last used one) so they’ll be stealing received bytes of each other. Aside, you don’t need to set the RX pin for input, the serial driver sorts it all for you.
It uses Serial.available and Serial.read() but then also MIDI.read(). But seeing as the parameter to MIDI.read() should be a channel and it passes in the byte read from Serial, that won’t go swimmingly either…
It doesn’t seem to actually do anything with incomingByte anyway… were you just after software MIDI THRU?
That’s as far as I’m willing to go examining machine generated code I’m afraid. If you want some other avenues to follow, I have literally hundreds of examples of MIDI reading code on my blog, including one using repurposed old organ foot pedals and a couple using all serial ports on a Mega.
Yes software midi thru, unless the expressions are modifying anything, as the idea was that the code could then be repurposed at a later date for other expression pedals/program changer.
I’ll check you page. Thanks for at least maybe sending me in the right direction.
Are you essentially saying, I’m better moving to the TX1/RX1 pins so it’s not sharing with the USB serial on pins 0 and 1?
No, I’m saying you’re better off starting with some known working code designed to help you understand how the MIDI library works (like the examples that come with the MIDI library itself) than asking ChatGPT.
For basic software MIDI THRU you need to work in the following and remove all the Serial related stuff:
If you’re not planning on doing anything with the MIDI you receive then that should be all you need. It works as the serial interface already has THRU enabled by default, but you can 't use Serial.whatever() anywhere else in your code as the MIDI library has “grabbed” UART 0 for use.
If you’re designing your own circuit, it might even be better to implement a hardware MIDI THRU port. I can recommend the design of the ClumsyMIDI board for the Raspberry Pi as an example of how to do it (basically pass the MIDI in signal, post optoisolator, via a 74HCT14 or equivalent buffer to a MIDI out circuit).
I believe that is part of a secondary function.
You hold a button and use the octave buttons to change the Midi channel for the foot pedals.
Like pressing function/shift of other gear. Was trying to make it so I could add features without adding more buttons.
Tho on startup the code sets it as whatever you want at the top of the code.