Audio High pitch buzzing

There is a peak at ~344 Hz. The update() freq. is ~2.9 ms so this fits perfectly.
Sometimes i noticed the same noise when i wrote my mp3 player, but this was with the audioboard.

i wonder what i might be though. on second thought, the sd player objects wouldn't actually access the card every 2.9ms, no? one sector = 2 x sample buffer. so it's weird that 344 Hz would bleed into the DAC.
 
In the wavefile above, there is very interesting pattern:
Eactly 100 samples are ok, then exactly 28 samples with higher values. 128 byte is the size of one audiobuffer.
 

Attachments

  • Image1.png
    Image1.png
    46.4 KB · Views: 205
Last edited:
true, the other odd thing is what happens when the second file starts, which isn't even played through the DAC:


Screen Shot 2015-02-12 at 20.14.16.jpg

it then settles into a similar pattern, only now there's two of those 28 sample spikes.

edit. that said, looks to be the same thing as in cosford's scope shots in #11. it would rule out software
issues though (ie at the level of the player libraries), if i see it right. otherwise, it's not clear to me why playing a file through i2s would result in the exact same artifact as when writing the file to the DAC.
 
Last edited:
Hm, that really loks like a software-problem. Or a strange silicon-bug (dma..i2s..? maybe a race-condition ?)
Jerware, is there a chance that you upload your project and all the files we need to reproduce this ?
 
Sure. Here's a zip: http://www.ledseq.com/downloads/teensyBuzz.zip

Just touch ground to digital pins 0 & 1.

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

// GUItool: begin automatically generated code
AudioPlaySdWav soundBoard; //xy=223,156
AudioPlaySdWav soundDAC; //xy=227,482
AudioMixer4 mixer1; //xy=529,307
AudioMixer4 mixer2; //xy=724,398
AudioOutputAnalog dac1; //xy=730,605
AudioOutputI2S i2s1; //xy=899,494
AudioConnection patchCord1(soundBoard, 0, mixer1, 0);
AudioConnection patchCord2(soundBoard, 1, mixer1, 1);
AudioConnection patchCord7(soundDAC, 0, mixer2, 0);
AudioConnection patchCord8(soundDAC, 1, mixer2, 1);
AudioConnection patchCord11(mixer1, 0, i2s1, 0);
AudioConnection patchCord12(mixer1, 0, i2s1, 1);
AudioConnection patchCord9(mixer2, 0, dac1, 0);
// GUItool: end automatically generated code

// Create an object to control the audio shield.
AudioControlSGTL5000 audioShield;

// Bounce objects to read pushbuttons
Bounce button1 = Bounce(0, 10); // 5 ms debounce time
Bounce button2 = Bounce(1, 10);

void setup() {

// Configure the pushbutton pins for pullups.
// Each button should connect from the pin to GND.
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);

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

// turn on the output
audioShield.enable();
audioShield.volume(1);
delay(1000);

// by default the Teensy 3.1 DAC uses 3.3Vp-p output
// if your 3.3V power has noise, switching to the
// internal 1.2V reference can give you a clean signal
//dac.analogReference(INTERNAL);

// reduce the gain on mixer channels, so more than 1
// sound can play simultaneously without clipping
float gainLevel = 0;
mixer1.gain(0, gainLevel);
mixer1.gain(1, gainLevel);
mixer2.gain(0, gainLevel);
mixer2.gain(1, gainLevel);

SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}

// Store the button states
button1.update();
button2.update();
}

void loop() {
// Update all the button objects
button1.update();
button2.update();

// When the buttons are pressed, just start a sound playing.
// The audio library will play each sound through the mixers
// so combinations of banks can play simultaneously.

// main buttons
if (button1.fallingEdge()) {
soundBoard.play("silence1.wav");
Serial.println("Playing silence1.wav");
}
if (button2.fallingEdge()) {
soundDAC.play("silence2.wav");
Serial.println("silence2.wav");
}

// volume control
// float vol = analogRead(15);
// vol = vol / 1024;
// audioShield.volume(vol);
}
 
I'm glad I wasn't just going insane. The fact I hadn't found this reported anywhere else had convinced me that it was an application hardware issue.

Following this closely but don't have the hardware in front of me to assist (at least not this evening).
 
Hm, ok,
i tried your sketch.
It was the first time i connected anything to the DAC.

The good news: I can reproduce this. It is very quiet, almost not noticable with the speaker at room volume.
The bad news: I don't think it's a software problem.

I can hear similar noise (and a bit louder!) when I flash a program.
I believe it is " crosstalk " (i hope my translation is correct :) , perhaps in the chip or on the board.

Edit:
http://en.wikipedia.org/wiki/Crosstalk_(electronics)
 
Last edited:
Hm, ok,
i tried your sketch.
It was the first time i connected anything to the DAC.

The good news: I can reproduce this. It is very quiet, almost not noticable with the spaker at room volume.
The bad news: I don't think it's a software problem.

I can hear similar noise (and a bit louder!) when I flash a program.
I believe it is " cross-talk " (i hope my translation is correct :) , perhaps in the chip or on the board.

