Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个持续时间为 10s 的音频文件,如果我想寻找 2s,我如何获得样本帧偏移量?
如果是 LPCM(例如未压缩),则使用采样率。
在伪代码中:
double sampleRate = audioFile.getSampleRate(); size_t offsetInSeconds = 2; size_t sampleToRead = sampleRate * offsetInSeconds * audioFile.getChannelCount(); AudioSample sample = audioFile.getSampleAt(sampleToRead);