tyiannak / pyAudioAnalysis

Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications
Apache License 2.0
5.76k stars 1.18k forks source link

Probably incorrect calculation of window ratio in mid_feature_extraction() #306

Closed tluocs closed 3 years ago

tluocs commented 3 years ago

It seems that the mid_feature_extraction(), as in the MidTermFeatures module, contains an error in computing the ratio between the mid-term window and the short-term window. Details below.

def mid_feature_extraction(signal, sampling_rate, mid_window, mid_step, short_window, short_step): ... mid_window_ratio = int(round(mid_window / short_step))

I think the above line (Line 96) should be corrected to: mid_window_ratio = round( (mid_window - (short_window - short_step)) / short_step )

tyiannak commented 3 years ago

Thanx indeed there were some more short-term windows included in the mid-sized segments, in case short-term window length was > short-term window step (overlapping short-term frames case)

Fixed in https://github.com/tyiannak/pyAudioAnalysis/commit/f7f170daffb51a2f83eef0dd4a6c31e075b49dfe