looking for a Digital Attenuation for I2S

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hi all,

as mentioned I am looking for an easy hardware-based possibility to attenuate a digital I2S signal. A volume decrease of around 2dB is recommended for the application.

And here is why:
Because of the fact, that todays CDs are mostly produced as loud as possible, there is a good chance to have "intersample overs" during the d/a conversion. As far as I know, the most manufacturers of DACs do not even really know what happens then to the signal exactly. For sure it will not be good. For that reason, some newer DACs have the feature to attenuate the digital signal before the conversion (e.g. Wolfson 8741. The function is called anti-clipping here).
So my idea is to do exactly the same with the digital signal before routing it to the DAC. The advantage is, one can use any DAC but gets protection against intersample-overs!
Of course it would be perfect to add the possibility to switch the attenuation off, because it will decrease the resolution of the signal a little bit.

Any ideas are very welcome.

Greets,

Martin
 
Mmm, just had some beers after work, maybe that's why i don't get it.

If a signal clips, the digital stream contains a number of samples after each other with max value. Output of the dac is max current/voltage at one end; a DC signal. After that the analog stuff which handles this in some kind of (bad) way.

So now attenuate all with 2dB. Wouldn't that be a number of samples after each other with max value minues 2dB. So still a DC signal out of the dac, just a bit less current/voltage.

I could only understand this if the signal would be going through a big DSP, which would recontruct the part of the signal which was removed by the clipping. Which is not just a minus 2dB and what is not described in the wolfson datasheet.

:confused:
 
Hi Guido,

thanks for the reply.
You do not have to worry, it is not the beers :D and with your thoughts about the reconstruction you are on the right way.

Intersample-Overs are peaks created in the DAC itself during the reconstruction of the signal. Because of the way how the interpolation works, you can have a "more than 0 dB"-signal on the output, even when the digital input is not higher than 0 dB (which is, by the way, not possible here). The problem is, that this peaks create (depending on the used DAC) more or less distortion in the analog signal, because everything above the allowed maximum will not be very linear anymore. Usually they do not exceed 1 dB over or so, but in theory they could rise up to more than 6 dB over!

As a consequence, if you give a digital signal to the the DAC with enough headroom (2 dB should be sufficient), one will never see intersample-overs. An this is the target here.

I hope this was understandable somehow. :cloud9:

Greets,

Martin
 
Last edited:
Most of the time, data is transferred in either left-justified or "true" I2S format (which is just like left-justified with an extra 0 bit thrown in before the MSb, and LRCLK inverted). That means that the most significant bit is transferred first and so on, until the least significant. This is followed by enough zero bits to make 32 bits total per channel, or 64 bits per LRCLK/WCLK cycle.

You can create a 6 dB attentuation by shifting the data one bit right, or a delay of one BCLK/SCLK cycle, but there is a complication because you need to account for the sign bit. That is, you need to duplicate the sign bit (MSb) into the new MSb position, rather than just filling with zero or delaying the entire 64 bit stream by one cycle. That makes for some complicated logic, but it has been done. I recall that someone on this forum came up with a design using some 74xx logic chips a few years ago.

If 6 dB is too much, then there is no easy way to do it I am afraid. You will need to re-calculate all new samples attenuated by the desired amount. That means DSP. You can get by with something easy (easier?) to use like the TI TAS3001, TAS3004, or TAS3103. You will need a microcontroller to configure the chip over I2C, but you don't need to write any DSP code, just program some configuration data into the thing.

I stole the attached depiction of the various serial data formats from the TI TAS3103 data sheet.
 

Attachments

  • I2S.png
    I2S.png
    39.5 KB · Views: 221
Last edited:
These are very interresting thoughts.
Unfortunately 6 dB will be a little to much for this purpose I think.

And to use a DSP for that only is overdoing for sure. If the DSP would be usable for additional functions o.k., but here...

I think I have to forget about the project. What a pitty. :sad:

Thanks a lot.

Greets,

Martin
 
Well , now Im actually thinking about this, the builtin chip attenuation wont work if its not done on the 16bit input directly. Hm . Maybe this feature has something to it afterall. I seem to remember pmd200 filterchip has 1dB attenuation engaged all the time, not to clip incoming squarewave.

Btw Once we are speaking about squarewaves , does it matter?

I have a better idea, load this track up into a wave editor, run a declipper, or draw the samples away by hand.
http://www.solid-state-logic.com/music/X-ISM/
http://recforums.prosoundweb.com/index.php/t/19731/0/

You can run this one simultaneously.
 
Last edited:
Mmm, just had some beers after work, maybe that's why i don't get it.

If a signal clips, the digital stream contains a number of samples after each other with max value. Output of the dac is max current/voltage at one end; a DC signal. After that the analog stuff which handles this in some kind of (bad) way.

So now attenuate all with 2dB. Wouldn't that be a number of samples after each other with max value minues 2dB. So still a DC signal out of the dac, just a bit less current/voltage.

I could only understand this if the signal would be going through a big DSP, which would recontruct the part of the signal which was removed by the clipping. Which is not just a minus 2dB and what is not described in the wolfson datasheet.

:confused:
The reconstruction filter does just that, and thesedays it may be done in the digital domain by the DAC. I'm not sure whether sigma-delta DACs would clip due to this, but they ARE designed so there's very little analog filtering needed on the output.
By the way this intersample over thing is a few years old now, there are even plugins designed to show if it occurs , can't imagnie they press CD's without checking for it.
It's easy enough to show - I've got Cool Edit 2000 which draws the actual waveshape (AFTER the reconstruction filter) when zoomed in. I just generated a square wave a few dB below zero and zoomed in to show a few sample points, the rising and falling edges clearly go above the highest and below the lowest sample points. How often this happens with "real" music material and how audible it is when it DOES happen is up for debate, though ideally we don't want it to happen.

Here's a page on what happens to a band-limited square wave:
Gibbs phenomenon - Wikipedia, the free encyclopedia
Well , now Im actually thinking about this, the builtin chip attenuation wont work if its not done on the 16bit input directly. Hm . Maybe this feature has something to it afterall. I seem to remember pmd200 filterchip has 1dB attenuation engaged all the time, not to clip incoming squarewave.

Btw Once we are speaking about squarewaves , does it matter?

I have a better idea, load this track up into a wave editor, run a declipper, or draw the samples away by hand.
Solid State Logic | Music
PSW Recording Forums: Brad Blackwood => SSL Intersample Peak Meter freeware

You can run this one simultaneously.
If you're going to load the CD into audio editor software (to "draw the samples away by hand"), you might as well just lower the amplitude by a dB or two (even Audacity does gain changes in floating point and presumably 'correctly' dithers back to 16 or 24 bits), and play that.

ETA: Any digital recording that has a significant number of intersample overs is surely compressed, limited and clipped to within an inch of its life anyway, and I'm doubtful anyone can tell the difference if these overs are also clipped.
 
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.