tyiannak / pyAudioAnalysis

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

cannot reshape array of size 28800 into shape (480,10) #389

Open ohpage opened 11 months ago

ohpage commented 11 months ago

details as below

ValueError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_5940\2340920530.py in 4 if os.path.isdir(f'{test}{directory}'): 5 features, files, f_names = dir_feat_extract(f'{test}{directory}', 0.2, 0.2, ----> 6 0.1, 0.1, 1) 7 feature_list = np.append(feature_list, features.reshape(-1,138), axis=0) 8 file_list = file_list + files

~\AppData\Local\Temp\ipykernel_5940\3681827919.py in dir_feat_extract(folder_path, mid_window, mid_step, short_window, short_step, duration, compute_beat) 53 round(mid_step sampling_rate), 54 round(sampling_rate short_window), ---> 55 round(sampling_rate * short_step)) 56 beat, beat_conf = MidTermFeatures.beat_extraction(short_features, short_step) 57 else:

d:\ProgramData\Anaconda3\lib\site-packages\pyAudioAnalysis\MidTermFeatures.py in mid_feature_extraction(signal, sampling_rate, mid_window, mid_step, short_window, short_step) 93 short_features, short_feature_names = \ 94 ShortTermFeatures.feature_extraction(signal, sampling_rate, ---> 95 short_window, short_step) 96 97 n_stats = 2

d:\ProgramData\Anaconda3\lib\site-packages\pyAudioAnalysis\ShortTermFeatures.py in feature_extraction(signal, sampling_rate, window, step, deltas) 633 634 # short-term entropy of energy --> 635 feature_vector[2] = energy_entropy(x) 636 637 # sp centroid/spread

d:\ProgramData\Anaconda3\lib\site-packages\pyAudioAnalysis\ShortTermFeatures.py in energy_entropy(frame, n_short_blocks) 42 43 # sub_wins is of size [n_short_blocks x L] ---> 44 sub_wins = frame.reshape(sub_win_len, n_short_blocks, order='F').copy() 45 46 # Compute normalized sub-frame energies:

ValueError: cannot reshape array of size 28800 into shape (480,10)

ohpage commented 11 months ago

I solved when i changed directory_feature_extract func(to dir_feat_extract), set new variable 'duration', already used in func.