Importing audio track (wav or aiff) in Python

人盡茶涼 提交于 2019-12-11 12:56:34

问题


I have an audio track in AIFF format. I would like to open this audio file with Python, and import the amplitudes of the sound and perform some mathematical analysis such as Fourier Transform, etc.

  1. Is this possible in Python?
  2. Are there libraries or modules, which allow me to acquire an audio file?

Throughout my search, I have found scipy.io.wavfile, which works for WAV audio files.

  1. Are there other libraries to import audio files in Python?
  2. Is there something similar for AIFF files?

Obviously, I can convert the AIFF into a WAV file, but I would like to import the AIFF file directly, if possible.

As a side question: are there some more specific (by specific, I mean better than Python) programming languages to perform such kind of analysis and acquisition of audio files?


回答1:


Python comes with AIFF support as part of the standard library -- see the aifc module.

This module provides support for reading and writing AIFF and AIFF-C files. AIFF is Audio Interchange File Format, a format for storing digital audio samples in a file. AIFF-C is a newer version of the format that includes the ability to compress the audio data.

Depending on what your end goals are, you may be more productive using a tool like PureData that's designed just for working with audio and has things like reading audio files and performing ffts as primitives.




回答2:


Yes, I also came across this problem using scipy.io.wavfile. I looked up the problem and see that Scikits might be interesting to get around this wave only solution.

https://sites.google.com/site/ldpyproject/scikits-audiolab

As for Pure Data I use this a lot, but of course it does depend on what you wishing to do with your sound file...?



来源:https://stackoverflow.com/questions/21489927/importing-audio-track-wav-or-aiff-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!