I have a Teensy 3.2 & an audio shield rev B. I soldered headers for the connections between the boards, that seems to all be correct. The SDTest and WAVFilePlayer examples work OK.
Arduino 1.6.5 with Teensyduino 1.25 installed on OS X 10.9.5 is used for programming.
The aim is to have a background sound that loops (actually two 300MB, 30 minute WAVs).
6 buttons trigger the shield to play short sounds that also set an output to activate LEDs during playback (mosfets will handle that). I'm testing with a single LED at the moment (pin 16).
The buttons are setup with hardware debouncing (via inverting Schmitt trigger). As covered at http://www.jeremyblum.com/2011/03/07/arduino-tutorial-10-interrupts-and-hardware-debouncing/
I'm using interrupts for handling the inputs.
At the moment the audio keeps failing to work correctly - the sound randomly plays a 'tone' straight after a button press & the teensy needs to be powered off to stop it. The background sound ceases playback too, it will reboot via USB. There is a brief burst of 'white noise' before the failure.
It seems to be less of an issue if I turn down the volume, however I can't see anything wrong with my source WAV's they appear to be encoded fine without signs of clipping.
Tried so far...
I saw a mention of the audio library version as a possible issue in another thread here, I have the 'built in' 1.2.0 installed and 1.25 of the Teensyduino library, could that be an issue? Please point me to sources if that needs to be updated. It's a little unclear to me which pieces are from Arduino & which are from Teensyduino libraries.
I have a Sandisk Ultra SD Card on order & will test again when it arrives.
What can I do to debug this? Does it seem like a possible hardware fault? It's my first Teensy & audio board. Has anyone ever heard this noise from these components.
Example of failure - NOTE this is mp3 is clipped as the Teensy is powered on & off so keep your sound levels low or ask me to edit that out, it happens twice in this example. One button was pressed until it failed (the 'Fox call' is the foreground sound). This was using a second version of the Schmitt trigger on a breadboard.
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/Failing-sound.mp3
Shortened WAV files (49MB)
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/SD Card.zip
Debounce layout (breadboard & schematic).https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/hardware debounce_bb.jpg
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/hardware debounce_schem.jpg
SD Card read test results.
https://dl.dropboxusercontent.com/u... issue/SD Card tests/SD2-8GBTranscend-C10.png
https://dl.dropboxusercontent.com/u...d issue/SD Card tests/SD1-8GB-Kingston-C4.png
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/SD Card tests/Kingston-8GB-C10.png
The source is also at…
https://dl.dropboxusercontent.com/u...-forum-version/Buttonbox-v2-forum-version.ino
Apologies for the long post & thanks for getting this far
Arduino 1.6.5 with Teensyduino 1.25 installed on OS X 10.9.5 is used for programming.
The aim is to have a background sound that loops (actually two 300MB, 30 minute WAVs).
6 buttons trigger the shield to play short sounds that also set an output to activate LEDs during playback (mosfets will handle that). I'm testing with a single LED at the moment (pin 16).
The buttons are setup with hardware debouncing (via inverting Schmitt trigger). As covered at http://www.jeremyblum.com/2011/03/07/arduino-tutorial-10-interrupts-and-hardware-debouncing/
I'm using interrupts for handling the inputs.
At the moment the audio keeps failing to work correctly - the sound randomly plays a 'tone' straight after a button press & the teensy needs to be powered off to stop it. The background sound ceases playback too, it will reboot via USB. There is a brief burst of 'white noise' before the failure.
It seems to be less of an issue if I turn down the volume, however I can't see anything wrong with my source WAV's they appear to be encoded fine without signs of clipping.
Tried so far...
- I tried to use different switches with software debouncing the the same issue appeared.
- Converting WAVs & trying different naming on the SD card, the issue has appeared with the SDTEST files that are linked on PJRC.com
- Formatting SD as FAT 32 (on OS X) and FAT 16 (on Linux).
- Tried 3 SD cards, a class 4 & two class 10 cards (SD card test results in ZIP file).
- Powered via USB from Mac
- Powered via LM317 supply, run from a 12V DC mains supply.
- Disabling serial output has no effect.
- Line out & headphones from the audio board have the issue - I'm monitoring sound via iPod headphones or a 4 ohm unpowered 0.5W speaker (is this too much for the output?).
- Tried using individual AudioPlaySdWav objects for each WAV.
I saw a mention of the audio library version as a possible issue in another thread here, I have the 'built in' 1.2.0 installed and 1.25 of the Teensyduino library, could that be an issue? Please point me to sources if that needs to be updated. It's a little unclear to me which pieces are from Arduino & which are from Teensyduino libraries.
I have a Sandisk Ultra SD Card on order & will test again when it arrives.
What can I do to debug this? Does it seem like a possible hardware fault? It's my first Teensy & audio board. Has anyone ever heard this noise from these components.
Example of failure - NOTE this is mp3 is clipped as the Teensy is powered on & off so keep your sound levels low or ask me to edit that out, it happens twice in this example. One button was pressed until it failed (the 'Fox call' is the foreground sound). This was using a second version of the Schmitt trigger on a breadboard.
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/Failing-sound.mp3
Shortened WAV files (49MB)
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/SD Card.zip
Debounce layout (breadboard & schematic).https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/hardware debounce_bb.jpg
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/hardware debounce_schem.jpg
SD Card read test results.
https://dl.dropboxusercontent.com/u... issue/SD Card tests/SD2-8GBTranscend-C10.png
https://dl.dropboxusercontent.com/u...d issue/SD Card tests/SD1-8GB-Kingston-C4.png
https://dl.dropboxusercontent.com/u/59660/Audioboard sound issue/SD Card tests/Kingston-8GB-C10.png
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav playSdWav1; // background sound
AudioPlaySdWav playSdWav2; // foreground sound
AudioMixer4 mixer1;
AudioOutputI2S audioOutput;
AudioConnection patchCord1(playSdWav1, 0, mixer1, 0);
AudioConnection patchCord2(playSdWav1, 1, mixer1, 1);
AudioConnection patchCord3(playSdWav2, 0, mixer1, 2);
AudioConnection patchCord4(playSdWav2, 1, mixer1, 3);
AudioConnection patchCord5(mixer1, 0, audioOutput, 0);
AudioConnection patchCord6(mixer1, 0, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1;
// audio adaptor board pins
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
// INPUTS - hardware debounced
#define BUTTON1 0
#define BUTTON2 1
#define BUTTON3 2
#define BLINKY 13 // onboard LED for status
#define LED1 16
#define LED2 17
#define LED3 20
void setup() {
// OUTPUT for LEDs
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(BLINKY, OUTPUT);
// INPUT Buttons
pinMode(BUTTON1, INPUT);
pinMode(BUTTON2, INPUT);
pinMode(BUTTON3, INPUT);
// Interrupts
attachInterrupt(BUTTON1, play1, RISING);
attachInterrupt(BUTTON2, play2, RISING);
attachInterrupt(BUTTON3, play3, RISING);
//Serial.begin(9600);
AudioMemory(8);
sgtl5000_1.enable(); // turn on the output
sgtl5000_1.volume(0.3);
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");
// LED feedback for SD failure without serial
digitalWrite(BLINKY, LOW);
delay(100);
digitalWrite(BLINKY, HIGH);
delay(1000);
}
}
}
// Avoid playing when a file is already running
void playfile(const char *filename) {
if (! playSdWav2.isPlaying()) {
playSdWav2.play(filename);
delay(5);
}
}
void play1() {
playfile("FOXB.WAV");
}
void play2() {
playfile("HHOGB.WAV");
}
void play3() {
playfile("OWLB.WAV");
}
void playbackground() {
if (!playSdWav1.isPlaying()) {
playSdWav1.play("/short/BG01.WAV");
delay(10);
}
}
void loop() {
playbackground();
while (playSdWav2.isPlaying()) {
digitalWrite(LED1, HIGH);
//Serial.println("Playing...");
}
digitalWrite(LED1, LOW);
}
The source is also at…
https://dl.dropboxusercontent.com/u...-forum-version/Buttonbox-v2-forum-version.ino
Apologies for the long post & thanks for getting this far