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 音频数据
- padding='same' 转换为 PyTorch padding=# 2022-01-01
- pytorch 中的自适应池是如何工作的? 2022-07-12
- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- python-m http.server 443--使用SSL? 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- 如何将一个类的函数分成多个文件? 2022-01-01
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
- 沿轴计算直方图 2022-01-01