debugging buffer
This commit is contained in:
parent
032d9f3e1a
commit
16c22072a1
34
FM/FM.ino
34
FM/FM.ino
|
@ -75,17 +75,18 @@ void updateBuffer(byte bNote, bool bGate) {
|
||||||
playNote();
|
playNote();
|
||||||
bufferIndex++;
|
bufferIndex++;
|
||||||
}
|
}
|
||||||
if (bGate == 0 && bufferIndex != 0) {
|
if (bGate == 0) { // && bufferIndex != 0
|
||||||
for (int i = 0; i <= bufferIndex; i++) {
|
for (int i = 0; i <= bufferIndex; i++) {
|
||||||
if (noteBuffer[i] == bNote) {
|
if (noteBuffer[i] == bNote) {
|
||||||
// Removing the note from the array and shifting everything to close the gap
|
// Removing the note from the array and shifting everything to close the gap
|
||||||
for (int n = i; n <= bufferIndex; n++) {
|
for (int n = i; n <= bufferIndex; n++) {
|
||||||
noteBuffer[n] = noteBuffer[n + 1]; // what happens if it's the last note in buffer?
|
noteBuffer[n] = noteBuffer[n + 1]; // what happens if it's the last note in buffer?
|
||||||
}
|
}
|
||||||
if (i == bufferIndex) {
|
if (i == bufferIndex) { //this does not fire
|
||||||
bufferIndex--;
|
bufferIndex--;
|
||||||
playNote();
|
gate = 1;
|
||||||
} else {
|
playNote();
|
||||||
|
} else { //this does fire
|
||||||
bufferIndex--;
|
bufferIndex--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ void updateBuffer(byte bNote, bool bGate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void playNote() {
|
void playNote() {
|
||||||
byte note = noteBuffer[bufferIndex];
|
byte note = noteBuffer[bufferIndex];
|
||||||
carrier_freq = mtof((int) note);
|
carrier_freq = mtof((int) note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +138,8 @@ void updateControl(){
|
||||||
// set the FM oscillator frequencies
|
// set the FM oscillator frequencies
|
||||||
aCarrier.setFreq(carrier_freq);
|
aCarrier.setFreq(carrier_freq);
|
||||||
aModulator.setFreq(mod_freq);
|
aModulator.setFreq(mod_freq);
|
||||||
|
|
||||||
|
//Knob 1
|
||||||
int Knob1value= mozziAnalogRead(CONTROLL1); // value is 0-1023
|
int Knob1value= mozziAnalogRead(CONTROLL1); // value is 0-1023
|
||||||
int Knob1calibrated = kMapIntensity(Knob1value);
|
int Knob1calibrated = kMapIntensity(Knob1value);
|
||||||
|
|
||||||
|
@ -151,7 +153,25 @@ void updateControl(){
|
||||||
float mod_speed = (float)kMapModSpeed(Knob2value)/1000;
|
float mod_speed = (float)kMapModSpeed(Knob2value)/1000;
|
||||||
kIntensityMod.setFreq(mod_speed);
|
kIntensityMod.setFreq(mod_speed);
|
||||||
|
|
||||||
//MIDI DIN
|
// Debugging
|
||||||
|
Serial.print("Buffer Index: ");
|
||||||
|
Serial.print(bufferIndex);
|
||||||
|
|
||||||
|
Serial.print(" | Knob1: "); //3rd on the pannel, connected to A0
|
||||||
|
Serial.print(Knob1calibrated);
|
||||||
|
|
||||||
|
Serial.print(" | Knob2: "); //2nd on the pannel, conntcted to A1
|
||||||
|
Serial.print(Knob2value);
|
||||||
|
|
||||||
|
Serial.print(" | Knob3: "); //1st on the pannel, connected to A2, unstable around 0
|
||||||
|
Serial.print(FRQ);
|
||||||
|
|
||||||
|
Serial.print(" | Knob4: "); //4th on the pannel, A3
|
||||||
|
Serial.print(knob4calibrated);
|
||||||
|
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
// MIDI DIN
|
||||||
MIDI.read();
|
MIDI.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,6 @@ DIY Arduino-based synth built with [Mozzi library](https://sensorium.github.io/M
|
||||||
|
|
||||||
## ToDo:
|
## ToDo:
|
||||||
- Add note buffer
|
- Add note buffer
|
||||||
- Tune the values, remap the knobs, clean up the code
|
- Tune the values, remap the knobs, clean up the code
|
||||||
|
- Update readme
|
||||||
|
- Add schematics and documentations
|
Loading…
Reference in New Issue