4 ms·
Yes, if it sounds ok, it's probably ok. But nevertheless, let me annoy everyone with a few technical details: Directly connected audio on the Raspberry PI is t
by cnvogel 13y ago
Yes, if it sounds ok, it's probably ok. But nevertheless, let me annoy everyone with a few technical details:
Directly connected audio on the Raspberry PI is through a PWM output and connected low-pass filter. It's implemented as a 10-bit timer (or so...) that overflows at the audio sample rate (e.g. 48kHz), and the control value for the PWM are the audio samples that are fed to the PWM block via DMA.
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM283... (page 138)
http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2_027.pdf http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspbe... (page 2, lower right)
Basially this means that...
1. audio sample rate is limited to 48kHz because of the sample-rate/number-of-bits tradeoff (it is not a real problem at all, but looks weak in a "audio DAC" comparison)
2. dynamic range is limited to 60dB, around the quality of cassette tapes because we only have 10 PWM bits
3. the PWM signal (square-waves) will have many high-order harmonics which are not filtered well by the simple RC lowpass. Some of it might be mixed back into the audible range by nonlinearities in your amplifier or your loudspeakers, or at least waste power and unnecessarily heat up your amplifier. Especially with Class-D (?) switched amplifiers this might be audible.
- harrytuttle 13y agoOk that is pants then :) thanks for the technical information.
- supergauntlet 13y agoSo the Pi's DAC is 10 bit? Am I understanding this correctly?
- cnvogel 13y agoI've checked the output with a scope: It's indeed a PWM signal, but not the canonical PWM with fixed frequency and varying duty-cycle but something more sophisticated. PWM nevertheless, probably there's some shaping being done by the Videocore-Code (through which the audio data is routed). I've tested the output with a sound-card (M-Audio Delta 44, via a Yamaha MV12/4 Mixing console as preamp) that has (at the test-settings) a noise-floor of ~-130dB/Hz. If I let the raspberry-pi play a sine-wave, I get harmonics at ~60-66dB down from full-scale. I suspect that this is unshaped quantization noise, so this would compare the suspicion that the PWM resolution is 11 or 12 bit. Here's a screenshot of a frequency analyzer plugin running while recording the audio output of the RPI, for comparison I put in the same sine being played by the 16bit DAC of my mobile phone, here the harmonics are down -90dB or more. https://picasaweb.google.com/lh/photo/fWlV5aan-94e9GOpXJaLm9MTjNZETYmyPJy0liipFm0 https://picasaweb.google.com/lh/photo/fWlV5aan-94e9GOpXJaLm9... Sinewave has been generated with the command $ sox -n -t wav - synth 60 sine 1013.0 | aplay on the raspberry pi.