first post! I've looked through a lot of other posts on this problem but can't find anything that applies to my code.
I'm trying to read an audio file and then find the max and min values of the array of samples, x
.
wavread()
is a function defined in another module that I've imported.
It returns fs, x
.
x
is a one-dimensional array (x.shape = (150529,)
.)
def minMaxAudio(inputFile):
(fs, x) = wavread(inputFile)
max_val = numpy.amax(x)
min_val = numpy.amin(x)
return (min_val, max_val)
when I type these lines individually into ipython, I get the result I want. but when I call this function from an imported .py file I get the error:
ValueError: The truth value of an array with more than one element is ambiguous.
Use a.any() or a.all()
It highlights the last line (return statement) as the location of the error.
Every other post on this that I've looked at includes some sort of evaluation or comparison operator in the code. Mine doesn't have one... does it?!
Thanks!