Stereo files issue?

Skip to first unread message

Enrico Caprio

Jan 23, 2021, 8:00:11 AM1/23/21
to birdvox
I am trying to process some audio files and receive this error. I have no issues when processing mono files, but this folder contains stereo files. 

Any hints on how to select one of the two channels?

Thank you!


birdvoxdetect: Threshold = 50.0
birdvoxdetect: Output directory = E:\arch\samples
birdvoxdetect: Duration of exported clips = 5.00 seconds.
birdvoxdetect: Processing: E:\process\S4A11836_20200930_164850.wav
Traceback (most recent call last):
  File "E:\python\Scripts\", line 11, in <module>
    load_entry_point('birdvoxdetect==0.4.1', 'console_scripts', 'birdvoxdetect')()
  File "e:\python\lib\site-packages\birdvoxdetect\", line 260, in main
  File "e:\python\lib\site-packages\birdvoxdetect\", line 96, in run
  File "e:\python\lib\site-packages\birdvoxdetect\", line 750, in process_file
    chunk_pcen = compute_pcen(chunk_audio, sr)
  File "e:\python\lib\site-packages\birdvoxdetect\", line 1084, in compute_pcen
    librosa.util.valid_audio(audio, mono=True)
  File "e:\python\lib\site-packages\librosa\util\", line 164, in valid_audio
    'ndim={:d}, shape={}'.format(y.ndim, y.shape))
librosa.util.exceptions.ParameterError: Invalid shape for monophonic audio: ndim=2, shape=(3712000, 2)

Vincent Lostanlen

Jan 26, 2021, 7:06:11 AM1/26/21

Hello Enrico and all,

BirdVoxDetect is only meant to work with monophonic (single-channel) audio. I can work towards making the error message more informative but i think that treating multichannel recordings automatically would potentially misleading. (some users might want to convert to mono before analysis, others to treat them independently)

To split a stereo WAV file into left and right channels, sox is your best friend:

sox stereo.wav left.wav remix 1
sox stereo.wav right.wav remix 2

Replace stereo.wav by your stereo input signal.
Then do:

python -m birdvoxdetect left.wav
python -m birdvoxdetect right.wav

I hope this helps!
You received this message because you are subscribed to the Google Groups "birdvox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit
Reply all
Reply to author
0 new messages