Thank you for testing it and confirming the problem. I agree it is soft, but my use case is perhaps unique. I am running the DAC to a third speaker, in addition to the audio board L/R channels, to a spot closer to the listener. Its volume will be turned up rather high, and the buzz will be most apparent when nothing plays though the DAC but audio does play through the other speakers. Well, if it is a hardware issue than perhaps that is the closure we get. I would love to know what Paul thinks once he comes down from orbit updating Teensyduino and getting LC launched.
 
I think cross-talk is the right word (or one right word). If it's periodic and consistent, maybe it would be possible to record a sample of the introduced noise without other audio and cancel out the noise by subtracting the sample from the normal audio. We'd need a way to synchronize and loop the sample. Perhaps at startup, the Teensy could record a moment of silence of length equal to the period of the noise, then loop the negative of that sample.
 
I meant the amplifier.
The DAC can not meet any audiophile claims. It's not built for that.
Maybe it's possible to pull down the DAC with a second pin (?), or maybe it's sufficiant to switch it off. There must be a bit for this somewhere :) You can switch off all Tensy devices
 
mmh, at 345 Hz it doesn't seem like it's something easily filtered out.

i'm wondering what the source might be? the bursts are a little over 600 us, it seems; track the audio engine (somehow), but they're absent when playing from flash.

i guess i'm saying i couldn't guess what happens in the one case that doesn't also happen in the other, except for SPI/SD; but then that wouldn't occur every 2.9ms, right?
 
Last edited:
Jerware:

looking at your sketch again, i see you had put in the line: dac.analogReference(INTERNAL); but it's commented out.

so i assume you have tried? i assume it makes no difference?
 
Not sure if this helps, but I've managed to make a very similar problem go away (same noise frequency when reading from SD).

When I initially connected the audio board to the teensy, I only connected the 'signals to teensy' shown here: https://www.pjrc.com/store/teensy3_audio.html , which gave the ~344Hz noise.

I've just connected every connection (piggybacked the board onto the teensy) and the sound has disappeared completely.... (it sounds superb :) )

Hope this helps...
 
Just posting here to say I've had this same constant volume 344hz noise when using the audio adapter, but only when powering the Teensy from the Vin pin. All pins are soldered through to the Teensy board itself as the above post mentions so that one didn't work for me. But powering it via the 5V provided through the micro USB connector did not have the noise whatsoever, so I've simply modified my current project to source its power via the red wire in a USB cable plugged into the micro USB connector. Hope it might helps, or give a clue as to what the issue might really be caused by.
 
344 Hz noise is almost certainly a "ground loop" problem.

When running the audio library, the Teensy CPU does quite a lot more work (draws more current) 344 times per second.
 
dxinteractive: Does it change anything to compile 'Tools / NO USB' if you use a full USB cable?

Didn't know that was an option, I'll give it a try.

344 Hz noise is almost certainly a "ground loop" problem.

When running the audio library, the Teensy CPU does quite a lot more work (draws more current) 344 times per second.

I'm pretty sure I remember this happening while running from a battery, from a phone as a source of audio, to headphones! That said I don't think I bothered putting a cap across the power rails or anything to try and actually fix it. I'll give this a bit of a test with some recordings in the next couple of days to actually be a bit thorough about it and work out what's going on.
 
Did anyone find a solution to this problem?

I am getting the same 344 Hz noise on the line out.

I did solve it actually, sorry I forgot to reply. Paul was right, it was entirely a grounding thing. In my case I solved the issue by making sure I was using the ground connections on the audio board to connect to the ground connection on line in / line out jacks, and all other ground went via the regular GND connection on the Teensy (except for analog input ground which are smoother if you use AGND to ground them). In all my swapping of breadboard wires I didn't even realise I crossed those two grounds over at some point.

In my case, before it was fixed it would even make the 344Hz noise using batteries and a battery powered speaker - there was no connection to mains power or ground loops coming up through mains but of course that wasn't even the issue.
 
Thanks dxinteractive! I also managed to solve the problem.

In my case I was using the same power supply to power my Teensy (+Audio Board) and the amplifier. This (apparently) created some kind of ground-loop or other ground-related issue. I even tried disconnecting the ground wire from the line out, but with no luck. I guess the common ground (originating from the power supply) actually makes a star-ground at the point of the power supply?

The 344 Hz noise disappears when using two separate power supplies, which makes only one ground connection between the Teensy Audio Board and the amplifier (at the line out). This solution works for know, but I am going to try using an isolated DC-DC converter to feed the Teensy Vin from my amp power supply. I may also try the audio transformer.

I wonder if the Teensy Audio Board design can be improved to counter-act grounding issues. Perhaps a ground plane for audio-ground, which is separated from power ground with a 150ohm resistor and some decoupling caps? Something like this: https://e2e.ti.com/resized-image/__...discussions-components-files/791/sgtl5000.png
 
I had the buzzing sound on headphones too after wiring everything together on the breadboard.
My setup added another SPI device in addition to the audio board by directly translating the 3.3v signals to 5v signals using a 74hct125 (quad buffer ic).
I noticed two things:
-) The buzzing was less noticeable as soon as a decoupling capacitor was added to the quad buffer ic vcc pin
-) The buzzing was not noticeable at all when clock output of the buffer was disabled while the audio library accessed the sd card

It looks like pin 14 (CLK) is very sensitive to extra loads, even if these are cmos inputs.
Im not quite sure why this is happening, but in my case, connecting the buffers clock output enable with chip select solved the problem.
 
Last edited:
Back
Top