Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd07c3e

Browse filesBrowse files
authored
updated base.py. (winfunc added in logfbank)
Previously I was using fbank for feature extraction. Then when I found that when I used log on the Fbank the accuracy of the model was better. But I was using hamming frame on windows for feature extraction, because of this I was taking log after implementing fbank. So it would be better if we have a choice to apply window function while using logfbank function as well.
1 parent e51df9e commit cd07c3e
Copy full SHA for cd07c3e

1 file changed

+4-2Lines changed: 4 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python_speech_features/base.py‎

Copy file name to clipboardExpand all lines: python_speech_features/base.py
+4-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.