Hi all,
I try to build a very basic system: I have several WAV files on the SD card named SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV etc
I want to have the Teensy (3.2 + Audio Shield) to randomly load a file, play it and randomly load another file etc, ad libitum.
So, I modified this code which doesn't seems to work with any of my two Teensys.
Any idea ?
Thanks for all !
I try to build a very basic system: I have several WAV files on the SD card named SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV etc
I want to have the Teensy (3.2 + Audio Shield) to randomly load a file, play it and randomly load another file etc, ad libitum.
So, I modified this code which doesn't seems to work with any of my two Teensys.
Any idea ?
Thanks for all !
PHP:
#include <Audio.h>
#include <SD.h>
long randNumber;
AudioPlaySdWav playSdWav1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(playSdWav1, 0, i2s1, 0);
AudioConnection patchCord2(playSdWav1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;
void setup() {
Serial.begin(9600);
AudioMemory(8);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
while (!Serial && millis() < 2500) ; // wait 2.5 sec for Arduino Serial Monitor
Serial.println("begin random player");
}
void loop() {
randNumber = random(1, 5);
String myString1 = "SDTEST";
String myString2 = ".WAV";
String myFile = myString1 + randNumber + myString2;
Serial.println(myFile);
playSdWav1.play(myFile.c_str());
}