如何使用python从mp3文件中提取原始数据? [英] How to extract the raw data from a mp3 file using python?

查看:210
本文介绍了如何使用python从mp3文件中提取原始数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了有关使用Python进行音频数据分析的作业.我想知道有没有什么好的模块可供我用来从mp3文件中提取原始数据.我的意思是原始数据,而不是元数据,id3标签.

I have got homework regarding audio data analysis using Python. I wonder is there any good module for me to use to extract the raw data from a mp3 file. I mean the raw data, not the metadata, id3 tags.

我知道如何使用wave模块来处理.wav文件.我可以readframes获取原始数据.但我不知道该如何处理mp3.我在Google和stackoverflow上搜索了很多内容,然后找到了eyeD3.但是不幸的是,文档相当令人沮丧,现在的版本是0.7.1,与我在Internet上可以找到的大多数示例不同.

I know how to use the wave module to process .wav files. I can readframes to get the raw data. But I don't know how to do with mp3. I have searched a lot on google and stackoverflow and find eyeD3. But unfortunately the documentation is rather frustrating and now the version is 0.7.1, different from most examples I can find on the Internet.

有没有什么好的模块可以从mp3中提取原始数据?如果eyeD3有任何好的文档,那也很好.

Is there any good module that can extract raw data from a mp3? If there is any good documentation for eyeD3, it is also good.

推荐答案

如果我理解您的问题,则可以尝试使用 pydub (我写的一个库)来获取音频数据,如下所示:

If I understand your question, you can try using pydub (a library I wrote) to get the audio data like so:

from pydub import AudioSegment

sound = AudioSegment.from_mp3("test.mp3")

# sound._data is a bytestring
raw_data = sound._data

这篇关于如何使用python从mp3文件中提取原始数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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