如何根据音频文件的长度计算样本数?
给定一个持续时间为 10 秒的音频文件,我如何找出 2 秒到 8 秒之间的样本数?
Given an audio file of duration say 10s, how do I find out the no of samples betweeen 2s and 8s?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果是LPCM(例如未压缩),则使用采样率。
伪代码:
-- 其中
(8-2)
表示“2 和 8 之间”if it's LPCM (e.g. not compressed), then use the sample rate.
in pseudocode:
-- where
(8-2)
represents "betweeen 2s and 8s"您可以使用音频播放器的持续时间属性来达到此目的。
持续时间属性给出了音频播放器当前对象的持续时间(即当前正在播放的文件)
,因此您可以将所有音频文件提供给播放器一项一项地检查它们的持续时间并执行所需的操作...
干杯
You can use the duration property of the audio player for that purpose..
The duration property gives the duration of the current object of audio player(i.e the file that is currently being played)
So then you can supply all the audio files to the player one by one and check their durations and perform the required operations...
Cheers