Stereo files issue?

14 views
Skip to first unread message

Enrico Caprio

unread,
Jan 23, 2021, 8:00:11 AM1/23/21
to birdvox
Hi!
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!

enrico

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\birdvoxdetect-script.py", line 11, in <module>
    load_entry_point('birdvoxdetect==0.4.1', 'console_scripts', 'birdvoxdetect')()
  File "e:\python\lib\site-packages\birdvoxdetect\cli.py", line 260, in main
    logger_level=logger_level,
  File "e:\python\lib\site-packages\birdvoxdetect\cli.py", line 96, in run
    threshold=threshold,
  File "e:\python\lib\site-packages\birdvoxdetect\core.py", line 750, in process_file
    chunk_pcen = compute_pcen(chunk_audio, sr)
  File "e:\python\lib\site-packages\birdvoxdetect\core.py", line 1084, in compute_pcen
    librosa.util.valid_audio(audio, mono=True)
  File "e:\python\lib\site-packages\librosa\util\utils.py", 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

unread,
Jan 26, 2021, 7:06:11 AM1/26/21
to bir...@googlegroups.com

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!
Sincerely,
Vincent.
--
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 birdvox+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/birdvox/d406887c-cf77-4b1a-ab0e-44c6ee9facbbn%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages