[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic range and sample bit depth



I can add some insight into the problem with audible signals from Matlab when the signals should not be audible. I discovered this as well, through some admittedly sloppy coding on my part. I even went through the exercise of reporting a bug to the Mathworks, and after a lot of back and forth, and a lot of testing, we determined that it was a "feature" not a "bug" in Matlab. What I discovered was that very low level signals (i.e. levels << -100 dB FS) were still audible to my ears using HD280pro headphones when played with audioplayer at 16 bit depth, as Dan described, but the same signals were not audible when played with wavplay (always 16-bit) or with audioplayer at 24-bit. I finally figured out after looking at the signals output from the sound card on an oscilloscope that audioplayer uses mid-riser quantization and wavplay uses mid-tread quantization (see http://en.wikipedia.org/wiki/Quantization_(signal_processing)#Mid-riser_and_mid-tread_uniform_quantizers). This means that any signal that oscillates between very small positive and negative values will get rounded up by audioplayer to oscillate between the quantization levels around 0, whereas wavplay will output 0. Dithering should help avoid this problem, albeit by adding an audible noise floor (at least audible with audioplayer). Also, Dan's solution of using 24-bit output also will work around this feature because the acoustic/electric noise floor should be high enough with any system to mask this small signal, as several others have already pointed out.
-Eric

On Friday, December 5, 2014 12:13 AM, Dan Goodman <d.goodman@xxxxxxxxxxxxxx> wrote:


Thanks to everyone who replied on and off list to my questions!

So, several people seemed to agree that using dither is essential. What
worries me about this is that if you do your sound presentations using
Matlab on synthetic signals (generated using Matlab code rather than
recorded), as far as I can tell it won't do this dithering, and so the
dynamic range will be much worse than people might be expecting. I
actually first came across this problem when helping to debug someone's
threshold finding code that was failing for people with very good
hearing. It turned out that this was because tones presented at low
levels (substantially less than 0 dB SPL) were still audible. The reason
in this case is that they were using 16 bit audio and switching to 24
bit solved the problem. (I guess Matlab was rounding up when converting
from floats to integers, so no matter how low the level of the signal
you were still getting some 1s in there and not just 0s.) However, my
worry is that if your reference level was set higher than this (because
you were testing normal and hearing impaired people with the same
equipment) then even 24 bit might not be enough (without dithering).

--------snip---------

Dan