ValueError: too many values to unpack (expected 1)

Issue #22 closed
Former user created an issue

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)

  1. Peter Bölke

    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?

  2. Log in to comment