问题描述
我怎样才能找到最小值,最大值,平均值,从我的声音记录标准偏差间距?我用AudioRecord来记录我的声音。
How can I find min, max, mean, std dev pitch from my voice record ?I use AudioRecord to record my voice.
frequency = 8000;
channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;
audioEncoding = AudioFormat.ENCODING_PCM_16BIT;
recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC,frequency, channelConfiguration, audioEncoding, bufferSize);
在我使用FFT算法来处理语音的原始数据,并获得浮动[]
After I use FFT algorithm to process voice raw data and get float[]
在我使用此功能:
private float[] spectrumAnalyz(float[] spectr) {
float Re;
float Im;
float[] spectruData = spectr;
float[] mySpectrum = new float[(spectruData.length / 2) - 1];
for (int i = 1, j = 0; i < spectruData.length / 2; i++, j++) {
Re = spectruData[2 * i];
Im = spectruData[2 * i + 1];
mySpectrum[j] = (float) Math.sqrt(Re * Re + Im * Im);
}
return mySpectrum;
}
该函数返回的频率数组。搜索在谷歌之后,我发现这个公式 http://en.wikipedia.org/wiki/Pitch_(music )
this function return frequency array. after searching at google I found this formulahttp://en.wikipedia.org/wiki/Pitch_(music)
pitch = 69+12*log2(F/440Hz), where F is frequency in Hz.
使用这个公式我能找到的最小值,最大值,平均值和标准偏差间距。
using this formula i can find min, max, mean and std dev pitch.
是正确的?
推荐答案
这是FFT返回的复杂程度让一堆选定的音频频谱频率段的数组。它并不直接估计基音频率,因为音高不只是一个谱频点。
An FFT returns an array of complex magnitudes for a bunch of selected audio spectrum frequency bins. It does not directly estimate pitch frequency, since musical pitch is not just a spectral frequency bin.
如果你使用的音调检测或估计方法(加权自相关,倒谱,RAPT等),你引用的公式会给你的音调频率的MIDI数。
If you do use a pitch detection or estimation method (weighted autocorrelation, cepstrum, RAPT, etc.) the formula you quote will give you a MIDI number for that pitch frequency.
这篇关于查找在Android的语音音高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!