Skip to content

Commit 4b2ac00

Browse files
authored
Merge pull request #67 from mr-yamraj/master
updated base.py. (winfunc added in logfbank)
2 parents e51df9e + cd07c3e commit 4b2ac00

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

python_speech_features/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def fbank(signal,samplerate=16000,winlen=0.025,winstep=0.01,
6464
return feat,energy
6565

6666
def logfbank(signal,samplerate=16000,winlen=0.025,winstep=0.01,
67-
nfilt=26,nfft=512,lowfreq=0,highfreq=None,preemph=0.97):
67+
nfilt=26,nfft=512,lowfreq=0,highfreq=None,preemph=0.97,
68+
winfunc=lambda x:numpy.ones((x,))):
6869
"""Compute log Mel-filterbank energy features from an audio signal.
6970
7071
:param signal: the audio signal from which to compute features. Should be an N*1 array
@@ -76,9 +77,10 @@ def logfbank(signal,samplerate=16000,winlen=0.025,winstep=0.01,
7677
:param lowfreq: lowest band edge of mel filters. In Hz, default is 0.
7778
:param highfreq: highest band edge of mel filters. In Hz, default is samplerate/2
7879
:param preemph: apply preemphasis filter with preemph as coefficient. 0 is no filter. Default is 0.97.
80+
:param winfunc: the analysis window to apply to each frame. By default no window is applied. You can use numpy window functions here e.g. winfunc=numpy.hamming
7981
:returns: A numpy array of size (NUMFRAMES by nfilt) containing features. Each row holds 1 feature vector.
8082
"""
81-
feat,energy = fbank(signal,samplerate,winlen,winstep,nfilt,nfft,lowfreq,highfreq,preemph)
83+
feat,energy = fbank(signal,samplerate,winlen,winstep,nfilt,nfft,lowfreq,highfreq,preemph,winfunc)
8284
return numpy.log(feat)
8385

8486
def ssc(signal,samplerate=16000,winlen=0.025,winstep=0.01,

0 commit comments

Comments
 (0)