Artifacts heard while playing computer audio through teensy

tejas

Member
Hello!

I’m using teensy as a simple audio output device for my computer. It works fine. However, after every few seconds I hear an artifact which sounds like a scratched CD (compact disk). I’m not sure of the cause.

Any ideas to fix it? I can share code/audio if needed.

Thanks in advance!
Tejas
 
There is no nearby phone nor is there an SD card on Teensy. The artifact sounds like a glitch. Let me share a recording.
 
This sounds like audio sync issue when host sampling freq is not exactly the same as device sampling freq, causing overrun/underrun so every now and then one sample is added/dropped by USB audio code path.
 
That makes logical sense to me. However, the sampling rate is 44.1kHz at both ends. Do you mean that there might be a slight difference even then?

It reminds me of an experiment that I did once when I played a sine of 440 Hz on two computers, and there were audible interference beats (though with very low beat frequency).
 
Yes but even crystal clocks aren't perfect. Even if there is 0.01% variation over time it will accumulate. The "proper" way to handle this is asynchronous USB audio that makes host to sync with device, but I don't know if Teensy implements that at all.
 
I get it. Is there a practical way to avoid the artifact though? Why do USB speakers in general not have this problem? (Teensy is acting like a USB interface here.)
 
That depends on device implementation. It might work in asynchronous mode, it might adjust its DAC clock to host, it might implement resampling. It is generally easier for output device to adapt.
 
You could take a look at (the later pages of) this thread. Unfortunately it’s a bit hard to install as it stands, and previously suffered from a bunch of people who offered to help or did development, then didn’t follow through. However, the new champion @alex6679 seems much more tenacious, and continues to fix any bugs found, time permitting. (I contributed in a minor way, but he does the tricky stuff!)

Although billed as for more than two channels, you can just use it for stereo, and the host/device sync code is way better than before, though looking at recent posts there are still corner cases which aren’t quite right.
 
You could take a look at (the later pages of) this thread. Unfortunately it’s a bit hard to install as it stands, and previously suffered from a bunch of people who offered to help or did development, then didn’t follow through. However, the new champion @alex6679 seems much more tenacious, and continues to fix any bugs found, time permitting. (I contributed in a minor way, but he does the tricky stuff!)

Although billed as for more than two channels, you can just use it for stereo, and the host/device sync code is way better than before, though looking at recent posts there are still corner cases which aren’t quite right.
Thanks for the directing me to that thread! I glanced through it and realized that the issue is somewhat beyond my bandwidth at this point.
 
Back
Top