Added MIDI DIN handeling
This commit is contained in:
		
							
								
								
									
										14
									
								
								FM/FM.ino
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								FM/FM.ino
									
									
									
									
									
								
							@ -4,12 +4,14 @@
 | 
				
			|||||||
#include <Smooth.h>
 | 
					#include <Smooth.h>
 | 
				
			||||||
#include <AutoMap.h> // maps unpredictable inputs to a range
 | 
					#include <AutoMap.h> // maps unpredictable inputs to a range
 | 
				
			||||||
#include <MIDIUSB.h>
 | 
					#include <MIDIUSB.h>
 | 
				
			||||||
 | 
					#include <MIDI.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MIDI_CREATE_DEFAULT_INSTANCE();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CONTROL_RATE 64
 | 
					#define CONTROL_RATE 64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool gate = 0;
 | 
					bool gate = 0;
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
// desired carrier frequency max and min, for AutoMap
 | 
					// desired carrier frequency max and min, for AutoMap
 | 
				
			||||||
const int MIN_CARRIER_FREQ = 22;
 | 
					const int MIN_CARRIER_FREQ = 22;
 | 
				
			||||||
const int MAX_CARRIER_FREQ = 440;
 | 
					const int MAX_CARRIER_FREQ = 440;
 | 
				
			||||||
@ -64,10 +66,14 @@ void noteOff(byte channel, byte note, byte velocity) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void setup(){
 | 
					void setup(){
 | 
				
			||||||
  startMozzi();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  pinMode(LED_BUILTIN_TX,INPUT); //switch rx and tx leds of, so they don't blink on midi
 | 
					  pinMode(LED_BUILTIN_TX,INPUT); //switch rx and tx leds of, so they don't blink on midi
 | 
				
			||||||
  pinMode(LED_BUILTIN_RX,INPUT);
 | 
					  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;
 | 
					  float mod_speed = (float)kMapModSpeed(LDR2_value)/1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  kIntensityMod.setFreq(mod_speed);
 | 
					  kIntensityMod.setFreq(mod_speed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  MIDI.read();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,5 +7,4 @@ DIY Arduino-based synth built with [Mozzi library](https://sensorium.github.io/M
 | 
				
			|||||||
- Add note buffer
 | 
					- Add note buffer
 | 
				
			||||||
- Tidy up the code (e.g. remove LDR references)
 | 
					- Tidy up the code (e.g. remove LDR references)
 | 
				
			||||||
- Tune the values and remap the knobs
 | 
					- Tune the values and remap the knobs
 | 
				
			||||||
- Add MIDI DIN connector
 | 
					 | 
				
			||||||
- Add LICENCE
 | 
					- Add LICENCE
 | 
				
			||||||
		Reference in New Issue
	
	Block a user