|
|
|
|
|
import whisper |
|
from fluency.compute_fluency import compute_fluency_score |
|
from vcs.compute_vcs import analyze_voice_quality |
|
|
|
|
|
def calc_fluency_score(audio_path, whisper_model, filler_count=None): |
|
|
|
|
|
print(f"Analyzing fluency for {audio_path}...") |
|
results = compute_fluency_score(audio_path, whisper_model, filler_count) |
|
fluency_score = results['fluency_score'] |
|
|
|
return fluency_score |
|
|
|
def calc_vcs(audio_path, whisper_model): |
|
|
|
|
|
|
|
print(f"Analyzing voice clarity for {audio_path}...") |
|
results = analyze_voice_quality(audio_path, whisper_model) |
|
vcs = results['VCS'] |
|
|
|
return vcs |
|
|
|
dominance = 5.6 |
|
|
|
def calc_voice_confidence_score(audio_path, model, filler_count= None, fluency_score=None): |
|
|
|
if fluency_score is None: |
|
print(' No args passed Calling calc_fluency_score') |
|
fluency_score = calc_fluency_score(audio_path, model, filler_count) |
|
|
|
vcs = calc_vcs(audio_path, model) |
|
|
|
|
|
voice_confidence_score = 0.4 * dominance + 0.3 * vcs + 0.3 * fluency_score |
|
|
|
return voice_confidence_score |
|
|
|
|