Hi All,
I am working on an audio project creating generative music from 16 interactive sculptures. I have successful playback from the audio tool synth, and from wavetable samples on all devices. I would also like to have longer WAVs play back from an SD-Card. On 6 sculptures the SD-Card playback is fine, no distortion. On the remaining 10 I have distortion from both the audio SD reader, AND the Teensy SD reader. The headphone jack sounds fine, no distortion. I have a variety of other elements connected (Ultrasonic sensor, 2 mono mics with preamps, Neopixels or other LED strips), but have disabled them for troubleshooting.
I've swapped out power supplies, makes no difference.
The original WAVs sound fine on the computer and , so should not be the problem. I have tried multiple SD cards--all sound good on the good sculptures, all sound distorted on the bad sculptures. I have checked throughly for solder blobs and have resoldered any potential cold joints. Flumoxed! My code below (with LED, sensor, and mic code removed):
Any ideas on this?
I am working on an audio project creating generative music from 16 interactive sculptures. I have successful playback from the audio tool synth, and from wavetable samples on all devices. I would also like to have longer WAVs play back from an SD-Card. On 6 sculptures the SD-Card playback is fine, no distortion. On the remaining 10 I have distortion from both the audio SD reader, AND the Teensy SD reader. The headphone jack sounds fine, no distortion. I have a variety of other elements connected (Ultrasonic sensor, 2 mono mics with preamps, Neopixels or other LED strips), but have disabled them for troubleshooting.
I've swapped out power supplies, makes no difference.
The original WAVs sound fine on the computer and , so should not be the problem. I have tried multiple SD cards--all sound good on the good sculptures, all sound distorted on the bad sculptures. I have checked throughly for solder blobs and have resoldered any potential cold joints. Flumoxed! My code below (with LED, sensor, and mic code removed):
Any ideas on this?
Code:
//tones only
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playWav1; //xy=402,328
AudioOutputI2S i2s1; //xy=754,271
AudioConnection patchCord1(playWav1, 0, i2s1, 0);
AudioControlSGTL5000 sgtl5000_1; //xy=383,515
// GUItool: end automatically generated code
void setup() {
Serial.begin(9600);
delay(1000);
AudioMemory(8);
sgtl5000_1.enable();
sgtl5000_1.volume(0.9);
if (!SD.begin(BUILTIN_SDCARD)) {
Serial.println("SD card failed or not present!");
while (1);
}
Serial.println("SD card initialized.");
}
void loop() {
if (!playWav1.isPlaying()) {
delay(100); // debounce
// Randomly select file 01.wav to 07.wav
int fileNum = random(1, 7);
char filename[10];
snprintf(filename, sizeof(filename), "%02d.wav", fileNum);
Serial.print("Playing ");
Serial.println(filename);
playWav1.play(filename);
delay(10); // allow buffer to start
}
}