在 Python 3 中读取 MP3 [英] Read MP3 in Python 3

查看:54
本文介绍了在 Python 3 中读取 MP3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的很简单

mp3 = read_mp3(mp3_filename)
audio_left = mp3.audio_channels[0]

其中 audio_left 将包含原始 PCM 音频数据.

where audio_left will contain raw PCM audio data.

我正在查看 用 Python 播放声音,但大多数建议模块尚未移植到 Python 3.如果可能,我想避免安装成熟的游戏开发库.

I was looking at Play a Sound with Python, but most of the suggested modules are not ported to Python 3 yet. If possible I'd like to avoid having to install a fully-fledged game dev library.

我是一个完整的 Python 初学者,所以我想开始使用 Python 3.

I'm a complete Python beginner, so I'd like to start off using Python 3.

推荐答案

我最终使用 mpg123 子进程将 mp3 转换为 wav,然后我使用 scipy.io.wavfile.read 读取 wav 文件.

I ended up using an mpg123 subprocess to convert the mp3 to wav, and then I use scipy.io.wavfile.read to read the wav file.

这篇关于在 Python 3 中读取 MP3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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