Der Arduino kann auch MIDI und ist somit auch als “Musikinstrument“ nutzbar…
Schaltungsaufbau:
MIDI-Pin 2 (schwarzes Kabel) führt zu Ground (GND).
MIDI Pin 4 (weißes Kabel) führt über einen Widerstand an 5 Volt.
MIDI Pin 5 (grünes Kabel) führt an Arduino-Pin 1.
Die MIDI-Buchse am Steckboard ist ein MIDI-Out und sendet (in meinem Fall) Daten an ein Yamaha Soundmodul.
Arduino-Code für MIDI-Projekt 1:
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
}
void loop() {
// play notes from F#-0 (0x1E) to F#-5 (0x5A):
for (int note = 0x1E; note < 0x5A; note ++) {
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
noteOn(0x90, note, 0x45);
delay(100);
//Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
noteOn(0x90, note, 0x00);
delay(100);
}
}
// plays a MIDI note. Doesn't check to see that
// cmd is greater than 127, or that data values are less than 127:
void noteOn(int cmd, int pitch, int velocity) {
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}
Arduino-Code für MIDI-Projekt 2:
void setup() {
Serial.begin(31250);
}
void loop() {
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
noteOn(0x90, 0x59, 0x45);
delay(1000);
//Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
noteOn(0x90, 0x59, 0x00);
delay(1000);
noteOn(0x99, 0x10, 0x45);
delay(1000);
noteOn(0x99, 0x10, 0x00);
delay(1000);
}
// plays a MIDI note. Doesn't check to see that
// cmd is greater than 127, or that data values are less than 127:
void noteOn(int cmd, int pitch, int velocity) {
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}
Arduino-Code für MIDI-Projekt 3:
int d = 250;
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
}
void loop() {
/*
Bass Drum = 0x23
Snare Drum = 0x26
*/
noteOn(0x99, 0x23, 0x45);
delay(d);
noteOn(0x99, 0x23, 0x00);
delay(d);
noteOn(0x99, 0x26, 0x45);
delay(d);
noteOn(0x99, 0x26, 0x00);
delay(d);
noteOn(0x99, 0x23, 0x45);
delay(d);
noteOn(0x99, 0x23, 0x00);
delay(d);
noteOn(0x99, 0x26, 0x45);
delay(d);
noteOn(0x99, 0x26, 0x00);
delay(d);
noteOn(0x99, 0x23, 0x45);
delay(d);
noteOn(0x99, 0x23, 0x00);
delay(d);
noteOn(0x99, 0x26, 0x45);
delay(d);
noteOn(0x99, 0x26, 0x00);
delay(d);
}
// plays a MIDI note. Doesn't check to see that
// cmd is greater than 127, or that data values are less than 127:
void noteOn(int cmd, int pitch, int velocity) {
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}
Arduino Gruppe Peine:
Wer sich für Mikrocontroller Programmierung interessiert ist in der Arduino Gruppe Peine genau richtig. Auch Raspberry Fans und Nutzer anderer Mikrocontroller sind willkommen.
Die Arduino Gruppe Peine trifft sich Dienstags von 18:00 Uhr bis 21:00 Uhr. Die Teilnehmerzahl ist begrenzt und deshalb bitte vorher per Kontaktformular oder Mail an info@fuhselab.de melden. Der Veranstaltungsort wird kurzfristig festgelegt und den Teilnehmerinnen und Teilnehmern per E-Mail mitgeteilt.
Das Angebot “Arduino Gruppe Peine“ kann für einen Jahresbeitrag von 60,- Euro genutzt werden. Für einen Beitrag von 20,- Euro pro Teilnehmer können die Workshops genutzt werden. Materialkosten werden projektabhängig zusätzlich erhoben.
Weitere interessante Webartikel zum Thema Arduino gibt es auf der Fuhselab Webseite und in der Artikelübersicht 2022 und der Artikelübersicht 2023.