Open ffont opened 6 years ago
timbral_brightness and timbral_hardness have now been updated to deal with this. The error was caused due to the differences in python 2/3, whereby division in python 2 results in an int, but a float in python 3. I've now made the conversion to int explicit so should work on both.
I'm don't seem to be able to process https://freesound.org/s/198841 in either python2 or python3. In python2 I get the following error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/ffont/Developer/AudioCommons/timbral_models/test.py in <module>()
1 from timbral_models import timbral_hardness
2
----> 3 timbral_hardness('test.wav')
/Users/ffont/Developer/AudioCommons/timbral_models/timbral_models/Timbral_Hardness.pyc in timbral_hardness(fname, dev_output, max_attack_time, bandwidth_thresh_db, phase_correction)
637
638 # calculate the onsets
--> 639 original_onsets = calculate_onsets(audio_samples, envelope, fs, nperseg=nperseg)
640 onset_strength = librosa.onset.onset_strength(audio_samples, fs)
641
/Users/ffont/Developer/AudioCommons/timbral_models/timbral_models/Timbral_Hardness.pyc in calculate_onsets(audio_samples, envelope_samples, fs, look_back_time, hysteresis_time, hysteresis_percent, onset_in_noise_threshold, threshold_correction, minimum_onset_time_separation, nperseg)
379 I'm still adding new features to this so remember to update the definitions of all the input features
380 '''
--> 381 onsets = librosa.onset.onset_detect(audio_samples, fs, backtrack=True, units='samples')
382
383 # set values for return_loop method
/usr/local/lib/python2.7/site-packages/librosa/onset.pyc in onset_detect(y, sr, onset_envelope, hop_length, **kwargs)
144
145 # Peak pick the onset envelope
--> 146 return util.peak_pick(onset_envelope, **kwargs)
147
148
TypeError: peak_pick() got an unexpected keyword argument 'backtrack'
With python3 I get this other error: (the same as in the issue description)
Traceback (most recent call last):
File "test.py", line 3, in <module>
timbral_hardness('test.wav')
File "/Users/ffont/Developer/AudioCommons/timbral_models/timbral_models/Timbral_Hardness.py", line 639, in timbral_hardness
original_onsets = calculate_onsets(audio_samples, envelope, fs, nperseg=nperseg)
File "/Users/ffont/Developer/AudioCommons/timbral_models/timbral_models/Timbral_Hardness.py", line 510, in calculate_onsets
onset_strength_seg = onset_strength[current_strength_onset:]
TypeError: slice indices must be integers or None or have an __index__ method
When processing this sound: https://freesound.org/people/bone666138/sounds/198841/ both
timbral_brightness
andtimbral_hardness
models fail (the others work fine). Both return the same error, although it happens in different parts of the code and might be completely unrelated. This is the Python stack trace for the errors:timbral_brightness
timbral_hardness