From dcd53afeed1add124b8fb3fd03d8d0aa25ca9efb Mon Sep 17 00:00:00 2001 From: Oleksii Date: Fri, 23 Oct 2020 00:35:32 +0300 Subject: [PATCH] Added MIDI DIN handeling --- FM/FM.ino | 14 +++++++++++--- README.md | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/FM/FM.ino b/FM/FM.ino index 8605b16..8f2a392 100644 --- a/FM/FM.ino +++ b/FM/FM.ino @@ -4,11 +4,13 @@ #include #include // maps unpredictable inputs to a range #include +#include + +MIDI_CREATE_DEFAULT_INSTANCE(); #define CONTROL_RATE 64 bool gate = 0; - // desired carrier frequency max and min, for AutoMap const int MIN_CARRIER_FREQ = 22; @@ -64,10 +66,14 @@ void noteOff(byte channel, byte note, byte velocity) { } void setup(){ - startMozzi(); - pinMode(LED_BUILTIN_TX,INPUT); //switch rx and tx leds of, so they don't blink on midi pinMode(LED_BUILTIN_RX,INPUT); + + startMozzi(); + + MIDI.setHandleNoteOn(noteOn); + MIDI.setHandleNoteOff(noteOff); + MIDI.begin(); } @@ -114,6 +120,8 @@ void updateControl(){ float mod_speed = (float)kMapModSpeed(LDR2_value)/1000; kIntensityMod.setFreq(mod_speed); + + MIDI.read(); } diff --git a/README.md b/README.md index 8776031..5105f84 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,4 @@ DIY Arduino-based synth built with [Mozzi library](https://sensorium.github.io/M - Add note buffer - Tidy up the code (e.g. remove LDR references) - Tune the values and remap the knobs -- Add MIDI DIN connector - Add LICENCE \ No newline at end of file