Audio library, I2S DAC oversampling?

Status
Not open for further replies.

PaulS

Well-known member
Just checking here if these measured numbers are as expected:

Code:
Teensy 3.2,    PCM5102A, LRCK =  44.1 kHz, BCK = 2.8224 MHz [64.LRCK], MCLK = 11.29 MHz, "AudioOutputI2S           i2s1;"
Teensy 3.2,    UDA1334,  LRCK =  44.1 kHz, BCK = 2.8224 MHz [64.LRCK], MCLK = 11.29 MHz, "AudioOutputI2S           i2s1;"
Teensy 3.2,    PT8211,   LRCK = 176.4 kHz, BCK = 5.6469 MHz [32.LRCK], MCLK = 11.29 MHz, "AudioOutputPT8211        pt8211_1;"

Teensy 4.0,    PCM5102A, LRCK =  44.1 kHz, BCK = 2.8224 MHz [64.LRCK], MCLK = 11.29 MHz, "AudioOutputI2S           i2s1;"
Teensy 4.0,    UDA1334,  LRCK =  44.1 kHz, BCK = 2.8224 MHz [64.LRCK], MCLK = 11.29 MHz, "AudioOutputI2S           i2s1;"
Teensy 4.0,    PT8211,   LRCK = 176.4 kHz, BCK = 5.6469 MHz [32.LRCK], no MCLK,          "AudioOutputPT8211        pt8211_1;"

Using FrankB's recently updated code for Teensy LC:

Code:
Teensy LC,    PCM5102A,  LRCK = 44.1 kHz,  BCK = 1.4117 MHz [32.LRCK], no MCLK, "AudioOutputI2S           i2s1;"
Teensy LC,    UDA1334,   LRCK = 44.1 kHz,  BCK = 1.4117 MHz [32.LRCK], no MCLK, "AudioOutputI2S           i2s1;"
Teensy LC,    PT8211,    LRCK = 44.1 kHz,  BCK = 1.4117 MHz [32.LRCK], no MCLK, "AudioOutputPT8211        pt8211_1;"


So only the PT8211 is doing 4x oversampling with a Teensy 3.2/4.0?
And is it correct that PT8211 and T4.0 does not have MCLK?

Using Arduino 1.8.13, Teensyduino 1.53, modified output_i2s & output_pt8211 to support TLC.

Thanks,
Paul
 
Yup, that looks right.

Not sure why we're turning on MCLK with PT8211 on Teensy 3.2. Maybe just leftover code from I2S?
 
RE: Oversampling: I see no reason why it should not work with other Chips, too.
But it would need even more switches or output-objects... so ... maybe it's better to just keep it simple?!?

If we want to clean these things - well the whole PT8211 code can be integrated into the I2S code.
The PT8211 has one single flag different ("Frame sync early").

But then we need *simple* way to switch it on or off. Same for oversampling with other chips.The SGTL can handle it, too.
 
For simplicity, I wouldn't mind standardizing on LRCK = 44.1 kHz, BCK = 1.4117 MHz [32.LRCK] and MCLK = 11.29 MHz for all I2S DAC's [but maybe this is too short-sighted].
I checked on the scope what the output spectra are for the different LRCK's/BCK's for the PT8211 and the PCM5102. Output signal 1kHz sine.

PT8211, Teensy 3.2, LRCK: 176.4, BCK: 32*LRCK:
SDS00020.png

PT8211, Teensy LC, LRCK: 44.1, BCK: 32*LRCK:
SDS00021.png

PCM5102, Teensy 3.2, LRCK: 44.1, BCK: 64*LRCK:
SDS00023.png

PCM5102, Teensy LC, LRCK: 44.1, BCK: 32*LRCK:
SDS00022.png

The PT8211 seems to have some advantage of the 4x oversampling, but it's minor.
The PCM5102 does have 8x internal oversampling at LRCK 44.1 kHz [TI calls it 8x interpolation filter]. The UDA1334 also has an internal interpolation filter. The PT8211 does not. I'm not sure about the SGTL5000.

Is there an advantage of 64*LRCK versus 32*LRCK?

