Voice / voice_confidence_score /voice_confidence.py
mulasagg's picture
first
8031a8f
# voice confidence score = 0.4 * dominance + 0.3 * scs + 0.3 * fluency.
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):
# Calculate fluency score
print(f"Analyzing fluency for {audio_path}...")
results = compute_fluency_score(audio_path, whisper_model)
fluency_score = results['fluency_score']
return fluency_score
def calc_vcs(audio_path, whisper_model):
# Calculate voice clarity score
print(f"Analyzing voice clarity for {audio_path}...")
results = analyze_voice_quality(audio_path, whisper_model)
vcs = results['VCS']
return vcs
dominance = 5.6 # dummy for now i add later
def calc_voice_confidence_score(audio_path, model):
fluency_score = calc_fluency_score(audio_path, model)
vcs = calc_vcs(audio_path, model)
# Calculate voice confidence score
voice_confidence_score = 0.4 * dominance + 0.3 * vcs + 0.3 * fluency_score
return voice_confidence_score