ValueError: too many values to unpack (expected 1)
Issue #22
closed
Hello,
i try to analyse a WAV with following code but it failes with ValueError: too many values to unpack (expected 1).
What the matter? :)
import pyaudio
import numpy as np
import peakutils
from matplotlib import pyplot as plt
import scipy.io.wavfile
samplerate, data = scipy.io.wavfile.read("test.wav")
cb = np.array(data)
indexes = peakutils.indexes(data, thres=0.3, min_dist=100)
print(indexes)
thanks for any help
Comments (4)
-
repo owner -
When i change it in this way:
import numpy as np import peakutils from matplotlib import pyplot as plt import scipy.io.wavfile samplerate, data = scipy.io.wavfile.read("test.wav") cb = np.array([d[0] for d in data]) indexes = peakutils.indexes(cb, thres=0.3, min_dist=100) print(indexes)
it gives me:
C:\Python33_64\lib\site-packages\peakutils\peak.py:37: RuntimeWarning: overflow encountered in short_scalars thres = thres * (np.max(y) - np.min(y)) + np.min(y) [ 27 137 301 ..., 191641 191791 191935
Where can i find an example about analysing an audio file?
-
repo owner You can try to change the type of the np array to avoid overflow DOC.
-
repo owner - changed status to closed
- Log in to comment
PeakUtils only operates on 1D arrays.