1
我使用C#包裝器從Spotify流式傳輸音樂ohLibSpotify並使用NAudio播放音樂。現在我試圖爲我收到的數據創建一個頻譜可視化。來自Spotify的流式音樂的可視化
當我從libspotify數據,以下回調函數被調用:
public void MusicDeliveryCallback(SpotifySession session, AudioFormat format, IntPtr frames, int num_frames)
{
//handle received music data from spotify for streaming
//format: audio format for streaming
//frames: pointer to the byte-data in storage
var size = num_frames * format.channels * 2;
if (size != 0)
{
_copiedFrames = new byte[size];
Marshal.Copy(frames, _copiedFrames, 0, size); //Copy Pointer Bytes to _copiedFrames
_bufferedWaveProvider.AddSamples(_copiedFrames, 0, size); //adding bytes from _copiedFrames as samples
}
}
是否有可能來分析我傳遞給BufferedWaveProvider創建一個實時的可視化的數據?有人可以解釋一下嗎?
我已經管理了FFT並收到了包含-1到1的值的double []。您能更詳細地解釋「繪製每個頻率分量的幅度與頻率和時間的關係」的意思,以及您將如何編碼那部分? – freakimkaefig
這個答案有解釋傅立葉變換輸出的提示:http://stackoverflow.com/questions/604453/analyze-audio-using-fast-fourier-transform – nimish