WAV file stops abruptly with static, and a tone

Status
Not open for further replies.

aeiche

Member
(I'm not sure if this is poor form - this is a crosspost from over in the audio board. No one responded over a couple of days so I thought I'd try here)

I am working on a project that plays audio with the Teensy Audio shield. Using the included WavFilePlayer example, I can successfully play my wav file with a Teensy 3.2 connected directly to the audio shield.

As part of my project, I am connecting the Teensy and the Audio shield with a breadboard - specifically the Adafruit Proto 1/2-Sized Breadboard. If you're unfamiliar, this is a protoboard that mimics a prototyping breadboard layout. I have the Audio Shield and the Teensy offset from each other such that the signals are carried to the appropriate pins.

When I use my board between the two, the audio will play briefly as expected, but then loud, sharp static is heard, and then a loud tone. This does not happen reliably at any given point in the audio file, and I suspect it to be a hardware issue, but the board is very simple. I have probed various points and lines around the board and not found any unexpected shorts. The only non-ground and non-power pin that's soldered is Pin2, intended for LEDs in the near future.

I have experienced the same behavior with the tutorial audio files (specifically SDTEST2.WAV)

Here is a video showing the behavior (apologies for the low volume, and the Coke cans were a quick mount for my phone :D ):

Here are pictures of the board:
The Top:
top.jpg

The Bottom:
bottom.jpg

The screw terminals are at odd angles because their pitch isn't quite 2.54mm.

Here is the code that I'm using:
Code:
// Simple WAV file player example
//
// Three types of output may be used, by configuring the code below.
//
//   1: Digital I2S - Normally used with the audio shield:
//         http://www.pjrc.com/store/teensy3_audio.html
//
//   2: Digital S/PDIF - Connect pin 22 to a S/PDIF transmitter
//         https://www.oshpark.com/shared_projects/KcDBKHta
//
//   3: Analog DAC - Connect the DAC pin to an amplified speaker
//         http://www.pjrc.com/teensy/gui/?info=AudioOutputAnalog
//
// To configure the output type, first uncomment one of the three
// output objects.  If not using the audio shield, comment out
// the sgtl5000_1 lines in setup(), so it does not wait forever
// trying to configure the SGTL5000 codec chip.
//
// The SD card may connect to different pins, depending on the
// hardware you are using.  Uncomment or configure the SD card
// pins to match your hardware.
//
// Data files to put on your SD card can be downloaded here:
//   http://www.pjrc.com/teensy/td_libs_AudioDataFiles.html
//
// This example code is in the public domain.

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

AudioPlaySdWav           playWav1;
// Use one of these 3 output types: Digital I2S, Digital S/PDIF, or Analog DAC
AudioOutputI2S           audioOutput;
//AudioOutputSPDIF       audioOutput;
//AudioOutputAnalog      audioOutput;
AudioConnection          patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection          patchCord2(playWav1, 1, audioOutput, 1);
AudioControlSGTL5000     sgtl5000_1;

// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN    10
#define SDCARD_MOSI_PIN  7
#define SDCARD_SCK_PIN   14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN    BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN  11  // not actually used
//#define SDCARD_SCK_PIN   13  // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN    4
//#define SDCARD_MOSI_PIN  11
//#define SDCARD_SCK_PIN   13

void setup() {
  Serial.begin(9600);

  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(8);

  // Comment these out if not using the audio adaptor board.
  // This may wait forever if the SDA & SCL pins lack
  // pullup resistors
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.25);

  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");
      delay(500);
    }
  }
}

void playFile(const char *filename)
{
  Serial.print("Playing file: ");
  Serial.println(filename);

  // Start playing the file.  This sketch continues to
  // run while the file plays.
  playWav1.play(filename);

  // A brief delay for the library read WAV info
  delay(5);

  // Simply wait for the file to finish playing.
  while (playWav1.isPlaying()) {
    // uncomment these lines if you audio shield
    // has the optional volume pot soldered
//    float vol = analogRead(15);
//    vol = vol / 1024;
//     sgtl5000_1.volume(vol);
  }
}


void loop() {
  playFile("teacups.wav");  // filenames are always uppercase 8.3 format
  delay(500);
//  playFile("SDTEST2.WAV");
//  delay(500);
//  playFile("SDTEST3.WAV");
//  delay(500);
//  playFile("SDTEST4.WAV");
  delay(1500);
}

Anyone have any ideas what would cause this? My first thought is some sort of floating pin, but I can't think of anything in my board that would cause that. And I can't find any place on the board that's shorted.
 
The soldering looks a bit meager. Maybe one of the SD SPI joints is a slack? Try to re-solder them and add a bit more solder.

Also, if that does not solve it, try to lower SPI speed. Having stubs (protruding PCB traces) on high speed signals is never a good idea.
 
The soldering looks a bit meager. Maybe one of the SD SPI joints is a slack? Try to re-solder them and add a bit more solder.

Also, if that does not solve it, try to lower SPI speed. Having stubs (protruding PCB traces) on high speed signals is never a good idea.


@flashburn - Interesting note about the Stub traces on easy to solder boards being bad with fast cycling signals.

… closed the prior thread with a link here to avoid confusion if it got seen : pjrc.com/threads/60648-Audio-stops-and-strong-ground-hum-takes-its-place-with-protoboard

It may be soldering - odd the one time it was playing longer - it did the stop/buzz as touched to unplug.

Thank you both for your recommendations. I went back over each hole with a fair bit more solder and am now sitting with the board between the Teensy and the shield playing just fine on it's 4th iteration. I really appreciate your insights.

Also, thanks defragster for closing the other post.
 
Status
Not open for further replies.
Back
Top