gitken
February 10, 2024, 11:57pm
1
I'm curious to know if anyone has used the Hardware Serial Library with MIDI, and whether or not it supports a 31250 baud (standard MIDI) rate.
There is a program called Midi-Sniffer from the Sparkfun site that uses Software Serial, it seems to work quite well.
I would like to use a Mega 2560 for Midi and use one of its real standard serial ports, or maybe more than one, creating kind of a Midi hub.
Any thoughts?
PieterP
February 11, 2024, 11:14am
2
What is the Hardware Serial Library?
You can use the hardware serial ports of the Mega for MIDI.
See e.g. Control Surface: MIDI Tutorial , where they use a HardwareSerialMIDI_Interface on Serial1.
To create a MIDI hub, have a look at the Routing MIDI messages at the bottom of that page.
Yes, I use the single serial output of a Nano to send and receive using the Midi library.
gitken
February 11, 2024, 6:39pm
4
I was able to get MidiSniffer from Sparkfun to do Midi on Mega 2560 Serial3 with minor changes suggested by another post on this forum (be sure to change all software serial port references to Serial3 in addition).
I asked Chat GPT "
anthony_artmann
Jun '23 post #12
OK. It's working! Thanks everyone. Solution posted here.
I asked Chat GPT "How can I set the Arduino MIDI library to use serial port 3?"
It responded:
#include <MIDI.h>
MIDI_CREATE_INSTANCE(HardwareSerial, Serial3, MIDI);
void setup() {
// Initialize Serial and MIDI
Serial.begin(9600);
Serial3.begin(31250);
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
// Your MIDI code here
}
How can I set the Arduino MIDI library to use serial port 3?"
It responded:
#include <MIDI.h>
MIDI_CREATE_INSTANCE(HardwareSerial, Serial3, MIDI);
void setup() {
// Initialize Serial and MIDI
Serial.begin(9600);
Serial3.begin(31250);
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
// Your MIDI code here
}
system
Closed
August 9, 2024, 6:40pm
5
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.