Skip to content

Commit ad0de0a

Browse files
committed
change appearance of spectrogram plot
1 parent 44733d0 commit ad0de0a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

InferenceInterfaces/ToucanTTSInterface.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def forward(self,
281281

282282
if view or return_plot_as_filepath:
283283
from Utility.utils import cumsum_durations
284-
fig, ax = plt.subplots(nrows=2, ncols=1, figsize=(9, 6))
284+
fig, ax = plt.subplots(nrows=2, ncols=1, figsize=(9, 4))
285285
ax[0].plot(wave.cpu().numpy())
286286
lbd.specshow(mel.cpu().numpy(),
287287
ax=ax[1],
@@ -339,7 +339,7 @@ def forward(self,
339339
return wave, f"{plot_name}.png"
340340
if view_contours:
341341
from Utility.utils import cumsum_durations
342-
fig, ax = plt.subplots(figsize=(9,6))
342+
fig, ax = plt.subplots(figsize=(8,4))
343343
lbd.specshow(mel.cpu().numpy(),
344344
ax=ax,
345345
sr=16000,
@@ -356,7 +356,7 @@ def forward(self,
356356
phones = text.replace(" ", "|")
357357
else:
358358
phones = self.text2phone.get_phone_string(text, for_plot_labels=True)
359-
ax.set_xticklabels(phones)
359+
ax.set_xticklabels(phones, fontsize=28)
360360
word_boundaries = list()
361361
for label_index, phone in enumerate(phones):
362362
if phone == "|":
@@ -370,31 +370,31 @@ def forward(self,
370370
prev_word_boundary = word_boundary
371371
word_label_positions.append((duration_splits[-1] + prev_word_boundary) / 2)
372372

373-
secondary_ax = ax.secondary_xaxis('bottom')
374-
secondary_ax.tick_params(axis="x", direction="out", pad=24)
375-
secondary_ax.set_xticks(word_label_positions, minor=False)
376-
secondary_ax.set_xticklabels(text.split())
377-
secondary_ax.tick_params(axis='x', colors='black', labelsize=16)
378-
secondary_ax.xaxis.label.set_color('black')
373+
#secondary_ax = ax.secondary_xaxis('bottom')
374+
#secondary_ax.tick_params(axis="x", direction="out", pad=24)
375+
#secondary_ax.set_xticks(word_label_positions, minor=False)
376+
#secondary_ax.set_xticklabels(text.split())
377+
#secondary_ax.tick_params(axis='x', colors='black', labelsize=16)
378+
#secondary_ax.xaxis.label.set_color('black')
379379
except ValueError:
380380
ax.set_title(text)
381381
except IndexError:
382382
ax.set_title(text)
383383

384384
#ax.vlines(x=duration_splits, colors="black", linestyles="dotted", ymin=0.0, ymax=8000, linewidth=1.0)
385-
ax.vlines(x=word_boundaries, colors="black", linestyles="solid", ymin=0.0, ymax=8000, linewidth=1.2)
385+
#ax.vlines(x=word_boundaries, colors="black", linestyles="solid", ymin=0.0, ymax=8000, linewidth=1.2)
386386
pitch_array = pitch.cpu().numpy()
387387
for pitch_index, xrange in enumerate(zip(duration_splits[:-1], duration_splits[1:])):
388388
if pitch_array[pitch_index] != 0:
389389
ax.hlines(pitch_array[pitch_index] * 1000, xmin=xrange[0], xmax=xrange[1], color="red",
390-
linestyles="solid", linewidth=2.5)
390+
linestyles="solid", linewidth=5)
391391
#energy_array = energy.cpu().numpy()
392392
#for energy_index, xrange in enumerate(zip(duration_splits[:-1], duration_splits[1:])):
393393
# if energy_array[energy_index] != 0:
394394
# ax.hlines(energy_array[energy_index] * 1000, xmin=xrange[0], xmax=xrange[1], color="orange",
395395
# linestyles="solid", linewidth=2.5)
396396
plt.subplots_adjust(left=0.05, bottom=0.12, right=0.95, top=.9, wspace=0.0, hspace=0.0)
397-
plt.savefig(f"{plot_name}.png")
397+
plt.savefig(f"{plot_name}.pdf", format="pdf")
398398
plt.close()
399399
return wave
400400

0 commit comments

Comments
 (0)