#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav2; //xy=411,434
AudioPlaySdWav playSdWav3; //xy=428,498
AudioPlaySdWav playSdWav1; //xy=439,351
AudioPlaySdWav playSdWav4; //xy=460,575
AudioOutputI2S i2s1; //xy=712,329
AudioConnection patchCord1(playSdWav1, 0, i2s1, 0);
AudioConnection patchCord2(playSdWav1, 1, i2s1, 1);
// GUItool: end automatically generated code
// Use these with the Teensy Audio Shield
//#define SDCARD_CS_PIN 10
//#define SDCARD_MOSI_PIN 7
//#define SDCARD_SCK_PIN 14
// Use these with the Teensy 3.5 & 3.6 SD card
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11 // not actually used
#define SDCARD_SCK_PIN 13 // not actually used
// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13
int inByte = 0;
byte newDATAin = 1;
void setup() {
Serial.begin(115200);
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(100);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
}
void loop() {
switch (Serial.read()) {
case 's': {
Serial.println("s");
// envelope1.noteOff();
// envelope2.noteOff();tttttttttttt
playSdWav1.stop();
playSdWav2.stop();
playSdWav3.stop();
playSdWav4.stop();
//playSdWav5.stop();
//playSdWav6.stop();
//playSdWav7.stop();
//playSdWav8.stop();
}
break;
case 't': {
playSdWav1.play("10BAB1.WAV");
delay(5);
playSdWav2.play("10BAB2.WAV");
playSdWav3.play("10BAB3.WAV");
playSdWav4.play("10BAB4.WAV");
}
break;
}
}