By the way, don't rely too much on the absolute figures of the above FFT's. My rather cheap Siglent scope is known to be not very accurate for FFT's due to the non-linearity of the internal amplifiers, as admitted by Siglent in an email conversation I had with them [but hey, for the money it's doing pretty well].

Regards,
Paul
 
Many of the I2S DACs do this oversampling in their hardware.
I would actually say that pretty much ALL current high quality sigma-delta audio DACs have oversampling built-in with multistage decimator and FIR filters that have quality way above what is offered by library and zero computational overhead from uC side.
I don't see any reason to use oversampling except PT8211 that simply has no reconstruction filters at all. By the way in my measurements PT8211
output is actually much worse than Teensy 4's MQS (Medium Quality Sound) with regards to distortion and S/N ratio.

I don't know but to me it seems like your Siglent scope is super noisy / non-linear or you are overdriving it (suggested by harmonics in the spectrum). On my end PCM5102 is super quiet (S/N+D > 98dB)
 
I don't know but to me it seems like your Siglent scope is super noisy / non-linear or you are overdriving it (suggested by harmonics in the spectrum). On my end PCM5102 is super quiet (S/N+D > 98dB)
Yes, my Siglent 1202X-E has issues in that area. That's what I emailed them about.
I'm expecting that when I keep the signal within screen limits, I'm not overdriving it. But the pictures below tell a different story... The user manual does not mention anything about vertical sensitivity related to FFT.
Here are 2 sets of screenshots at 1V/div and 2V/div vertically.

At 1V/div:
SDS00033.png SDS00032.png

At 2V/div:
SDS00031.png SDS00030.png

Just curious: what kind of scope/spectrum analyzer are you using at your end?

Paul
 
I am using studio grade ADC AK5394A (123dB SNR/ 123dB DR) with Visual Analyser. With regards to your results, your power supply may be the culprit too. Disconnect USB and try running from some high quality low noise power supply or batteries. USB power is noisy.
 
Most 'scope front-ends aren't linear enough for any kind of audio quality measurement work! They are designed for a large bandwidth with constant group-delay,
and are typically 8-bit so only have 50dB of dynamic range to start with. 100dB is more like the dynamic range you need, as well as low distortion front-end.

FFT (aka dynamic signal) analyzers are the tool designed for the job. Good soundcards can act as a substitute for some measurements, but typically
aren't calibrated.
 
Good soundcards can act as a substitute for some measurements, but typically aren't calibrated.
Yes, using a Scarlett 2i2 USB audio interface, sampling at 24 bit/96 kHz and the data fed into TrueRTA, shows more realistic values than the scope:

TrueRTA.jpg

Sure, not calibrated though...

Paul
 
Now do the same with PT8211 and you will see how bad it really is. I would say it is no better than '80s compact cassette.
 
Exactly, noise floor approx -58dB that is less than 10 bits. Good cassette decks in '80s were able to get >70dB.
 
Let me say it again, FFT plots of signal spectrum are not useful for measuring noise floor, you need a PSD plot for that.
Noise is measured in W/Hz, or V/√Hz, and an FFT bin is typically not exactly 1Hz wide...
 
SNR is measured in dB. And it was observation / comment / remark (hence "approx" word), not measurement. PT8211 is so bad, not only with regards to noise but mainly to distortion that I wonder why would anyone use it. Teensy 4 MQS output is actually better, esp with regards to distortion and has zero cost (OK, except one resistor and one capacitor, because as I can see someone is into nitpicking). I2S sigma delta DACs are cheap and there is no reason to use R2R register ladder PT8211 that has no reconstruction filter, big problems with nonlinearity and noise. R2R dacs are good for upto 8 bits.
 
Last edited:
In case anyone is interested, here is a readable paper on the difference between PSD (power spectral density) and FFT, and why FFT is not suitable for noise floor measurements.

Paul
 
Last edited:
For completeness, here are the measurements on the SGTL5000/PJRC audio adapter board:

TrueRTA_SGTL5000_1kHz.jpg

and the TDA1543 [that old, non-A version in an 8DIP packaging]:

TrueRTA_TDA1543_1kHz.jpg

Disclaimer: these are all non-laboratory measurements so your mileage may vary...

Paul
 
Status
Not open for further replies.
Back
Top