catiR
commited on
Commit
·
8827531
1
Parent(s):
7066115
run clustering
Browse files
scripts/clusterprosody.py
CHANGED
@@ -423,8 +423,8 @@ def get_audio_part(start_time, end_time, id, path):
|
|
423 |
|
424 |
def plot_pitch_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id, voice):
|
425 |
colors = ["red", "green", "blue", "orange", "purple", "pink", "brown", "gray", "cyan"]
|
426 |
-
|
427 |
-
fig = plt.figure(figsize=(
|
428 |
plt.title(f"{words} - Pitch - Cluster {cluster_id}")
|
429 |
for k,v in speech_data.items():
|
430 |
|
@@ -447,12 +447,12 @@ def plot_pitch_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id,
|
|
447 |
if len(word_times)>2:
|
448 |
for i in range(1,len(word_times)-1):
|
449 |
bound_line = np.mean([word_times[i][2],word_times[i+1][1]])
|
450 |
-
plt.axvline(x=bound_line, color=colors[
|
451 |
|
452 |
-
plt.scatter(pitch_xvals, pitches, color=colors[
|
453 |
-
|
454 |
-
if
|
455 |
-
|
456 |
|
457 |
tpitches = [p for p,e in tts_data]
|
458 |
t_xvals = [x*0.005 for x in range(len(tpitches))]
|
@@ -469,7 +469,7 @@ def plot_pitch_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id,
|
|
469 |
plt.scatter(t_xvals, tpitches, color="black", label=f"TTS {voice}")
|
470 |
|
471 |
|
472 |
-
plt.legend()
|
473 |
#plt.show()
|
474 |
|
475 |
|
|
|
423 |
|
424 |
def plot_pitch_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id, voice):
|
425 |
colors = ["red", "green", "blue", "orange", "purple", "pink", "brown", "gray", "cyan"]
|
426 |
+
cc = 0
|
427 |
+
fig = plt.figure(figsize=(10, 5))
|
428 |
plt.title(f"{words} - Pitch - Cluster {cluster_id}")
|
429 |
for k,v in speech_data.items():
|
430 |
|
|
|
447 |
if len(word_times)>2:
|
448 |
for i in range(1,len(word_times)-1):
|
449 |
bound_line = np.mean([word_times[i][2],word_times[i+1][1]])
|
450 |
+
plt.axvline(x=bound_line, color=colors[cc], linestyle='--', linewidth=1, label=f"Speaker {spk} -> {word_times[i+1][0]}")
|
451 |
|
452 |
+
plt.scatter(pitch_xvals, pitches, color=colors[cc], label=f"Speaker {spk}")
|
453 |
+
cc += 1
|
454 |
+
if cc >= len(colors):
|
455 |
+
cc=0
|
456 |
|
457 |
tpitches = [p for p,e in tts_data]
|
458 |
t_xvals = [x*0.005 for x in range(len(tpitches))]
|
|
|
469 |
plt.scatter(t_xvals, tpitches, color="black", label=f"TTS {voice}")
|
470 |
|
471 |
|
472 |
+
#plt.legend()
|
473 |
#plt.show()
|
474 |
|
475 |
|