Download free music MP3s on genuine quality, the world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, The world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, stats, charts, biographies and concerts. stats, charts, biographies and concerts.
Sunday, July 30, 2023
[New post] Simple MIDI Serial Monitor – Part 3
Kevin posted: " This is a follow-up to the following posts: Simple MIDI Serial Monitor - which shows how to use SoftwareSerial as a MIDI port to allow monitoring over the default serial port. Simple MIDI Serial Monitor – Part 2 - which shows how to use SoftwareSe" Simple DIY Electronic Music Projects
This post takes one of my Arduino MIDI Proto Shields and adds some jumpers to switch between hardware serial and two configurations of software serial for use with the above.
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
These are the key Arduino tutorials for the main concepts used in this project:
The MIDI IN and OUT circuits can be connected to one of the following sets of IO pins using the jumpers:
Hardware UART: RX pin 0, TX pin 1
Software Serial: RX pin 2, TX pin 3
Software Serial: RX pin 10, TX pin 11
There are optional additional links that can be made to wire in the two TRS sockets to allow the shield to support either MIDI DIN or TRS connections. These links are probably best made on the underside of the PCB.
Build Notes
If TRS sockets are required to be added, then the proto shield PCB will need trimming down in size as shown here: Arduino Stackable TRS MIDI Interface.
At this point the jumper pin headers and TRS sockets can be added. The RX links are shown in green and the TX links in white. Note how the bottom of each set of three pin headers are joined on the underside of the pcb.
Note that the TRS sockets (if used) cannot be linked to the DIN sockets until the DIN sockets have been soldered on. Also recall that only the MIDI OUT socket is connected to GND.
The Arduino headers are the last things to be soldered.
The Code
This can use the code from Simple MIDI Serial Monitor (not part 2). In fact as part of this build, I've updated it slightly for extra debug messages and to support SysEx messages.
For more general use in other projects, the following is the key code required to have this work. If SWTEST is defined then MIDI will be configured on one of the SoftwareSerial links. If SWTEST is commented out, then MIDI will use the hardware serial port as usual.
#include <MIDI.h> // Comment out to remove test code and put MIDI on default Serial port #define SWTEST #ifdef SWTEST // MIDI on the SoftwareSerial port #include <SoftwareSerial.h> #define SS_RX 2 // or 10 #define SS_TX 3 // or 11 using Transport = MIDI_NAMESPACE::SerialMIDI<SoftwareSerial>; SoftwareSerial sSerial = SoftwareSerial(SS_RX, SS_TX); Transport serialMIDI(sSerial); MIDI_NAMESPACE::MidiInterface<Transport> MIDI((Transport&)serialMIDI); #else // MIDI on the default (hardware) serial port MIDI_CREATE_DEFAULT_INSTANCE();
No comments:
Post a Comment