Skip to content

Commit

Permalink
Bump librosa to 0.10.2-release branch
Browse files Browse the repository at this point in the history
This fixes `AttributeError: module 'scipy.signal' has no attribute 'hann'` that occurs when trying to augment data using `automix.py`.

In librosa version 0.10.2.dev0, the `__trim_beats` in beat.py no longer uses scipy for hanning computation & now uses `np.hanning` instead.
  • Loading branch information
Ma5onic authored Apr 13, 2024
1 parent b792f07 commit f1254ce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ torchaudio>=0.8,<2.1
tqdm
treetable
soundfile>=0.10.3;sys_platform=="win32"
librosa @ git+https://github.com/librosa/librosa.git@c0266e4

1 comment on commit f1254ce

@Ma5onic
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix for AttributeError: module 'scipy.signal' has no attribute 'hann' :

concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/concurrent/futures/process.py", line 246, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/home/ubuntu/demucs/tools/automix.py", line 81, in analyse_track
    tempo, events = beat_track(y=drums.numpy(), units='time', sr=SR)
  File "/home/ubuntu/demucs/.venv/lib/python3.10/site-packages/librosa/beat.py", line 185, in beat_track
    beats = __beat_tracker(onset_envelope, bpm, float(sr) / hop_length, tightness, trim)
  File "/home/ubuntu/demucs/.venv/lib/python3.10/site-packages/librosa/beat.py", line 433, in __beat_tracker
    beats = __trim_beats(localscore, beats, trim)
  File "/home/ubuntu/demucs/.venv/lib/python3.10/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'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/demucs/tools/automix.py", line 343, in <module>
    main()
  File "/home/ubuntu/demucs/tools/automix.py", line 312, in main
    spec, track = pending.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
AttributeError: module 'scipy.signal' has no attribute 'hann'

Please sign in to comment.