Skip to content

Commit

Permalink
accept f_max and f_min for better compatibility with librosa
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 authored and soumith committed Feb 3, 2019
1 parent 3c3ce99 commit a14c299
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ __pycache__/
*.py[cod]
*$py.class

# temp files
~*
*.swp

# C extensions / folders
*.so
_ext/
Expand Down
6 changes: 3 additions & 3 deletions torchaudio/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class MEL2(object):
>>> sig, sr = torchaudio.load("test.wav", normalization=True)
>>> spec_mel = transforms.MEL2(sr)(sig) # (c, l, m)
"""
def __init__(self, sr=16000, ws=400, hop=None, n_fft=None,
def __init__(self, sr=16000, ws=400, hop=None, n_fft=None, fmin=0., fmax=None,
pad=0, n_mels=40, window=torch.hann_window, wkwargs=None):
self.window = window
self.sr = sr
Expand All @@ -317,8 +317,8 @@ def __init__(self, sr=16000, ws=400, hop=None, n_fft=None,
self.n_mels = n_mels # number of mel frequency bins
self.wkwargs = wkwargs
self.top_db = -80.
self.f_max = None
self.f_min = 0.
self.f_max = fmax
self.f_min = fmin
self.spec = SPECTROGRAM(self.ws, self.hop, self.n_fft,
self.pad, self.window, self.wkwargs)
self.fm = F2M(self.n_mels, self.sr, self.f_max, self.f_min)
Expand Down

0 comments on commit a14c299

Please sign in to comment.