在Python 3中阅读MP3 [英] Read MP3 in Python 3
本文介绍了在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屋!
查看全文