File size: 1,256 Bytes
8ad2ab3
 
 
 
 
 
 
aef3b1e
8ad2ab3
 
 
aef3b1e
8ad2ab3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aef3b1e
8ad2ab3
aef3b1e
 
 
 
8ad2ab3
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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, filler_count=None):

 # Calculate fluency score
    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):


    # 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, 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)

    # Calculate voice confidence score
    voice_confidence_score = 0.4 * dominance + 0.3 * vcs + 0.3 * fluency_score

    return voice_confidence_score