Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in autobpm plugin / Docs incomplete #5185

Closed
JOJ0 opened this issue Apr 10, 2024 · 2 comments · Fixed by #5389
Closed

Crash in autobpm plugin / Docs incomplete #5185

JOJ0 opened this issue Apr 10, 2024 · 2 comments · Fixed by #5389
Assignees
Labels
bug bugs that are confirmed and actionable

Comments

@JOJ0
Copy link
Member

JOJ0 commented Apr 10, 2024

Sorry for being brief. A quick report on a crash I'm experiencing with the rather new autobpm plugin. Something with librosa. I'm on Python 3.11.

Problem

Running this command in verbose (-vv) mode:

$ beet -vv autbpm label:syncopathic

Led to this problem:

Traceback (most recent call last):
  File "/home/jojo/.pyenv/versions/beets/bin/beet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1865, in main
    _raw_main(args)
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1852, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/jojo/git/beets/beetsplug/autobpm.py", line 46, in command
    self.calculate_bpm(lib.items(ui.decargs(args)), write=ui.should_write())
  File "/home/jojo/git/beets/beetsplug/autobpm.py", line 81, in calculate_bpm
    tempo, _ = beat.beat_track(y=y, sr=sr)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jojo/.pyenv/versions/3.11.3/envs/beets/lib/python3.11/site-packages/librosa/beat.py", line 185, in beat_track
    beats = __beat_tracker(onset_envelope, bpm, float(sr) / hop_length, tightness, trim)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jojo/.pyenv/versions/3.11.3/envs/beets/lib/python3.11/site-packages/librosa/beat.py", line 433, in __beat_tracker
    beats = __trim_beats(localscore, beats, trim)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jojo/.pyenv/versions/3.11.3/envs/beets/lib/python3.11/site-packages/librosa/beat.py", line 507, in __trim_beats
    smooth_boe = scipy.signal.convolve(localscore[beats], scipy.signal.hann(5), "same")
                                                          ^^^^^^^^^^^^^^^^^
AttributeError: module 'scipy.signal' has no attribute 'hann'

Here's a link to the music files that trigger the bug (if relevant):

difficult to provide....

Setup

  • OS: Manjaro Linux
  • Python 3.11.3
  • librosa 0.10.1
  • resampy 0.4.3
  • beets version: git master

Also a quick note on the existing docs: https://docs.beets.io/en/latest/plugins/autobpm.html

The installation requirements could be better. We need to pip install librosa resampy as far as I figured it out. That correct? We should explicitely state that in the docs

@JOJ0 JOJ0 changed the title Crash in autobpm plugin Crash in autobpm plugin / Docs incomplete Apr 10, 2024
@JOJ0
Copy link
Member Author

JOJ0 commented Apr 10, 2024

@tandy-1000 Hi :-) Just a heads up. Maybe you have seen this issue? And also note that we should improve the docs a little here. Please clarify if my pip install assumption are correct, I'll correct the issue description then :-)

@wisp3rwind
Copy link
Member

wisp3rwind commented Apr 10, 2024

Looks like a simple bug in librosa, though: librosa/librosa#1830 (i.e. librosa uses scipy < 1.0.0API).

@snejus snejus added the bug bugs that are confirmed and actionable label Aug 15, 2024
@snejus snejus self-assigned this Aug 15, 2024
@snejus snejus linked a pull request Aug 16, 2024 that will close this issue
3 tasks
snejus added a commit that referenced this issue Aug 26, 2024
Fixes #5289 and #5185

Tried using the `autobpm` plugin and found a couple of issues:

1. #5185 `librosa` dependency was missing in `pyproject.toml`
2. Simply including the plugin in the configuration made `beet` take
over 4 seconds to start up.
3. BPM detection failed due to another missing dependency, `resampy`
4. #5289 Librosa `beat_track` function returned unexpected type which
made the plugin and the entire import process fail.

Addressed each of the above, slightly refactored the plugin and added
tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants