问题
I was wondering if someone could point me to a good tutorial or show me how to graph the amplitude from a byte array. The audio format I am using is: U LAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame.
回答1:
It sounds like you are interested in a short term smoothed RMS amplitude measurement. Usually to do this you take a rectified version of the input signal, and then apply a low pass filter to this, e.g.
x1 = abs(x); // x2 = rectified input signal
x2 = k * x2 + (1 - k) * x1; // simple single pole low pass recursive filter
x2 is the amplitude of the signal x. k is a factor < 1.0 which determines the time constant of the smoothing filter.
You will then have some kind of threshold value which you use to decide whether you are in silence (x2 < threshold
) or speech (x2 >= threshold
).
回答2:
Read about Fourier transform. But it's only a part of all you need to do in order to achieve what you want.
来源:https://stackoverflow.com/questions/2448670/graphing-amplitude