Skip to content

Commit

Permalink
Change mfcc transformation to kaldi
Browse files Browse the repository at this point in the history
  • Loading branch information
yeexunwei committed Oct 17, 2021
1 parent 6e79638 commit 5276acc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 5276acc

Please sign in to comment.