Thursday, November 11, 2021

Interchannel Subsample Delays in Commodity USB Audio Interfaces

Summary

Some USB audio interfaces suffer from left/right output channel delays which tend to be at subsample magnitude, manifesting as frequency-dependent phase distortion.

Test results

Some had interchannel delays, some did not:

Subsample Delay: Behringer UCA202 (ID 08bb:2902 Texas Instruments PCM2902 Audio Codec)


Subsample Delay: Cable Creation (ID 0d8c:0014 C-Media Electronics, Inc. Audio Adapter [Unitek Y-247A])


 ... the back is featureless black.

 

No Delay: Behringer U-Phoria UMC404HD (and 202HD) (ID 1397:0509 BEHRINGER International GmbH): 


 

No Delay: Early 2000s unbranded white USB audio dongle, UMD-10 (ID 074d:3556 Micronas GmbH Composite USB-Device):





Significance Of Delays

For users who strictly listen casually, these phase issues are negligible and possibly an enhancement. All of these interfaces were enjoyable.

For producing audio content, I don't recommend these devices- even for casual listening- as they can train the listener to prefer this phase distortion and develop a habit of expecting it in the content they produce.

The consequent phase distortion is unacceptable for pro audio for obvious reasons, and ham radio use when encoding I/Q streams, as they will introduce frequency-dependent imaging at baseband.

Discovery

James Ahlstrom's extensive write-up illustrated the issue of between-channel (left/right) sample delays in some consumer computer audio interfaces introducing phase distortion and imaging on transmission and receive when using in-phase/quadrature (I/Q) intermediate frequency in software-defined transceivers.

Especially of note was the image on the writeup labeled "Phase correction at fixed VFO for the 40 meter band" which showed a ramping of phase adjustment whose deviation increased linearly with frequency away from center (zero Hz).

In practice, compensating for phase was difficult because the offset would change between power-ups of the device. The linear nature of the phase distortion hinted that there may still be between-channel time delay despite optimal sample delay settings, pointing to the possibility that there is a sub-sample delay happening internally with these interfaces. In other words, though these devices generally max out at 48khz sample rates to the user, their internal sampling rate may be much higher, then down-sampled within the chip, possibly to introduce steeper anti-aliasing filters for better frequency response at a reduced price.

A compensatory subsample delay was achieved in GNU Radio Companion by first upsampling the stream by an arbitrarily large number (i.e. 10) with no antialiasing filters, applying the delay to said stream, applying an antialiasing lowpass followed by a decimator. This causes the delay to still manifest as frequency-dependent phase shift.

This addressed the issue very well - at least until a reboot. There was no need to apply additional phase corrections in quisk. Delays tended to be on the order of 0.5-1.5 samples.

Adjustments had to be made with each use and it's far more practical to use a proper audio interface which doesn't have these issues. I had good luck with the Behringer UMC***HD interfaces, pending frequency content is kept below 45khz, above which introduces spurs as found in this forum thread.

Test Proofs

Testing was performed by a Behringer UMC404HD. It was verified by engaging the mono switch, and routing its headphone output to inputs 1/2 and checking the sample alignment with a 20khz sine with 192khz sample rate. This means every sample output from a tested interface at 48khz would have a 4-sample-long sample as seen by the UMC404HD at 129khz:


Sine generation is with GNU Radio Companion: 


Sometimes subsample anomalies are hard to see if the offset is close to 1 sample. Then a 1-sample delay is applied:


... the remainder is then easier to see in the graphs below.

Tested items output a stereo 20khz sine (identical per channel) at 48khz sample rate, routed into channels 1/2 of the UMC404HD.

Behringer UCA202 (PCM2902 Audio Codec)

At first glance this looks like a 1-sample offset (4 oversamples), but applying the 1-sample (4-oversample) delay and trying again we still see a roughly quarter-sample misalignment (1 oversample).

Cable Creation (Unitek Y-247A) from Amazon

... 2 oversample delay, probably 0.5 samples.

Unbranded early-2000s white audio dongle "UMD-10"


... no issues, even after several plug/unplug cycles.

Compensation/Proof

A subsample delay as described above was constructed in GNU Radio Companion 3.8.10 and can be downloaded here. A pulseaudio dummy and loopback sink had to be employed to splice it into the audio or I/Q stream.


... in practice this temporarily fixed the issues well.


1 comment:

  1. This is really excellent work Chuck! I will add a link to this page from my site. It is not clear to me how a user can tell if her sound card has a delay and should be replaced.

    ReplyDelete