Hi,
I'm great at searching through these forums and usually find the answer to my issue ... but not this time (I've been playing with teensy's for years!).
I'm just starting to play with wav's and the audioshield and hit an issue that's baffling me. I'm using a teensy 3.6 with the audio shield and I had this code (attached below) running fine off the audioshield's SD reader, but there was a crackling just before the wav would play ... I wasn't very happy with that so I decided to try the teensy 3.6 built in sd reader. I commented out the audioshield SD pin definitions and uncommented the teensy 3.6 SD pin definitions. I immediately got the error "BUILTIN_SDCARD" was not declared in this scope. I searched the forums and learned that if I delete the SD.h library it will work. I did that, and was able to play my wav off the teensy 3.6 built in SD card reader BUT the volume is so low, and the volume command is no longer doing anything.
I'm hoping someone can help guide me on my way. The audioshield is still playing my wav file (I'm assuming because I loaded 16bit wavs), but it is definitely not amplifying my audio anymore.
Thanks, I updated my teensyduino (1.36), all libraries (SD.h is 1.1.0) and my arduino IDE (1.8.2) this morning.
*though updating SD.h is really weird, I choose update to 1.1.1 and click install and then it says I'm on version 1.0.8 ... 1.1.0 seems to stick*
UPDATE: I restarted Arduino IDE and now I can't hear the wav file, even quietly.
I'm great at searching through these forums and usually find the answer to my issue ... but not this time (I've been playing with teensy's for years!).
I'm just starting to play with wav's and the audioshield and hit an issue that's baffling me. I'm using a teensy 3.6 with the audio shield and I had this code (attached below) running fine off the audioshield's SD reader, but there was a crackling just before the wav would play ... I wasn't very happy with that so I decided to try the teensy 3.6 built in sd reader. I commented out the audioshield SD pin definitions and uncommented the teensy 3.6 SD pin definitions. I immediately got the error "BUILTIN_SDCARD" was not declared in this scope. I searched the forums and learned that if I delete the SD.h library it will work. I did that, and was able to play my wav off the teensy 3.6 built in SD card reader BUT the volume is so low, and the volume command is no longer doing anything.
I'm hoping someone can help guide me on my way. The audioshield is still playing my wav file (I'm assuming because I loaded 16bit wavs), but it is definitely not amplifying my audio anymore.
Thanks, I updated my teensyduino (1.36), all libraries (SD.h is 1.1.0) and my arduino IDE (1.8.2) this morning.
*though updating SD.h is really weird, I choose update to 1.1.1 and click install and then it says I'm on version 1.0.8 ... 1.1.0 seems to stick*
UPDATE: I restarted Arduino IDE and now I can't hear the wav file, even quietly.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav bell1;
AudioPlaySdWav bell2;
AudioPlaySdWav bell3;
AudioOutputI2S headphones;
AudioConnection c1(bell1,0,headphones,0);
AudioConnection c2(bell1,0,headphones,1);
AudioConnection c3(bell2, headphones);
AudioConnection c5(bell3, headphones);
AudioControlSGTL5000 audioshield;
// Use these with the Teensy Audio Shield
//#define SDCARD_CS_PIN 10
//#define SDCARD_MOSI_PIN 7
//#define SDCARD_SCK_PIN 14
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11 // not actually used
#define SDCARD_SCK_PIN 33 // not actually used
void setup() {
AudioMemory(10);
// turn on the output
audioshield.enable();
audioshield.volume(0.5);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
pinMode(13, OUTPUT); // LED on pin 13
delay(1000);
}
void loop() {
if (bell1.isPlaying() == false) {
bell1.play("123.wav");
delay(10);
Serial.println("play");
digitalWrite(13,HIGH);
}
}
Last edited: