diff --git a/utils/audio.py b/utils/audio.py index b9efffd..b7e0067 100644 --- a/utils/audio.py +++ b/utils/audio.py @@ -21,7 +21,7 @@ def print_stats(waveform, sample_rate=None, src=None): print(f" - Max: {waveform.max().item():6.3f}") print(f" - Min: {waveform.min().item():6.3f}") print(f" - Mean: {waveform.mean().item():6.3f}") - print(f" - Std Dev: {waveform.std().item():6.3f}") + print(f" - Std Dev: {waveform.std().item():6.3f}") print() print(waveform) print() @@ -32,7 +32,7 @@ def plot_waveform(waveform, sample_rate, title="Waveform", xlim=None, ylim=None) num_channels, num_frames = waveform.shape time_axis = torch.arange(0, num_frames) / sample_rate - figure, axes = plt.subplots(num_channels, 1) + figure, axes = plt.subplots(num_channels, 1, figsize=(12, 3*num_channels)) if num_channels == 1: axes = [axes] for c in range(num_channels): @@ -53,7 +53,7 @@ def plot_specgram(waveform, sample_rate, title="Spectrogram", xlim=None): num_channels, num_frames = waveform.shape time_axis = torch.arange(0, num_frames) / sample_rate - figure, axes = plt.subplots(num_channels, 1) + figure, axes = plt.subplots(num_channels, 1, figsize=(12, 3*num_channels)) if num_channels == 1: axes = [axes] for c in range(num_channels): @@ -84,7 +84,7 @@ def inspect_file(path): print(f" - {torchaudio.info(path)}") def plot_spectrogram(spec, title=None, ylabel='freq_bin', aspect='auto', xmax=None): - fig, axs = plt.subplots(1, 1) + fig, axs = plt.subplots(1, 1, figsize=(12, 3)) axs.set_title(title or 'Spectrogram (db)') axs.set_ylabel(ylabel) axs.set_xlabel('frame')