#include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> #include <SerialFlash.h>
//MUX //Constants #define number_of_mux 1 #define numOfMuxPins number_of_mux * 8 //#define enPin 6 #define channelA 0 #define channelB 1 #define channelC 2 //Parameters const int comPin = A8; //A0 on the prototype -- A8 on the PCB boards
//current value of the potentiometers float potValues[numOfMuxPins] = {0, 0, 0, 0, 0, 0, 0, 0};
const int potCount = numOfMuxPins; //how many buttons I have ^
#include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> #include <SerialFlash.h>
// GUItool: begin automatically generated code AudioSynthWaveform waveform1; //xy=82.57141876220703,1581.5713844299316 AudioSynthWaveform waveform3; //xy=82.28570938110352,1668.428560256958 AudioSynthWaveform waveform2; //xy=83.14285278320312,1624.2857913970947 AudioSynthWaveform waveform6; //xy=82.85713195800781,1799.9999523162842 AudioSynthWaveform waveform7; //xy=82.8571548461914,1844.2857341766357 AudioSynthWaveform waveform8; //xy=82.85714721679688,1888.5713787078857 AudioSynthWaveform waveform4; //xy=84.28570938110352,1712.8570442199707 AudioSynthWaveform waveform5; //xy=84.28571319580078,1755.714361190796 AudioMixer4 mixer1; //xy=272.9999465942383,1690.2856674194336 AudioMixer4 mixer2; //xy=275.57139587402344,1760.8570957183838 AudioMixer4 mixer6; //xy=410.00000762939453,1752.8571472167969 AudioSynthWaveformDc dc1; //xy=442.1428756713867,1995.9999990463257 AudioEffectEnvelope envelope1; //xy=558.2857208251953,1681.857165336609 AudioEffectEnvelope envelope4; //xy=582.7143096923828,1994.5714120864868 AudioMixer4 mixer3; //xy=720.1429252624512,1757.5712757110596 AudioFilterStateVariable filter1; //xy=790.7142791748047,1940.7140254974365 AudioMixer4 mixer5; //xy=961.2698364257812,1771.587547302246 AudioMixer4 mixer4; //xy=1094.6189460754395,1966.03173828125 AudioEffectDelay delay1; //xy=1174.8732376098633,1750.809383392334 AudioOutputI2S i2s2; //xy=1388.508056640625,1858.7618799209595 AudioConnection patchCord1(waveform1, 0, mixer1, 0); AudioConnection patchCord2(waveform3, 0, mixer1, 2); AudioConnection patchCord3(waveform2, 0, mixer1, 1); AudioConnection patchCord4(waveform6, 0, mixer2, 1); AudioConnection patchCord5(waveform7, 0, mixer2, 2); AudioConnection patchCord6(waveform8, 0, mixer2, 3); AudioConnection patchCord7(waveform4, 0, mixer1, 3); AudioConnection patchCord8(waveform5, 0, mixer2, 0); AudioConnection patchCord9(mixer1, 0, mixer6, 0); AudioConnection patchCord10(mixer2, 0, mixer6, 1); AudioConnection patchCord11(mixer6, envelope1); AudioConnection patchCord12(mixer6, 0, mixer3, 1); AudioConnection patchCord13(dc1, envelope4); AudioConnection patchCord14(envelope1, 0, mixer3, 0); AudioConnection patchCord15(envelope4, 0, filter1, 1); AudioConnection patchCord16(mixer3, 0, filter1, 0); AudioConnection patchCord17(filter1, 0, mixer4, 0); AudioConnection patchCord18(filter1, 0, mixer5, 0); AudioConnection patchCord19(mixer5, delay1); AudioConnection patchCord20(mixer4, 0, i2s2, 0); AudioConnection patchCord21(mixer4, 0, i2s2, 1); AudioConnection patchCord22(delay1, 0, mixer4, 1); AudioConnection patchCord23(delay1, 0, mixer5, 1); AudioControlSGTL5000 sgtl5000_1; //xy=731.4285697937012,1513.7142906188965 // GUItool: end automatically generated code
float frequency = 440; int arpOrderSelect = 0;
//KNOBS int potPin1 = A17; // Analog pin for first potentiometer // frequency of oscillator float lastFrequency = -1;
int potPin2 = A16; // Analog pin for the second potentiometer // frequency of filter
int resonancePotPin = A11; // Analog pin for the resonance of filter
int potPin3 = A15; // Analog pin for arp speed float arpeggioSpeed = 500.0; //default speed (eg. 14 notes)
int potPin4 = A13; // Analog pin for arp index
int potPin5 = A12; // Analog pin for arp order
int waveformPotPin = A3; // Analog pin for waveform select
int attackPotValue = 0; int decayPotValue = 0; int attackEnvPotValue = 0; int decayEnvPotValue = 0; int delayPotValue = 0; float delayfeedbackPotValue = 0;
//Tap BPM Button int tapBPMPin = 28; //Digital pin for tap bpm button int lastTapBPM = 0; unsigned long tapTimes[] = {0, 0}; int lastTapBPMIndex = 0; int tapBPMValue = 0; int lastTapBPMValue = 0;
//ARP BUTTONS int buttonArpModePin = 33; //Change from Arp Mode to Synth Mode int buttonArpModeValue = 0;
int chordIndex = 0;
//ARP KNOBS int arpChords [5][4] = {{0, 4, 7, 12}, {0, 3, 7, 12}, {0, 4, 7, 11}, {0, 3, 7, 10}, {0, 4, 7, 10}};
int arpOrder [4][4] = {{0, 1, 2, 3}, {3, 2, 1, 0}, {3, 0, 1, 2}, {2, 3, 1, 0}};