从* .wav文件中提取振幅列表以在Python中使用 [英] Extracting an amplitude list from *.wav file for use in Python

查看:344
本文介绍了从* .wav文件中提取振幅列表以在Python中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编程和转换方面有点麻烦.我正在设计一种AI,以识别乐器演奏的音符,并且需要从wave文件中提取原始声音数据.我的目标是对文件中的大部分时间执行FFT操作,以供AI使用.为此,我需要音频文件的振幅列表,但似乎找不到能够起作用的转换技术.这些文件以MP3开头,然后将它们转换为wav文件,但是我总是以压缩文件结尾,当我尝试读取该文件时会吐出乱码.有谁知道我如何将wav文件转换为与Python的wave模块兼容的文件,甚至直接将数据转换为幅度列表的文件?

I'm having a little bit of programing and conversion trouble. I'm designing an AI to recognize notes played by instruments and need to extract the raw sound data from a wave file. My objective is to perform a FFT operation over chunks of time in the file for use by the AI. For this I need an amplitude list of the audio file, but I can't seem to find a conversion technique that will work. The files start as MP3's and then I convert them to wav file, but I always end up with a compressed file that spits out gibberish when I try to read it. Does anyone know how I might convert the wav file to something that would be compatible with Python's wave module or even something that would directly convert the data into an amplitude list?

推荐答案

默认的Python wave模块不是很完整.您可以尝试使用scipy中包含的替代方法.

The default Python wave module isn't very thorough. You might try the one included in scipy as an alternative.

签出:在Python中读取* .wav文件

如果您要对音频进行任何数值繁重的操作,则无论如何,scipy可能是您的最佳选择.

If you're going to do any numerical heavy lifting with the audio, scipy might be your best option anyway.

这篇关于从* .wav文件中提取振幅列表以在Python中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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