20
\$\begingroup\$

Mystical DAC signal

The story for this signal is the following. I've bought an NAD C 356BEE amplifier with an integrated MDC DAC module. It has optical and USB input. The optical is OK, but if I connect the DAC to my PC with USB, then it makes clicking/popping noise at specified times. The click frequency is somehow related to the signal sample rate. For example at 96 kHz it pops in every 2.5 seconds, but at 48 kHz it pops at 30 seconds.

I've played a sine wave, and I've recorded the noise and zoomed in to the waveform. It's a very short signal, about 0.008 seconds. Do you have any idea what it could be?

The amplitude of the noise signal is much higher than the test signal. The length of the noise signal is random (but very short, you hear just a click), but the waveform is always the same for the same test signal.

Different test frequencies cause different error signals. It seems like the error signal is some transformation of the original.

Enter image description here

\$\endgroup\$
  • 2
    \$\begingroup\$ Almost looks like a 2's complement part is being fed non 2's complement data, or vice versa. \$\endgroup\$ – Matt Young Mar 3 '13 at 0:15
  • 1
    \$\begingroup\$ Wow that is crazy symetry, same upside down and backwards... \$\endgroup\$ – Grady Player Mar 3 '13 at 0:17
  • \$\begingroup\$ @matt young or wrong byte order \$\endgroup\$ – Grady Player Mar 3 '13 at 0:17
30
\$\begingroup\$

That looks like a sine wave with the y-axis wrapped around. Here's my attempt at recreating it:

wrapped sine wave

This is a plot of the function \$1.25 \cdot \sin(t) - \operatorname{round}(1.25 \cdot \sin(t))\$, where \$\operatorname{round}(x)\$ rounds \$x\$ to the nearest integer.

Perhaps the highest bit of your signal is getting cut off? That would seem likely to produce such a waveform.

\$\endgroup\$
  • \$\begingroup\$ WOW, you are great. I've noticed that shape of the error signal is related to the test signal and I tested with an effected Sine when I got above waveforms. \$\endgroup\$ – csadam Mar 3 '13 at 2:00
  • 3
    \$\begingroup\$ This is exactly the answer. I generated this exact signal while trying to generate a sine wave with a Digital-to-Analog converter connected to a microcontoller. This happened by accidentally entering in values larger than the max value of the converter resulting in a wrap-around of sorts as you see in the above wave. \$\endgroup\$ – Lightyear Buzz Mar 3 '13 at 7:56
8
\$\begingroup\$

I have in fact seen that before. I was working on an ADSP-21xx processor. The audio CODEC put the incoming data in signed 2's complement format. That particular day I was sending the data to a multi channel Maxim DAC that was expecting unsigned binary. Everybody around had a laugh at the Batman ears, then I added a few lines of code to get back to unsigned binary.

To fix it, we're going to need a lot more information. It looks like there might be some overflow issues.

\$\endgroup\$
  • \$\begingroup\$ I try it with different controlled signals like generated sine waves to see what it does. Do you have idea about the occurrency time-sample rate relation? maybe it has some internal buffer that overflows then resets itself? \$\endgroup\$ – csadam Mar 3 '13 at 1:04
  • \$\begingroup\$ Can you try a couple other sampling rates? \$\endgroup\$ – Matt Young Mar 3 '13 at 1:14
  • \$\begingroup\$ changing the sampling rate does not change the waveform, however the test signal frequency or waveform does. I had great luck that I got that sharp signal, other frequencies are much more distorted. \$\endgroup\$ – csadam Mar 3 '13 at 2:11
  • \$\begingroup\$ on 96kHz, 72kHz, 60kHz, 30kHz, 15kHz always 2.5 seconds. Somtimes it "misses" some pops then the later ones are not start at the next 2.5second raster but randomly. However between 2 clicks it is always 2.5 secs are the shortest time. \$\endgroup\$ – csadam Mar 3 '13 at 2:21
7
\$\begingroup\$

This is very interesting. I decided to take a look at the concept of losing the most significant bit of a sine wave sequence. I did it for a half cycle of a sine wave and it does indeed lead to the wave shape in the original poster's question.

enter image description here

The spreadsheet I created steps the argument for the sin() function from 0.00 to 3.14. It then scales the range of the sine result to be scaled over the range from 0 to 255 to correspond to a byte value range. Finally the upper bit of the byte value range were trimmed off.

The spreadsheet used to create the picture is available as an Excel .xlsx file from here: https://docs.google.com/file/d/0BxTbL_E1KhGvbTYtY1k1WTNxT1U/edit?usp=sharing

\$\endgroup\$
  • \$\begingroup\$ You certainly get a similar-looking wave, but I think you'll find that if you extend this over the entire wave you get a half cycle that's all positive, and one that's all negative, which is not the same as the OP's wave. \$\endgroup\$ – gwideman Mar 3 '13 at 11:30
  • \$\begingroup\$ @gwideman - Not if you're missing the MSB-1 bit, and your data is 2's complement! \$\endgroup\$ – Connor Wolf Mar 5 '13 at 6:06
2
\$\begingroup\$

Clues so far: 1. Problem waveform looks like sine with high bit(s) reverse polarity or at least causing a shift to a different baseline. 2. Problem waveform looks like the waveform under test, but with the noted transformation. 3. Periodicity of the problem is quite long (seconds) and seems to vary with sampling rate.

I'm going to suggest that there's a buffer over-run somewhere in the system, whereby at some interval that's affected by sample rate, bytes get lost, causing the number boundaries to be off. Eg: for 16 bit numbers, the D/A is expecting H1 L1 but is instead receiving L1 H2, or similar. (Similar to Grady's suggestion). So the signal has features reminiscent of the intended signal, but of course distorted by the wrong bytes in the wrong places.

csadam hasn't mentioned how the USB signal is generated by the PC, but that would perhaps be interesting.

\$\endgroup\$

protected by W5VO Mar 6 '13 at 15:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.