File size: 1,261 Bytes
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
import whisper
from .compute_vps_score import compute_vps_score  # Ensure this path is correct

def main():
    # 🔧 Set your input audio file path here
    audio_path = r"D:\Intern\shankh\audio_samples\obama_short.wav"

    # 🔧 Choose Whisper model (tiny, base, small, medium, large)
    model_size = "base"

    print(f"Loading Whisper model: {model_size}")
    whisper_model = whisper.load_model(model_size)

    print(f"Analyzing audio: {audio_path}")
    try:
        vps_result = compute_vps_score(audio_path, whisper_model)
        
        print("\n--- Voice Pacing Score (VPS) ---")
        print(f"VPS Score: {vps_result['VPS']:.2f}")
        print(f"  - SRS (Speech Rate Stability): {vps_result['SRS']:.2f}")
        print(f"  - PAS (Pause Appropriateness): {vps_result['PAS']:.2f}")
        print(f"      - NPP: {vps_result['NPP']:.2f}")
        print(f"      - AFW: {vps_result['AFW']:.2f}")
        print(f"  - RCS (Rhythm Consistency): {vps_result['RCS']:.2f}")
        print(f"      - STR: {vps_result['STR']:.2f}")
        print(f"      - STW: {vps_result['STW']:.2f}")

        print("\nTranscript:")
        print(vps_result["transcript"])

    except Exception as e:
        print(f"[Error] {e}")

if __name__ == "__main__":
    main()