I am making a speech comparison app in javascript.

I found this dsp.SE post:

Speech comparison algorithm for rating on similarities,

where I read it is best to use mfcc and dtw algorithms.

I found the Node.js implementation of mfcc which I'd like to use. However, it is only working with 8 bit audio samples. Will that affect the quality of speech comparison, and by how much? If the difference is big enough I will edit the algorithm to support 16 bit samples.


1 Answer 1


Will that affect the quality of speech comparison, and by how much?

That is impossible to tell without knowing what the Node.js thing does internally; I think it's a bit much too ask for us to search for what you meant. As a comment: signal processing in JavaScript sounds like a bad idea, performance-wise and development-wise; it's really not what JS was designed and optimized for, and there's a significant lack of libraries, let alone efficient ones. I always urge people to use the right tools for their job, and JS isn't that here, I think. </comment>

That being said:

From a pure signal point of view, you can model the effect of quantization as noise. The problem here being that this kind of noise is neither uncorrelated to the signal, nor necessarily white. To make things a bit harder on the compensation side, its amplitude typically isn't Gaussian even. Oh, well, but here goes quantization noise power, a figure that is both very important to understand the maximum SNR you can get out of a digital system and doesn't say much as long as you don't say how well the signal processing can deal with this specific kind of noise.

Luckily, for "small enough" quantization steps, a little stochastic consideration¹ says that the assumption that quantization noise (QN henceforth) is additive is pretty justified.

Now, assuming your signal amplitude is really uniformly distributed, and your ADC being perfectly uniform, the amplitude $\text{SNR}_Q$ (signal-to-QN-ratio) for an M-bit ADC becomes

$$\begin{align*} \text{SNR}_Q &= 2^M\\ \text{SNR}_Q \text{[dB]}&= 20 \log_{10}(2^M)\\ &= 20 \log_{10}(2)\,M \\ &\approx 6 M\text, \end{align*} $$ which implies that for 8bit, your $\text{SNR}_{Q,8b} \approx 48\,\text{dB}$, and for 16bit $\text{SNR}_{Q,16b} \approx 96\,\text{dB}$.

Now, speech definitely isn't uniform in amplitude; it's a bit hard to justify this model without knowing what your recording looks like, but I'd rather say it's composed of sines; in that case, you get an additional $1.8\text{dB}$ noise for both cases.

Point here is that I doubt that a "real world, non-studio equipment, non-anechoic-chamber silence" speech recording will ever be any close to $48\,\text{dB}$, so probably, no, that's a fine choice, and by the way you ask this question, I kind of doubt it will be trivial to extend the algorithm (which probably uses a lot of elegant numerical math internally) to 16bit, anyway.

¹ the amount of noise power correlated to the signal necessarily being very limited, and an mutually independent set of sufficiently many i.i.d. realizations (Normal due to CLT) added up still being Normal if their moments weren't too different ...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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