Fixed an error
Browse files- feature_extraction.py +1 -9
feature_extraction.py
CHANGED
@@ -32,17 +32,9 @@ short_field = Fields[2:]
|
|
32 |
def all_feature_extraction(audio_path, sample_rate=22050):
|
33 |
data_list = []
|
34 |
val_field = []
|
35 |
-
|
36 |
-
try:
|
37 |
-
audio_df, sr = sf.read(audio_path)
|
38 |
-
print("Audio loaded successfully.")
|
39 |
-
print("Shape of audio data:", audio_df.shape)
|
40 |
-
print("Sample rate:", sr)
|
41 |
-
except Exception as e:
|
42 |
-
print("Error loading audio file:", e)
|
43 |
data_list.append(audio_path)
|
44 |
data_list.append(len(audio_df))
|
45 |
-
print(data_list)
|
46 |
|
47 |
# 1. Chroma STFT
|
48 |
chroma_stft = librosa.feature.chroma_stft(y=audio_df, hop_length=512)
|
|
|
32 |
def all_feature_extraction(audio_path, sample_rate=22050):
|
33 |
data_list = []
|
34 |
val_field = []
|
35 |
+
audio_df, sr = librosa.load(audio_path, sr=22050)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
data_list.append(audio_path)
|
37 |
data_list.append(len(audio_df))
|
|
|
38 |
|
39 |
# 1. Chroma STFT
|
40 |
chroma_stft = librosa.feature.chroma_stft(y=audio_df, hop_length=512)
|