如何在没有音频库的情况下编辑原始 PCM 音频数据?

How to edit raw PCM audio data without an audio library?(如何在没有音频库的情况下编辑原始 PCM 音频数据?)
本文介绍了如何在没有音频库的情况下编辑原始 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 音频数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to find element by part of its id name in selenium with python(如何使用python在selenium中通过其id名称的一部分查找元素)
NoSuchElementException: Message: Unable to locate element while trying to click on the button VISA through Selenium and Python(NoSuchElementException:消息:尝试通过 Selenium 和 Python 单击 VISA 按钮时无法找到元素) - IT屋-程序员软件开发技术分
Selenium not able to click on Get Data button on using Python(Selenium 在使用 Python 时无法单击“获取数据按钮)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable with Selenium and Python(selenium.common.exceptions.ElementClickInterceptedException:消息:元素点击被拦截:元素不可点击
Selenium Compound class names not permitted(不允许使用硒化合物类名称)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium(selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:尝试使用 selenium 单