AI for Mental Health
Depression Screening from Speech
Acoustic Features
import librosa
import numpy as np
class SpeechDepressionAnalyzer:
def extract_features(self, audio_path, sr=16000):
y, _ = librosa.load(audio_path, sr=sr)
f0, _, _ = librosa.pyin(y, fmin=50, f0_max=500)
mfcc = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=13)
intervals = librosa.effects.split(y, top_db=30)
pause_durations = np.diff(intervals) / sr
return {
'f0_mean': np.nanmean(f0), 'f0_std': np.nanstd(f0),
'mfcc_mean': np.mean(mfcc, axis=1),
'avg_pause': np.mean(pause_durations)
}
Anxiety Detection
Behavioral Markers
- Speech patterns: Increased rate, higher pitch variability
- Language use: More self-referential pronouns
- Physiological: Heart rate variability, skin conductance
Multi-Modal Assessment
Therapy Chatbots
CBT Framework
- Identify negative thought patterns
- Challenge cognitive distortions
- Replace with balanced thoughts
- Practice behavioral activation
PHQ-9 Scoring
| Score | Severity |
|---|---|
| 0-4 | Minimal |
| 5-9 | Mild |
| 10-14 | Moderate |
| 15-19 | Moderately Severe |
| 20-27 | Severe |