I have a wav file and I want to get the frequencies, amplitudes, and Phase. I have tried to do that but what I get I can not get the interpreter
import math
import numpy as np
from matplotlib.pyplot import *
import scipy.io.wavfile as wave
from numpy.fft import fft
rate,data = wave.read('test.wav')
n = data.size
duree = 1.0*n/rate
print rate
spectre = np.fft.fft(data[5:10])
#freq = np.fft.fftfreq(n, 1)
print spectre
I obtain for example
[[ -9.27766766e+08+0.j -9.27557398e+08+0.j]
[ -1.86505703e+09+0.j 2.16973235e+09+0.j]
[ -2.33588876e+08+0.j 2.33467572e+08+0.j]
[ 1.76254287e+09+0.j 1.76250750e+09+0.j]
[ 9.96780365e+08+0.j -2.30269509e+09+0.j]]
You must learn the FFT algorithm to understand all. As you see it manages complex numbers, so some add work is necessary to interpret the output.
As a shortcut, half of output is redundant. To see the spectrum, just proceed like that :
import numpy as np
import matplotlib.pyplot as plt
import scipy.io.wavfile as wave
rate,data = wave.read('57.wav')
spectre = np.fft.fft(data)
freq = np.fft.fftfreq(data.size, 1/rate)
mask=freq>0
plt.plot(freq[mask],np.abs(spectre[mask]))
For