AudioCommons / timbral_models

Python scripts for modelling timbral attributes
Apache License 2.0
75 stars 26 forks source link

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

Open mdruuu opened 1 year ago

mdruuu commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

LuizVSilva commented 11 months ago

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:

mdruuu commented 11 months ago

Thanks! Will give a trySent from my iPhoneOn Sep 10, 2023, at 3:37 PM, LuizVSilva @.***> wrote: 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

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>