A MIDI piano synthesizer that implements the Karplus Strong physical modeling algorithm.
Dependencies: mbed USBDevice PinDetect
Diff: main.cpp
- Revision:
- 0:cad8dafb22be
- Child:
- 2:e21bd39bdf46
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 06 18:48:44 2016 +0000 @@ -0,0 +1,36 @@ +// Hello World example for the USBMIDI library + +#include "mbed.h" +#include "USBMIDI.h" + +Serial pc(USBTX, USBRX); +DigitalOut led(LED1); + +USBMIDI midi; + +void midiMessageReceived(MIDIMessage message) { + pc.printf("Message Received\r\n"); + led = !led; + + switch (message.type()) { + case MIDIMessage::NoteOnType: + pc.printf("\tType: Note On\r\n"); + pc.printf("\tNote: %d\r\n", message.key()); + break; + case MIDIMessage::NoteOffType: + pc.printf("\tType: Note Off\r\n"); + break; + default: + pc.printf("\tType: Other\r\n"); + } +} + +int main() { + pc.printf("In Main\r\n"); + midi.attach(midiMessageReceived); + led = 1; + + while (1) { + } +} +