Closed unosonic closed 1 month ago
I was able to fix the problem locally by installing resampy manually into the birdnet virtual environment, but since it showed the same error ModuleNotFoundError: No module named 'resampy'
on at least 5 fresh installations, it looks like a bug to me rather than a local issue.
birdy2:~/BirdNET-Pi$ source birdnet/bin/activate
(birdnet) birdy2:~/BirdNET-Pi$ pip install resampy
...
Installing collected packages: resampy
Successfully installed resampy-0.4.3
...
(birdnet) birdy2:~/BirdNET-Pi$ python -c "import resampy; print(resampy.__version__)"
0.4.3
(birdnet) birdy2:~/BirdNET-Pi$ deactivate
Hmmm, I can't reproduce the issue. resampy isn't installed on any of my installs, which is fine, it is only needed when the audio is recorded at a sampling rate other that 48k... but the audio recording is hard-coded to be at 48k.
I'm wondering how it is able to hit that code path.
Interesting. For reason of parallel access to the microphone (eg. by other apps) I'm using a special shared PCM device defined in /etc/asound.conf which is set to 44.1kHz sample rate. asound.conf code attached. So that audio device can only deliver at 44.1kHz and then needs resampling.
pcm.mobilemic {
type dsnoop
ipc_key 1024
ipc_key_add_uid false # let multiple users share
ipc_perm 0666 # IPC permissions for multi-user sharing (octal, default 0600)
slave {
pcm "hw:IQaudIOCODEC" # the actual device
channels 2
rate 44100
period_size 1024
buffer_size 4096
}
}
I admit that such a specific PCM device is rather uncommon.. ;) maybe it'd be better to include resampy for such rare cases, since it does the job well and is referenced in your code anyway.
Describe the bug A fresh install (tested on rpi4, rpi zero2) exits successfully, everything seems fine, microphone is working, but analyzing seems to fail. Log is showing the following error:
To Reproduce
Expected behavior successful analysis of recorded audio file
Your build
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.6.51+rpt-rpi-v8 Architecture: arm64 8GB RAM
Code or log snippets see above