How to edit raw PCM audio data without an audio library?(如何在没有音频库的情况下编辑原始 PCM 音频数据?)
问题描述
我对精确提取 PCM WAV 文件的各个部分感兴趣,直到样本级别.大多数音频模块似乎都依赖于特定于平台的音频库.我想做这个跨平台,速度不是问题,有没有原生的python音频模块可以做到这一点?
I'm interested in precisely extracting portions of a PCM WAV file, down to the sample level. Most audio modules seem to rely on platform-specific audio libraries. I want to make this cross platform and speed is not an issue, are there any native python audio modules that can do this?
如果没有,我将不得不解释 PCM 二进制文件.虽然我确信我可以相当容易地挖掘 PCM 规范,并且原始格式很容易理解,但我以前从未真正用 Python 处理过二进制数据.有没有很好的资源可以解释如何做到这一点?专门与音频相关的只是锦上添花.
If not, I'll have to interpret the PCM binary. While I'm sure I can dig up the PCM specs fairly easily, and raw formats are easy enough to walk, I've never actually dealt with binary data in Python before. Are there any good resources that explain how to do this? Specifically relating to audio would just be icing.
推荐答案
我看了问题和答案,我觉得我一定遗漏了一些非常明显的东西,因为没有人提到以下两个模块:
I read the question and the answers and I feel that I must be missing something completely obvious, because nobody mentioned the following two modules:
- audioop:操作原始音频数据
- wave:读写WAV文件
- audioop: manipulate raw audio data
- wave: read and write WAV files
也许我来自平行宇宙,Guido 的时间机器实际上是一个时空机器 :)
Perhaps I come from a parallel universe and Guido's time machine is actually a space-time machine :)
如果您需要示例代码,请随时询问.
Should you need example code, feel free to ask.
PS 假设 48kHz 采样率,24/1.001==23.976023976... fps 的视频帧长度为 2002 个音频样本,而 25fps 的视频帧长度为 1920 个音频样本.
PS Assuming 48kHz sampling rate, a video frame at 24/1.001==23.976023976… fps is 2002 audio samples long, and at 25fps it's 1920 audio samples long.
这篇关于如何在没有音频库的情况下编辑原始 PCM 音频数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在没有音频库的情况下编辑原始 PCM 音频数据


基础教程推荐
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 包装空间模型 2022-01-01