Skip to content

Instantly share code, notes, and snippets.

@tecteun
Created July 18, 2025 19:33
Show Gist options
  • Save tecteun/60633ea2084782a55070175466b1fc50 to your computer and use it in GitHub Desktop.
Save tecteun/60633ea2084782a55070175466b1fc50 to your computer and use it in GitHub Desktop.
XIAO MIDI Synthesizer RP2040 USB midi
#include <Arduino.h>
#include <Adafruit_TinyUSB.h>
#include <MIDI.h>
#include "SAM2695Synth.h"
#include <SoftwareSerial.h>
SoftwareSerial SSerial(D7, D6); // RX, TX
#define COM_SERIAL SSerial
SAM2695Synth<SoftwareSerial> synth = SAM2695Synth<SoftwareSerial>::getInstance();
// USB MIDI object
Adafruit_USBD_MIDI usb_midi;
void setup() {
usb_midi.begin();
SSerial.begin(31250);
}
void loop() {
uint8_t packet[4];
if(usb_midi.available() > 0){
usb_midi.readPacket(packet);
SSerial.write(packet, 4);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment