Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logfbank missing energy #59

Open
bhigy opened this issue Mar 21, 2018 · 2 comments
Open

logfbank missing energy #59

bhigy opened this issue Mar 21, 2018 · 2 comments

Comments

@bhigy
Copy link

bhigy commented Mar 21, 2018

Hi there,

I was wondering if there is a reason why the output of fbank and logfbank functions don't return both the energy. I usually use logfbank features with energy, which obliges me to redefine logfbank while it would be very easy to return the energy as well.

Thanks,
Bertrand

@shuttle1987
Copy link
Contributor

As you can see here:

def logfbank(signal,samplerate=16000,winlen=0.025,winstep=0.01,
nfilt=26,nfft=512,lowfreq=0,highfreq=None,preemph=0.97,
winfunc=lambda x:numpy.ones((x,))):
"""Compute log Mel-filterbank energy features from an audio signal.
:param signal: the audio signal from which to compute features. Should be an N*1 array
:param samplerate: the samplerate of the signal we are working with.
:param winlen: the length of the analysis window in seconds. Default is 0.025s (25 milliseconds)
:param winstep: the step between successive windows in seconds. Default is 0.01s (10 milliseconds)
:param nfilt: the number of filters in the filterbank, default 26.
:param nfft: the FFT size. Default is 512.
:param lowfreq: lowest band edge of mel filters. In Hz, default is 0.
:param highfreq: highest band edge of mel filters. In Hz, default is samplerate/2
:param preemph: apply preemphasis filter with preemph as coefficient. 0 is no filter. Default is 0.97.
: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
:returns: A numpy array of size (NUMFRAMES by nfilt) containing features. Each row holds 1 feature vector.
"""
feat,energy = fbank(signal,samplerate,winlen,winstep,nfilt,nfft,lowfreq,highfreq,preemph,winfunc)
return numpy.log(feat)

The function just calls fbank so perhaps a workaround is just to call fbank directly yourself and use numpy.log on the result ?

@bhigy
Copy link
Author

bhigy commented Sep 11, 2018

Sure, that's actually how I solved the problem. But I think it wouldn't harm and would be more consistent to return it in both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants