Harsh distortion on SD-Card playback on Teensy 4.1+audio shield

popjones

Member
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?

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
  }
}

Front.jpg
back.jpg
 
Most of the solder joints I can see have too much solder (they should all be concave, not convex) and show signs of too little flux (rough surface, tails sticking up). I suspect more solder joint problems than you've re-worked. Suggest you redo them all after a bit more practice soldering - found this visual guide to help:
One key thing is to clean and re-tin the iron's bit regularly to remove all the oxide and burnt flux that builds up. Using too much solder can hide a dry joint. I think you'll need a desoldering tool or solder-wick, and a good hand-lens for close-up inspection. Ensure your iron temperature is correct for the solder you are using - this is where practicing can help figure this out (temperature depends also on the type of solder bit, and the amount of heat absorbed by the devices you are soldering (multi-layer PCBs can take more heat). Some old scrap PCBs are ideal for practice.

A good joint should take about 2--3 seconds - taking longer could indicate the iron isn't hot enough and mean unreliable wetting of the surfaces.

Make sure your solder is a eutectic. This means for lead-free solder that its SAC (tin-silver-copper) with about 4% silver - the other sorts are awful for hand soldering and difficult to re-work.
 
Thank you Mark for your insights. I will do some close up inspection. Does it sound like poor soldering is the problem? The audio is fine through the headphones on every unit.
 
Well we know its a problem with the individual circuits, so it should be due to something that varies between them. I'd suggest first sort out the soldering to eliminate it (or implicate it).
 
Back
Top