如何在没有音频库编辑原始PCM音频数据? [英] How to edit raw PCM audio data without an audio library?

查看:178
本文介绍了如何在没有音频库编辑原始PCM音频数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是precisely提取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?

如果不行,我得间preT的PCM二进制文件。虽然我敢肯定,我可以很容易挖出来的PCM规格,以及RAW格式是很容易走,我从来没有真正在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 :在操作原始的音频数据

  • :在读取和写入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 :)

如果您需要例如code,随意问。

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音频数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