jeanmichelrey
New member
Hello,
I am on a project which needs to read a wav file from the internal SD reader of a Teensy 3.5, without the audio shield, directly on the DAC of the card, connected to a small amplifier PAM8403.
Everything works fine if I use a waveform for example or any synth module.
However, I cannot read a wav file from the sd card.
I managed to read and write a text file, so I have no hardware problem.
In the code, if I uncomment the part which tests if the card is ready (if(!(SD.begin(SDCARD_CS_PIN))...) , I have the error "BUILTIN_SDCARD was not declared in this scope".
And of course, if I leave it in a comment, the code runs but the test file is not played.
Any help would be welcome.
Thanks in advance.
I am on a project which needs to read a wav file from the internal SD reader of a Teensy 3.5, without the audio shield, directly on the DAC of the card, connected to a small amplifier PAM8403.
Everything works fine if I use a waveform for example or any synth module.
However, I cannot read a wav file from the sd card.
I managed to read and write a text file, so I have no hardware problem.
In the code, if I uncomment the part which tests if the card is ready (if(!(SD.begin(SDCARD_CS_PIN))...) , I have the error "BUILTIN_SDCARD was not declared in this scope".
And of course, if I leave it in a comment, the code runs but the test file is not played.
Any help would be welcome.
Thanks in advance.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav playWav1;
AudioOutputAnalogStereo dacs1;
AudioConnection patchCord1(playWav1, 0, dacs1, 0);
AudioConnection patchCord2(playWav1, 1, dacs1, 1);
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13
void setup() {
[INDENT] Serial.begin(9600);
AudioMemory(8);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
[COLOR="#FF0000"]// if (!(SD.begin(SDCARD_CS_PIN))) {
// while (1) {
// Serial.println("Unable to access the SD card");
// delay(500);
// }
// }[/COLOR]
Serial.println("Playing...");
playWav1.play("TEST.WAV");
delay(5);
while (playWav1.isPlaying()) {
}
Serial.println("Finish");[/INDENT]
}
void loop() {
}
Last edited by a moderator: