0
我正在開展一個關於和絃識別的項目。我使用某人的期刊作爲參考,但我仍然對DSP領域掌握不足。在她的參考文獻中,我首先需要將來自wav文件的信號分成若干幀。就我而言,我需要將每幀分割爲65毫秒,每幀2866個採樣。如何將波形信號分成幀
我已經搜索瞭如何將信號拆分爲幀,但是我沒有發現它們足夠清晰以供我理解。 到目前爲止,這些都是我的一些在WavProcessing類代碼:
public void SetFileName(String fileNameWithPath) //called first in the form, to get the FileStream
{
_fileNameWithPath = fileNameWithPath;
strm = File.OpenRead(_fileNameWithPath);
}
public double getLengthTime(uint wavSize, uint sampleRate, int bitRate, int channels)
{
wavTimeLength = ((strm.Length - 44)/(sampleRate * (bitRate/8)))/channels;
return wavTimeLength;
}
public int getNumberOfFrames() //return number of frames, I just divided total length time with interval time between frames. (in my case, 3000ms/65 ms = 46 frames)
{
numOfFrames = (int) (wavTimeLength * 1000/_sampleFrameTime);
return numOfFrames;
}
public int getSamplePerFrame(UInt32 sampleRate, int sampleFrameTime) // return the sample per frame value (in my case, it's 2866)
{
_sampleRate = sampleRate;
_sampleFrameTime = sampleFrameTime;
sFr = (int)(sampleRate * (sampleFrameTime/1000.0));
return sFr;
}
我只是還沒有得到的想法如何將信號分成在C#每幀65毫秒。 我是否需要拆分FileStream並將它們拆分爲幀並將它們保存到數組中?還是其他什麼?
通常情況下,您將信號拆分爲基數爲2的大小的桶。因此128,256,512,1024 ...因爲大多數FFT算法都需要這個。我從來沒有處理過和絃識別,但我很肯定你需要某種FFT或DCT來識別音高。你會發現大多數代碼(並且那裏有很多)將是裸體C.使用不規則的代碼區域使你能夠複製粘貼它們。你會在www.musicdsp.org找到很多。作爲一本電子書,我建議http://dspguide.com/。這個棒極了! – guitarflow 2012-02-13 00:57:53
這可能也是有用的http://stackoverflow.com/questions/4033083/guitar-chord-recognition-algorithm – guitarflow 2012-02-13 01:00:44
謝謝你的信息。我會仔細看看的。 我實際上會使用Enhanced Pitch Class Profile作爲和絃識別的一部分..你說我在2的基礎上分割信號,有沒有代碼示例? thx .. – 2012-02-13 01:09:30