Demonstration of the Stepper Synth:
(Full playlist: https://www.youtube.com/playlist?list=PL2ooT_IbEkqMiinSHTkgUE5FmuR5s200x)
ALL project information is contained within this "details" section below, the project logs are recordings of the box playing music only :)
MIDI Implementation Information:
How do I send midi through the Arduino Uno serial link (from windows)?
Step 1: -->
Use "loopMIDI" to create a virtual midi device in the windows environment.
https://www.tobias-erichsen.de/software/loopmidi.html
Step 2: -->
Use "Hairless MIDI" to send midi data from your virtual loopmidi midi device (as a "MIDI In") to your Arduino Uno serial port. Make sure to set the serial baud rate in the preferences to match your Arduino code.
You will need to disable hairless to program your Arduino each and every time...
https://projectgus.github.io/hairless-midiserial/
Step 3: -->
Use "MIDIMapper" to force windows to output midi to your loopmidi virtual device.
https://coolsoft.altervista.org/en/midimapper
Step 4: -->
Play a midi file using anything in windows that would ordinarily play midi. I use Winamp.
https://www.winamp.com/
If you're using midi specific software that can select a midi device directly, you can skip step 3. Try Anvil studio:
https://www.anvilstudio.com/
OR for testing purposes you can use "VMPK" (a virtual midi keyboard) to send any note. Just make sure it is actually sending to the loopmidi device and not ignoring the now modified windows default.
https://vmpk.sourceforge.io/
If your Arduino board supports a native USB (and you are using the usb midi Arduino libraries) you can skip steps 1 and 2.
How do you process the midi information in the Arduino environment?
I used the "Arduino MIDI Library":
https://github.com/FortySevenEffects/arduino_midi_library
This library covers both the usage of the programming port (i.e. over 'serial') and the native USB port. The difference is only inserting the phrase 'USB' a couple of times for setup. The rest is the same.
How do you prepare a MIDI file to sound the best on a stepper synth?
Step 1: -->
Using "Anvil Studio" (mentioned above), I open the midi file and identify the key 4 tracks of the music. I then set these 4 tracks to channels 1, 2, 3 & 4 if it's that simple.
Step 2: -->
If more then one note at once is being played on a track (i.e. chords), I duplicate that track and use the "Track" > "Limit the number of notes played at one time..." option to play, say, the highest note and lowest note (opposite options for each of the identically duplicated tracks. This, of course, means you need another channel.
Step 3: -->
If you notice that there are tracks playing only at times when another track is not playing then combine them! Do this by setting both of those tracks to the same channel! All the steppers sound the same so they may as well play other parts if they're not in confliction! Even if they are, Anvil will choose the higher/lower note (I don't know which).
Step 4: -->
Transpose the entire song (or track only) up/down octaves to fall within the frequency range of the synth. Usually there is no lower limit. Higher frequency notes are hard to hit due to stepper torque requirements for rapid acceleration!
Step 5: -->
Modify the music! As there is no volume control for this implementation (though you could if you dynamically controlled the stepper current), you may want instrument solos to be louder. At those parts of the song only 1 or 2 channels will be playing and you can simply copy paste the music to the other channels so as to really exaggerate the solos.
Stepper Motor Control:
First of all, I'd love to give a shoutout to Jonathan Kayne who's work I originally based my project off of: https://www.hackster.io/JonJonKayne/arduino-midi-stepper-synth-d291ae
Although the software/hardware has changed from his implementation, I never would have tackled this project without his initial work that broke my fear of implementing midi into a project.
Hardware Implementation
The hardware used is actually functionally...
Thanks!
By tuning do you mean finding the resonant speeds? Unfortunately I only have 1 type of stepper motor, so I can't confirm. I did have some slight variation between the steppers I used though, but that could also be due to the stepper current being slightly different for each motor (sensitive set-point potentiometers). The variation wasn't enough to warrant differentiating the motors in software though.