-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (34 loc) · 1.16 KB
/
main.py
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
from pure_voice_processing import voice_metric
import librosa
import numpy as np
class VoiceModel:
def __init__(self):
pass
def get_reaction_score(self, wav_data:np.ndarray):
"""
Process Reaction score
:wav_data: Input voice data, read by librosa
"""
return voice_metric.get_reaction_score(wav_data)
def get_loudness_score(self, wav_data:np.ndarray):
"""
Process Loudness score
:wav_data: Input voice data, read by librosa
"""
return voice_metric.get_loudness_score(wav_data)
def get_tempo_score(self, wav_data:np.ndarray):
"""
Process Tempo score
:wav_data: Input voice data, read by librosa
"""
return voice_metric.get_tempo_score(wav_data)
def predict(self, wav_data:np.ndarray):
"""
Process predict all score
:wav_data: Input voice data, read by librosa
"""
return {
"score_reaction": voice_metric.get_reaction_score(wav_data),
"score_tempo": voice_metric.get_tempo_score(wav_data),
"score_loudness": voice_metric.get_loudness_score(wav_data)
}