#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformDc dc1; //xy=204.33333206176758,663.0000004768372
AudioSynthWaveformModulated waveformMod6; //xy=596.3333320617676,543.0000004768372
AudioSynthWaveformModulated waveformMod1; //xy=606.3333320617676,171.00000047683716
AudioSynthWaveformModulated waveformMod2; //xy=606.3333320617676,251.00000047683716
AudioSynthWaveformModulated waveformMod4; //xy=608.3333320617676,393.00000047683716
AudioSynthWaveformModulated waveformMod10; //xy=612.3333320617676,875.0000004768372
AudioSynthWaveformModulated waveformMod5; //xy=614.3333320617676,461.00000047683716
AudioSynthWaveformModulated waveformMod3; //xy=615.3333320617676,318.00000047683716
AudioSynthWaveformModulated waveformMod9; //xy=619.3333320617676,800.0000004768372
AudioSynthWaveformModulated waveformMod7; //xy=620.3333320617676,639.0000004768372
AudioSynthWaveformModulated waveformMod8; //xy=620.3333320617676,727.0000004768372
AudioSynthWaveformModulated waveformMod16; //xy=622.3333320617676,945.0000004768372
AudioSynthWaveformModulated waveformMod13; //xy=622.3333320617676,1137.0000004768372
AudioSynthWaveformModulated waveformMod11; //xy=624.3333320617676,1008.0000004768372
AudioSynthWaveformModulated waveformMod14; //xy=629.3333320617676,1194.0000004768372
AudioSynthWaveformModulated waveformMod15; //xy=629.3333320617676,1245.0000004768372
AudioSynthWaveformModulated waveformMod12; //xy=641.3333320617676,1069.0000004768372
AudioMixer4 mixer1; //xy=867.3333320617676,324.00000047683716
AudioMixer4 mixer2; //xy=867.3333320617676,544.0000004768372
AudioMixer4 mixer3; //xy=869.3333320617676,944.0000004768372
AudioMixer4 mixer4; //xy=869.3333320617676,1147.0000004768372
AudioFilterLadder ladder4; //xy=1022.5000152587891,1160.0001392364502
AudioFilterLadder ladder2; //xy=1029.1666412353516,557.5000095367432
AudioFilterLadder ladder1; //xy=1032.5000762939453,337.500036239624
AudioFilterLadder ladder3; //xy=1048.3333282470703,958.3333225250244
AudioMixer4 mixer5; //xy=1533.166763305664,801.1667594909668
AudioOutputI2S i2s1; //xy=1776.8333930969238,787.0000114440918
AudioConnection patchCord1(dc1, 0, waveformMod1, 0);
AudioConnection patchCord2(dc1, 0, waveformMod2, 0);
AudioConnection patchCord3(dc1, 0, waveformMod3, 0);
AudioConnection patchCord4(dc1, 0, waveformMod4, 0);
AudioConnection patchCord5(dc1, 0, waveformMod5, 0);
AudioConnection patchCord6(dc1, 0, waveformMod6, 0);
AudioConnection patchCord7(dc1, 0, waveformMod7, 0);
AudioConnection patchCord8(dc1, 0, waveformMod8, 0);
AudioConnection patchCord9(dc1, 0, waveformMod9, 0);
AudioConnection patchCord10(dc1, 0, waveformMod10, 0);
AudioConnection patchCord11(dc1, 0, waveformMod16, 0);
AudioConnection patchCord12(dc1, 0, waveformMod11, 0);
AudioConnection patchCord13(dc1, 0, waveformMod12, 0);
AudioConnection patchCord14(dc1, 0, waveformMod13, 0);
AudioConnection patchCord15(dc1, 0, waveformMod14, 0);
AudioConnection patchCord16(dc1, 0, waveformMod15, 0);
AudioConnection patchCord17(waveformMod6, 0, mixer2, 1);
AudioConnection patchCord18(waveformMod1, 0, mixer1, 0);
AudioConnection patchCord19(waveformMod2, 0, mixer1, 1);
AudioConnection patchCord20(waveformMod4, 0, mixer1, 3);
AudioConnection patchCord21(waveformMod10, 0, mixer3, 1);
AudioConnection patchCord22(waveformMod5, 0, mixer2, 0);
AudioConnection patchCord23(waveformMod3, 0, mixer1, 2);
AudioConnection patchCord24(waveformMod9, 0, mixer3, 0);
AudioConnection patchCord25(waveformMod7, 0, mixer2, 2);
AudioConnection patchCord26(waveformMod8, 0, mixer2, 3);
AudioConnection patchCord27(waveformMod16, 0, mixer3, 2);
AudioConnection patchCord28(waveformMod13, 0, mixer4, 1);
AudioConnection patchCord29(waveformMod11, 0, mixer3, 3);
AudioConnection patchCord30(waveformMod14, 0, mixer4, 2);
AudioConnection patchCord31(waveformMod15, 0, mixer4, 3);
AudioConnection patchCord32(waveformMod12, 0, mixer4, 0);
AudioConnection patchCord33(mixer1, 0, ladder1, 0);
AudioConnection patchCord34(mixer2, 0, ladder2, 0);
AudioConnection patchCord35(mixer3, 0, ladder3, 0);
AudioConnection patchCord36(mixer4, 0, ladder4, 0);
AudioConnection patchCord37(ladder4, 0, mixer5, 3);
AudioConnection patchCord38(ladder2, 0, mixer5, 1);
AudioConnection patchCord39(ladder1, 0, mixer5, 0);
AudioConnection patchCord40(ladder3, 0, mixer5, 2);
AudioConnection patchCord41(mixer5, 0, i2s1, 0);
AudioConnection patchCord42(mixer5, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=1008.3333320617676,251.00000047683716
// GUItool: end automatically generated code
struct OSC {
AudioSynthWaveformModulated *osc;
} oscillators[16];
void setup() {
// Serial.begin(115200);
AudioMemory(80);
oscillators[0].osc = &waveformMod1;
oscillators[1].osc = &waveformMod2;
oscillators[2].osc = &waveformMod3;
oscillators[3].osc = &waveformMod4;
oscillators[4].osc = &waveformMod5;
oscillators[5].osc = &waveformMod6;
oscillators[6].osc = &waveformMod7;
oscillators[7].osc = &waveformMod8;
oscillators[8].osc = &waveformMod9;
oscillators[9].osc = &waveformMod10;
oscillators[10].osc = &waveformMod11;
oscillators[11].osc = &waveformMod12;
oscillators[12].osc = &waveformMod13;
oscillators[13].osc = &waveformMod14;
oscillators[14].osc = &waveformMod15;
oscillators[15].osc = &waveformMod16;
// put your setup code here, to run once:
mixer5.gain(0, 0);
mixer5.gain(1, 0);
mixer5.gain(2, 0);
mixer5.gain(3, 0);
mixer1.gain(0, 0);
mixer1.gain(1, 0);
mixer1.gain(2, 0);
mixer1.gain(3, 0);
mixer2.gain(0, 0);
mixer2.gain(1, 0);
mixer2.gain(2, 0);
mixer2.gain(3, 0);
mixer3.gain(0, 0);
mixer3.gain(1, 0);
mixer3.gain(2, 0);
mixer3.gain(3, 0);
mixer4.gain(0, 0);
mixer4.gain(1, 0);
mixer4.gain(2, 0);
mixer4.gain(3, 0);
for (int i = 0; i < 16 ; i++) {
oscillators[i].osc->begin(0.5f,440.f, WAVEFORM_SINE);
}
sgtl5000_1.enable();
sgtl5000_1.lineOutLevel(13);
sgtl5000_1.autoVolumeDisable();
sgtl5000_1.audioProcessorDisable();
}
void loop() {
static bool toggle = false;
delay(1000);
toggle = (toggle)?0:1;
float oscAmp = (toggle)?0.1:0.0;
for (int i=0; i<16 ; i++) {
oscillators[i].osc->amplitude(oscAmp);
}
}