問題描述
PCM 樣本位置 [字節偏移] 在 flac (PCM sample position [byte offset] in flac)
I have a flac file and I have to do some analysis on the waveform looking for a particular sample. So I decompressed them in PCM data, but then I need to know, where is that particular sample in the flac file.
So: I know the byte offset in the PCM data, or in a wav file, and I want to know the byte offset of the compressed sample in the flac file.
How can I do?
‑‑‑‑‑
參考解法
方法 1:
You can probably trace the sample back to the frame in the FLAC file. Within that frame would be more difficult if you consider the audio may have multiple channels and is generally compressed. If you look at the flac spec, I think it should be pretty easy to parse the file yourself:
http://flac.sourceforge.net/format.html
And you probably have to decode each frame in order to know what the frame length is...
(by fortea、GogglesGuy)