Nabu-asr
Functions
sigproc.py File Reference

contains the signal processing functionality More...

Functions

def nabu.processing.processors.feature_computers.sigproc.framesig (sig, frame_len, frame_step, winfunc=lambda x:numpy.ones((x,)))
 Frame a signal into overlapping frames. More...
 
def nabu.processing.processors.feature_computers.sigproc.deframesig (frames, siglen, frame_len, frame_step, winfunc=lambda x:numpy.ones((x,)))
 Does overlap-add procedure to undo the action of framesig. More...
 
def nabu.processing.processors.feature_computers.sigproc.magspec (frames, nfft)
 Compute the magnitude spectrum of each frame in frames. More...
 
def nabu.processing.processors.feature_computers.sigproc.powspec (frames, nfft)
 Compute the power spectrum of each frame in frames. More...
 
def nabu.processing.processors.feature_computers.sigproc.logpowspec (frames, nfft, norm=1)
 Compute the log power spectrum of each frame in frames. More...
 
def nabu.processing.processors.feature_computers.sigproc.preemphasis (signal, coeff=0.95)
 perform preemphasis on the input signal. More...
 
def nabu.processing.processors.feature_computers.sigproc.snip (sig, rate, winlen, winstep)
 snip the edges of the utterance to fit the sliding window More...
 

Detailed Description

contains the signal processing functionality

The MIT License (MIT)

Copyright (c) 2013 James Lyons

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This file includes routines for basic signal processing including framing and computing power spectra.

Author
: James Lyons 2012

Function Documentation

§ deframesig()

def nabu.processing.processors.feature_computers.sigproc.deframesig (   frames,
  siglen,
  frame_len,
  frame_step,
  winfunc = lambda x: numpy.ones((x, )) 
)

Does overlap-add procedure to undo the action of framesig.

Parameters
framesarray of frames.
siglenlength of the desired signal, use 0 if unknown. Output will be truncated to siglen samples.
frame_lenlength of each frame measured in samples.
frame_stepnumber of samples after the start of the previous frame that the next frame should begin.
winfuncthe analysis window to apply to each frame. By default no window is applied.
Returns
a 1-D signal.

§ framesig()

def nabu.processing.processors.feature_computers.sigproc.framesig (   sig,
  frame_len,
  frame_step,
  winfunc = lambda x: numpy.ones((x, )) 
)

Frame a signal into overlapping frames.

Parameters
sigthe audio signal to frame.
frame_lenlength of each frame measured in samples.
frame_stepnumber of samples after the start of the previous frame that the next frame should begin.
winfuncthe analysis window to apply to each frame. By default no window is applied.
Returns
an array of frames. Size is NUMFRAMES by frame_len.

§ logpowspec()

def nabu.processing.processors.feature_computers.sigproc.logpowspec (   frames,
  nfft,
  norm = 1 
)

Compute the log power spectrum of each frame in frames.

If frames is an NxD matrix, output will be NxNFFT.

Parameters
framesthe array of frames. Each row is a frame.
nfftthe FFT length to use. If NFFT > frame_len, the frames are zero-padded.
normIf norm=1, the log power spectrum is normalised so that the max value (across all frames) is 1.
Returns
If frames is an NxD matrix, output will be NxNFFT. Each row will be the log power spectrum of the corresponding frame.

§ magspec()

def nabu.processing.processors.feature_computers.sigproc.magspec (   frames,
  nfft 
)

Compute the magnitude spectrum of each frame in frames.

If frames is an NxD matrix, output will be NxNFFT.

Parameters
framesthe array of frames. Each row is a frame.
nfftthe FFT length to use. If NFFT > frame_len, the frames are zero-padded.
Returns
If frames is an NxD matrix, output will be NxNFFT. Each row will be the magnitude spectrum of the corresponding frame.

§ powspec()

def nabu.processing.processors.feature_computers.sigproc.powspec (   frames,
  nfft 
)

Compute the power spectrum of each frame in frames.

If frames is an NxD matrix, output will be NxNFFT.

Parameters
framesthe array of frames. Each row is a frame.
nfftthe FFT length to use. If NFFT > frame_len, the frames are zero-padded.
Returns
If frames is an NxD matrix, output will be NxNFFT. Each row will be the power spectrum of the corresponding frame.

§ preemphasis()

def nabu.processing.processors.feature_computers.sigproc.preemphasis (   signal,
  coeff = 0.95 
)

perform preemphasis on the input signal.

Parameters
signalThe signal to filter.
coeffThe preemphasis coefficient. 0 is no filter, default is 0.95.
Returns
the filtered signal.

§ snip()

def nabu.processing.processors.feature_computers.sigproc.snip (   sig,
  rate,
  winlen,
  winstep 
)

snip the edges of the utterance to fit the sliding window

Parameters
sigaudio signal
ratesampling rate
winlenlength of the sliding window [s]
winstepstepsize of the sliding window [s]
Returns
the snipped signal