_spectral_helper error during prep

Hi all,
I hope I didn’t miss anything obvious in the tutorial (sorry if I do, bit under time pressure due to students’ deadlines).

I get an error during prep in the spectrogram step. The progress bar starts running for about 15 seconds and then crashes with error:

  File "/home/sitath/anaconda3/envs/tweetyS2/lib/python3.9/site-packages/matplotlib/mlab.py", line 780, in specgram
    spec, freqs, t = _spectral_helper(x=x, y=None, NFFT=NFFT, Fs=Fs,
  File "/home/sitath/anaconda3/envs/tweetyS2/lib/python3.9/site-packages/matplotlib/mlab.py", line 384, in _spectral_helper
    result = result * window.reshape((-1, 1))

things I checked:

  • csv is correctly formatted
    *files extensions are .wav and .wav.csv
    *sampling rate is same as demo data (32000)
    *I left all other settings in the confic file (except paths) same as demo set, but tried also higher fft, different train and test dur and different window size, but same error

Everything works fine with the dataset in the tutorial.

full error msg in attachment:
20230701_spectral_helper_error.txt (4.4 KB)

thanks in advance!

Hi @Sita sorry about this

Not sure what the source of the error is just yet.

Could your audio have more than one channel?

This part of the traceback makes me think that could be the cause

dask.multiprocessing.ValueError: operands could not be broadcast together with shapes (512,2,151649) (512,1)

That looks like the spectrogram function trying to apply a window to an audio signal with two channels.

If that’s the case then for now the quick fix would be to convert it to mono.

Let me know!


doh! I knew it had to be something silly! Indeed they have 2 channels and making them mono solved the error. thanks heeps! :slight_smile:

1 Like

Of course!

We should do a better job of catching that and raising a clear error.

Raised an issue about it here: CLN: Catch audio channels > 1 in prep.frame_classification and raise a clear error · Issue #682 · vocalpy/vak · GitHub