Update graph.py
Browse files
graph.py
CHANGED
@@ -26,18 +26,12 @@ def normalise_transcript(xcp):
|
|
26 |
|
27 |
|
28 |
def get_pitch_tracks(wav_path):
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
f0_data = [[t,f0] for t,prob,f0 in f0_data if prob==1.0]
|
36 |
-
return f0_data
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
|
42 |
|
43 |
# transcript could be from a corpus with the wav file,
|
@@ -45,6 +39,9 @@ def get_pitch_tracks(wav_path):
|
|
45 |
# or from a previous speech recognition process
|
46 |
def align_and_graph(wav_path, transcript, aligner_function):
|
47 |
|
|
|
|
|
|
|
48 |
# fetch data
|
49 |
speech = readwav(wav_path)
|
50 |
w_align, seg_align = aligner_function(speech,normalise_transcript(transcript))
|
@@ -106,7 +103,6 @@ def align_and_graph(wav_path, transcript, aligner_function):
|
|
106 |
|
107 |
return fig
|
108 |
|
109 |
-
#plt.close('all')
|
110 |
|
111 |
|
112 |
# uppboðssøla bussleiðini viðmerkingar upprunaligur
|
|
|
26 |
|
27 |
|
28 |
def get_pitch_tracks(wav_path):
|
29 |
+
f0_data = subprocess.run(["REAPER/build/reaper", "-i", wav_path, '-f', '/dev/stdout', '-a'],capture_output=True).stdout
|
30 |
+
f0_data = f0_data.decode().split('EST_Header_End\n')[1].splitlines()
|
31 |
+
#print(f0_data) #!!!!!!!!!!!!!!!!!!!!!
|
32 |
+
f0_data = [l.split(' ') for l in f0_data[:-1]] # the last line is other info
|
33 |
+
f0_data = [ [float(t), float(f)] for t,v,f in f0_data if v=='1']
|
34 |
+
return f0_data
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
|
37 |
# transcript could be from a corpus with the wav file,
|
|
|
39 |
# or from a previous speech recognition process
|
40 |
def align_and_graph(wav_path, transcript, aligner_function):
|
41 |
|
42 |
+
plt.close('all')
|
43 |
+
|
44 |
+
|
45 |
# fetch data
|
46 |
speech = readwav(wav_path)
|
47 |
w_align, seg_align = aligner_function(speech,normalise_transcript(transcript))
|
|
|
103 |
|
104 |
return fig
|
105 |
|
|
|
106 |
|
107 |
|
108 |
# uppboðssøla bussleiðini viðmerkingar upprunaligur
|