Spaces:
Sleeping
Sleeping
Reduce joy bias in prosodic analysis, add anger for high energy
Browse files- voice_detector.py +5 -5
voice_detector.py
CHANGED
|
@@ -202,14 +202,14 @@ class VoiceEmotionDetector:
|
|
| 202 |
pitch_var = 0.1
|
| 203 |
|
| 204 |
# Map features to emotions
|
| 205 |
-
# High energy + high pitch var →
|
| 206 |
if rms > 0.05 and pitch_var > 0.2:
|
| 207 |
-
scores[EmotionLabel.JOY] += 0.3
|
| 208 |
scores[EmotionLabel.SURPRISE] += 0.25
|
| 209 |
-
# High energy + low pitch var → possibly neutral-active
|
| 210 |
-
elif rms > 0.05:
|
| 211 |
-
scores[EmotionLabel.NEUTRAL] += 0.2
|
| 212 |
scores[EmotionLabel.JOY] += 0.15
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
# Low energy → sadness or calm
|
| 215 |
if rms < 0.02:
|
|
|
|
| 202 |
pitch_var = 0.1
|
| 203 |
|
| 204 |
# Map features to emotions
|
| 205 |
+
# High energy + high pitch var → surprise or joy
|
| 206 |
if rms > 0.05 and pitch_var > 0.2:
|
|
|
|
| 207 |
scores[EmotionLabel.SURPRISE] += 0.25
|
|
|
|
|
|
|
|
|
|
| 208 |
scores[EmotionLabel.JOY] += 0.15
|
| 209 |
+
# High energy + low pitch var → possibly neutral-active or anger
|
| 210 |
+
elif rms > 0.05:
|
| 211 |
+
scores[EmotionLabel.NEUTRAL] += 0.15
|
| 212 |
+
scores[EmotionLabel.ANGER] += 0.1
|
| 213 |
|
| 214 |
# Low energy → sadness or calm
|
| 215 |
if rms < 0.02:
|