Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1271,12 +1271,12 @@ class MentorEvaluator:
|
|
| 1271 |
features['pitch_mean'] = float(np.mean(valid_f0)) if len(valid_f0) > 0 else 0.0
|
| 1272 |
features['pitch_std'] = float(np.std(valid_f0)) if len(valid_f0) > 0 else 0.0
|
| 1273 |
|
| 1274 |
-
# Rhythm features using hamming
|
| 1275 |
onset_env = librosa.onset.onset_strength(
|
| 1276 |
y=audio,
|
| 1277 |
sr=sr,
|
| 1278 |
hop_length=hop_length,
|
| 1279 |
-
window='hamming'
|
| 1280 |
)
|
| 1281 |
tempo, _ = librosa.beat.beat_track(
|
| 1282 |
onset_envelope=onset_env,
|
|
@@ -1285,13 +1285,13 @@ class MentorEvaluator:
|
|
| 1285 |
)
|
| 1286 |
features['rhythm_regularity'] = float(tempo)
|
| 1287 |
|
| 1288 |
-
# Efficient spectral feature extraction with
|
| 1289 |
mfcc = librosa.feature.mfcc(
|
| 1290 |
y=audio,
|
| 1291 |
sr=sr,
|
| 1292 |
n_mfcc=13,
|
| 1293 |
hop_length=hop_length,
|
| 1294 |
-
window='hamming'
|
| 1295 |
)
|
| 1296 |
features['spectral_variance'] = float(np.mean(np.std(mfcc, axis=1)))
|
| 1297 |
|
|
|
|
| 1271 |
features['pitch_mean'] = float(np.mean(valid_f0)) if len(valid_f0) > 0 else 0.0
|
| 1272 |
features['pitch_std'] = float(np.std(valid_f0)) if len(valid_f0) > 0 else 0.0
|
| 1273 |
|
| 1274 |
+
# Rhythm features using window='hann' instead of hamming
|
| 1275 |
onset_env = librosa.onset.onset_strength(
|
| 1276 |
y=audio,
|
| 1277 |
sr=sr,
|
| 1278 |
hop_length=hop_length,
|
| 1279 |
+
window='hann' # Changed from 'hamming' to 'hann'
|
| 1280 |
)
|
| 1281 |
tempo, _ = librosa.beat.beat_track(
|
| 1282 |
onset_envelope=onset_env,
|
|
|
|
| 1285 |
)
|
| 1286 |
features['rhythm_regularity'] = float(tempo)
|
| 1287 |
|
| 1288 |
+
# Efficient spectral feature extraction with hann window
|
| 1289 |
mfcc = librosa.feature.mfcc(
|
| 1290 |
y=audio,
|
| 1291 |
sr=sr,
|
| 1292 |
n_mfcc=13,
|
| 1293 |
hop_length=hop_length,
|
| 1294 |
+
window='hann' # Changed from 'hamming' to 'hann'
|
| 1295 |
)
|
| 1296 |
features['spectral_variance'] = float(np.mean(np.std(mfcc, axis=1)))
|
| 1297 |
|