Calculating fft using python

Using wave

in Python, we can read the .wav audio format and can calculate the frequency and power of the signal. But I want to calculate the frequency of the .mp3 audio format directly. I've heard a little about Pisox. Is Pysox capable of reading frames and can we calculate fft and frequency with Pysox? Or is there any other software that can calculate the frequency of an MP3 file using Python?

+3


source to share


1 answer


your questions have multiple parts, but I'll give it a chance: you can get the raw audio data using pydub (same as the module gives wave

)

import pydub

sound = pydub.AudioSegment.from_mp3("/path/to/file.mp3")
raw_data = sound._data

      



(note that you need ffmpeg or avlib to decode mp3)

From there, you should be able to use numpy. This O'Reilly post might also help

0


source







All Articles