Perform FFT for every second on wav file with Python
What you are looking can be accomplished in a single lane, by using the standard command for the STFT
I need to FFT wav files?
Your error message states that you are trying to iterate over an integer (a
). When you define a
via
a = data.T[0]
you grab the first value of data.T
. Since your data files are single channel, you are taking the first value of the first channel (an integer). Changing this to
a = data.T
will fix your problem.
WAV FFT: Slice indices must be integers
abs()
doesn't make your number into an integer. It just turns negative numbers into positive numbers. When len(c)
is an odd number your variable d
is a float that ends in x.5
.
What you want is probably round(d)
instead of abs(d)
Related Topics
Reading the Target of a .Lnk File in Python
Scikit-Learn Gridsearchcv with Multiple Repetitions
Safest Way to Convert Float to Integer in Python
Python Float to Int Conversion
Pandas: Valueerror: Cannot Convert Float Nan to Integer
Return SQL Table as JSON in Python
Importerror: No Module Named 'Django.Core.Urlresolvers'
Positional Argument Follows Keyword Argument
Django Rest Framework Post Nested Objects
Valueerror: Unknown Ms Compiler Version 1900
Can You List the Keyword Arguments a Function Receives
Python Decorator Handling Docstrings
Python Parsing Bracketed Blocks
Installing Numpy and Scipy on 64-Bit Windows (With Pip)
Selenium: Get Coordinates or Dimensions of Element with Python