update spectrogram, test=asr

pull/1612/head
huangyuxin 4 years ago
parent 0ffe1f9114
commit ed490b66cb

@ -3,9 +3,8 @@ process:
- type: fbank_kaldi - type: fbank_kaldi
fs: 16000 fs: 16000
n_mels: 80 n_mels: 80
n_frame_length: 25 n_shift: 160
n_frame_shift: 10 win_length: 400
energy_floor: 0.0
dither: 0.1 dither: 0.1
- type: cmvn_json - type: cmvn_json
cmvn_path: data/mean_std.json cmvn_path: data/mean_std.json

@ -312,17 +312,33 @@ class IStft():
class LogMelSpectrogramKaldi(): class LogMelSpectrogramKaldi():
def __init__(self, def __init__(
fs=16000, self,
n_mels=80, fs=16000,
n_frame_length=25, n_mels=80,
n_frame_shift=10, n_shift=160, # unit:sample, 10ms
energy_floor=0.0, win_length=400, # unit:sample, 25ms
dither=0.1): energy_floor=0.0,
dither=0.1):
"""
The Kaldi implementation of LogMelSpectrogram
Args:
fs (int): sample rate of the audio
n_mels (int): number of mel filter banks
n_shift (int): number of points in a frame shift
win_length (int): number of points in a frame windows
energy_floor (float): Floor on energy in Spectrogram computation (absolute)
dither (float): Dithering constant
Returns:
LogMelSpectrogramKaldi
"""
self.fs = fs self.fs = fs
self.n_mels = n_mels self.n_mels = n_mels
self.n_frame_length = n_frame_length num_point_ms = fs / 1000
self.n_frame_shift = n_frame_shift self.n_frame_length = win_length / num_point_ms
self.n_frame_shift = n_shift / num_point_ms
self.energy_floor = energy_floor self.energy_floor = energy_floor
self.dither = dither self.dither = dither

Loading…
Cancel
Save