Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2bf696637 |
@ -4,14 +4,16 @@
|
|||||||
// Code is partly based on Knob_LightLevel_x2_FMSynth example from Mozzi Library
|
// Code is partly based on Knob_LightLevel_x2_FMSynth example from Mozzi Library
|
||||||
//
|
//
|
||||||
// Although the code designed to work on Sitka Instruments WS-1.0 synth, it should
|
// Although the code designed to work on Sitka Instruments WS-1.0 synth, it should
|
||||||
// be pretty easy to adapt to run on other arduino/mozzi-based setups
|
// be pretty easy to adapt to run on other arduino/mozzi-based setups.
|
||||||
|
// Edit config.h to match your setup.
|
||||||
//
|
//
|
||||||
// This code is licenced under GPL v3 or later
|
// This code is licenced under GPL v3 or later
|
||||||
|
|
||||||
//ToDo:
|
//ToDo:
|
||||||
//test how accurate and fast oversampling is
|
//optimize MIDI input (maybe neohwserial and this parser might help https://github.com/eclab/grains/tree/main/midi)
|
||||||
//smooth harmonics knob?
|
//add ramp LFO
|
||||||
//rework LFO/Intensity so when LFO rate is 0, intensidy doesn't depend on its phase
|
//add uneven rations (like 3:2, 3:5)
|
||||||
|
//rework LFO/Intensity so when LFO rate is 0, intensity doesn't depend on its phase
|
||||||
|
|
||||||
#include <Mozzi.h>
|
#include <Mozzi.h>
|
||||||
#include <MIDI.h>
|
#include <MIDI.h>
|
||||||
@ -25,31 +27,7 @@
|
|||||||
#include <mozzi_midi.h>
|
#include <mozzi_midi.h>
|
||||||
#include <IntMap.h>
|
#include <IntMap.h>
|
||||||
#include <OverSample.h>
|
#include <OverSample.h>
|
||||||
|
#include "config.h"
|
||||||
//Settings
|
|
||||||
const int pitchSubSteps = 16; //set how many steps are there between semitones. set to 1 to quantize to semitones
|
|
||||||
const int driveAmount = 350;
|
|
||||||
const bool oversamplingEnabled = false; //makes V/OCT tracking more precise, but adds a little portamento
|
|
||||||
#define MIDI_CHANNEL 1 //MIDI_CHANNEL_OMNI
|
|
||||||
#define MOZZI_CONTROL_RATE 1024
|
|
||||||
|
|
||||||
//Hardware Definitions
|
|
||||||
#define Knob1 A6 //Intensity
|
|
||||||
#define Knob2 A4 //Modulator frequency ratio/Harmonics
|
|
||||||
#define Knob3 A2 //LFO Frequency
|
|
||||||
#define Knob4 A0 //LFO Shape
|
|
||||||
#define KnobA A5 //Attack
|
|
||||||
#define KnobDR A3 //Decay and Release
|
|
||||||
#define KnobS A1 //Sustain
|
|
||||||
#define CVIn A7 //CV input and Pitch knob
|
|
||||||
#define GateIn 10
|
|
||||||
#define EnvSwitch 11
|
|
||||||
#define DroneSwitch 12
|
|
||||||
#define LED 5
|
|
||||||
|
|
||||||
#define MOZZI_ANALOG_READ_RESOLUTION 10
|
|
||||||
|
|
||||||
MIDI_CREATE_DEFAULT_INSTANCE();
|
|
||||||
|
|
||||||
IntMap kMapCarrierNote( 0, 4095, 24 * pitchSubSteps, 84 * pitchSubSteps );
|
IntMap kMapCarrierNote( 0, 4095, 24 * pitchSubSteps, 84 * pitchSubSteps );
|
||||||
IntMap kMapIntensity( 0, 1023, 10, 350 );
|
IntMap kMapIntensity( 0, 1023, 10, 350 );
|
||||||
@ -107,7 +85,15 @@ void setup(){
|
|||||||
|
|
||||||
MIDI.setHandleNoteOn(MIDINoteOn);
|
MIDI.setHandleNoteOn(MIDINoteOn);
|
||||||
MIDI.setHandleNoteOff(MIDINoteOff);
|
MIDI.setHandleNoteOff(MIDINoteOff);
|
||||||
|
|
||||||
|
MIDI.setHandleClock(nullptr);
|
||||||
|
MIDI.setHandleStart(nullptr);
|
||||||
|
MIDI.setHandleStop(nullptr);
|
||||||
|
MIDI.setHandleContinue(nullptr);
|
||||||
|
MIDI.setHandleControlChange(nullptr);
|
||||||
|
|
||||||
MIDI.begin(MIDI_CHANNEL);
|
MIDI.begin(MIDI_CHANNEL);
|
||||||
|
MIDI.turnThruOff();
|
||||||
|
|
||||||
startMozzi();
|
startMozzi();
|
||||||
|
|
||||||
@ -117,6 +103,11 @@ void setup(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateControl(){
|
void updateControl(){
|
||||||
|
|
||||||
|
for(int i=0; i<10; i++) { // Hacky way to drain the buffer faster
|
||||||
|
MIDI.read();
|
||||||
|
}
|
||||||
|
|
||||||
//Get Control Values
|
//Get Control Values
|
||||||
int CVInVal = mozziAnalogRead(CVIn);
|
int CVInVal = mozziAnalogRead(CVIn);
|
||||||
int knob1Val = mozziAnalogRead(Knob1);
|
int knob1Val = mozziAnalogRead(Knob1);
|
||||||
@ -223,7 +214,6 @@ void updateControl(){
|
|||||||
gain = 255;
|
gain = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIDI.read();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioOutput updateAudio(){
|
AudioOutput updateAudio(){
|
||||||
|
|||||||
24
FLMNG/config.h
Normal file
24
FLMNG/config.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
//Settings
|
||||||
|
const int pitchSubSteps = 16; //set how many steps are there between semitones. set to 1 to quantize to semitones
|
||||||
|
const int driveAmount = 350;
|
||||||
|
const bool oversamplingEnabled = false; //makes V/OCT tracking more precise, but adds a little portamento
|
||||||
|
#define MIDI_CHANNEL 2 //MIDI_CHANNEL_OMNI
|
||||||
|
#define MOZZI_CONTROL_RATE 1024
|
||||||
|
|
||||||
|
//Hardware Definitions
|
||||||
|
#define Knob1 A6 //Intensity
|
||||||
|
#define Knob2 A4 //Modulator frequency ratio/Harmonics
|
||||||
|
#define Knob3 A2 //LFO Frequency
|
||||||
|
#define Knob4 A0 //LFO Shape
|
||||||
|
#define KnobA A5 //Attack
|
||||||
|
#define KnobDR A3 //Decay and Release
|
||||||
|
#define KnobS A1 //Sustain
|
||||||
|
#define CVIn A7 //CV input and Pitch knob
|
||||||
|
#define GateIn 10
|
||||||
|
#define EnvSwitch 11
|
||||||
|
#define DroneSwitch 12
|
||||||
|
#define LED 5
|
||||||
|
|
||||||
|
#define MOZZI_ANALOG_READ_RESOLUTION 10
|
||||||
|
|
||||||
|
MIDI_CREATE_DEFAULT_INSTANCE();
|
||||||
Reference in New Issue
Block a user