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

onset_detect() takes 0 positional arguments but 2 were given. #15

Open
mdruuu opened this issue Jul 6, 2023 · 4 comments
Open

onset_detect() takes 0 positional arguments but 2 were given. #15

mdruuu opened this issue Jul 6, 2023 · 4 comments

Comments

@mdruuu
Copy link

mdruuu commented Jul 6, 2023

I'm running into an error as soon as I try to run it, using the sample code given in your readme.

code:
import timbral_models

frame = r"Downloads\Ingentia60.mp3"
timbre = timbral_models.timbral_extractor(frame)

print(timbre)

error:
Calculating hardness...
Traceback (most recent call last):
File "C:\Users\andre\OneDrive\VSCode\transcribeapp\timbre.py", line 4, in
timbre = timbral_models.timbral_extractor(frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\timbral_models\Timbral_Extractor.py", line 70, in timbral_extractor
hardness = timbral_hardness(audio_samples, fs=fs,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\timbral_models\Timbral_Hardness.py", line 87, in timbral_hardness
original_onsets = timbral_util.calculate_onsets(audio_samples, envelope, fs, nperseg=nperseg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\timbral_models\timbral_util.py", line 642, in calculate_onsets
onsets = librosa.onset.onset_detect(audio_samples, fs, backtrack=True, units='samples')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: onset_detect() takes 0 positional arguments but 2 positional arguments (and 2 keyword-only arguments) were given

@alastair
Copy link
Member

alastair commented Jul 6, 2023

Hi @dimsumham. I'm not actively involved with the development of this package, but it looks like we didn't specify the required version of the librosa dependency when this package was first written (about 5 years ago) and since then it appears that librosa's API has changed.

We have a private version of this repository which we use, and I see that there is a specific set of dependencies that we install for it.

You could try and install a specific version of the dependencies with

pip install SoundFile==0.10.2 numba==0.48 librosa==0.6.1 scipy==1.1.0 pyloudnorm==0.1.0

and see if this works. However, if the version of python that you have doesn't have windows versions of these specific dependencies then you may not be able to install them. Unfortunately I'm unable to help if this is the case. Best of luck.

@mdruuu
Copy link
Author

mdruuu commented Jul 6, 2023

Hi @alastair , thank you very much for taking the time to answer. I will give this a try.

@LuizVSilva
Copy link

You can try to name arguments to be keyword-only.
For example, you can specify in timbra_util.py and Timbral_hardness.py (or other files with same error) function call's:

  • audio_samples to y=audio_samples
  • fs to sr=fs

@mdruuu
Copy link
Author

mdruuu commented Sep 11, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants