我有一个音频文件并从声卡缓冲区读取所有数据。然后,我转换byte[]
为float[]
将它们用于汉明窗。音频波形为:
使用汉明窗后:
带有汉明窗的音频波形对吗?我的错误在哪里?
顺便说一句,我使用 naudio 库来处理音频:
WaveChannel32 wave = new WaveChannel32(new WaveFileReader("sesDosyası.wav"));
byte []buffer = new byte[wave.length];
float []data = new float[wave.length / 4];
int read = wave.Read(buffer, 0, wave.length);
for (int i = 0; i < read / 4; i++)
{
data[i] = BitConverter.ToSingle(buffer, i * 4); //converting byte to float
chart1.Series["wave"].Points.Add(data[i]); //first waveform
}
for (int j = 0; j < read/4; j++)
{
data[j] = (float)(0.54 - 0.46 * Math.Cos((2 * Math.PI * data[j]) / (read / 4 - 1)));//hamming
chart2.Series["wave"].Points.Add(data[j]); //second waveform
}