sample format 13-bit

I am working on a hardware project with a 13-bit codec. (I am a biomedical engineer, and don’t know that much about audio processing) When I try to play 16-bit sound files through this 13-bit codec, they are clipped and sound horrible.

Would someone be able to give me some advice for settings in the “amplify” plugin to limit my sounds to a 13-bit range? I am having a really hard time getting my head around dB and the conversion between dB and bits.

Also, what are the units in the waveform display? They can go from -2 to +2, but default to ±1.
Assuming that (with a 16-bit sound), the maximum amplitude is 1 = 32767(16-bit 2’s compliment max), then a 13-bit 2’s compliment max would be 4096. So I need to “de-amplify” my sound so that it’s max amplitude is 4096/32767 = 0.125 (on the ±1 scale).

Is this the right process? I just tried it by trial and error on a file, and it needed about -9 dB. I suppose this will be different for each sound.

Each bit offers you 6dB more resolution. A 16-bit file offers down to -96dB (16*6), while a 13-bit D/A only offers down to -78dB.

So, to make the files as loud as possible, amplify them to max at 16-bits and then reduce them by 18dB. If it still sounds off, go down another dB or 2.

The only problem with your math is that the samples are in signed 16-bit values. So the peak is at +16384. All your other math is right, the peak should be at a float value of .125. This is only 9dB down if you use a single-sided signal, but Audio is 2 sided, so dB values need to be multiplied by 2.

Thanks for your help alatham, that was a good explanation. The process of amplifying to a full 16 bits, and then attenuating by 18dB works great. 6dB/bit was the missing piece of the puzzle.

Thanks again,
Cyle

2^16 = 65,536 = ±32,767

2^13 = 8,192 = ± 4,096

±4096/±32767 = ±0.125

Actually, I was wrong about the peak of a 16-bit sample, it is +32,767 as you say.

I must be losing it.