Install fftw3 on your OS:
OSX (Homebrew):
brew install fftw
Ubuntu:
sudo apt-get install libfftw3
Install torch-signal:
luarocks install https://raw.github.com/soumith/torch-signal/master/rocks/signal-scm-1.rockspec
(add sudo for ubuntu)
For documentation, go to: http://soumith.github.io/torch-signal/signal/
For examples, see tests/
All functions in here expect either a 2D Nx2 Complex tensor
Polynomial with specified roots
Function is super unoptimized
1D FFT Takes Real inputs (1D tensor of N points) or complex inputs 2D tensor of (Nx2) size for N points
Output matches with matlab output
inverse 1D FFT Takes Real inputs (1D tensor of N points) or complex inputs 2D tensor of (Nx2) size for N points
Output matches with matlab output
real to complex dft. This function retains only the positive frequencies. Input is a 1D real tensor Output is 2D complex tensor of size (input:size(1)/2 + 1, 2)
complex to real dft. This function is the exact inverse of signal.rfft
2D FFT Takes Real inputs (2D tensor of NxM points) or complex inputs 3D tensor of (NxMx2) size for NxM points
Output matches with matlab output
2D Inverse FFT Takes Real inputs (2D tensor of NxM points) or complex inputs 3D tensor of (NxMx2) size for NxM points
Output matches with matlab output
3D FFT Takes Real inputs (3D tensor of NxMxP points) or complex inputs 4D tensor of (NxMxPx2) size for NxMxP points
Output matches with matlab output
3D Inverse FFT Takes Real inputs (3D tensor of NxMxP points) or complex inputs 4D tensor of (NxMxPx2) size for NxMxP points
Output matches with matlab output
returns an L-point Hann window in a 1D tensor. L must be a positive integer. When 'periodic' is specified, hann computes a length L+1 window and returns the first L points. flag: 'periodic' or 'symmetric'. 'symmetric' is default
Output matches with matlab output
returns an N-point Blackman window in a 1D tensor. N must be a positive integer. When 'periodic' is specified, computes a length N+1 window and returns the first N points. flag: 'periodic' or 'symmetric'. 'symmetric' is default
Output matches with matlab output
returns an N-point minimum 4-term Blackman-Harris window in a 1D tensor.
The window is minimum in the sense that its maximum sidelobes are minimized.
N must be a positive integer.
flag: 'periodic' or 'symmetric'. 'symmetric' is default
Output matches with matlab output
1D complex short-time fourier transforms Run a window across your signal and calculate fourier transforms on that window. To make sure that the windows are not discontinuous at the edges, you can optionally apply a window preprocessor. The available window preprocessors are: hamming, hann, bartlett
1D real short-time fourier transforms Run a window across your signal and calculate fourier transforms on that window. To make sure that the windows are not discontinuous at the edges, you can optionally apply a window preprocessor. rfft is used for fourier transform, so only the positive frequencies are retained The available window preprocessors are: hamming, hann, bartlett
Takes the rstft(x) and generates a pretty spectrogram by taking the magnitude of the stft, and applying a (natural log * 10) Also transposes the output, to have time on the X axis.
Correct phase angles to produce smoother phase plots
Unwrap radian phases by adding multiples of 2*pi as appropriate to
remove jumps greater than tol. tol defaults to pi.
Output matches with matlab output
unwraps the phase and removes phase corresponding to integer lag.
Output matches with matlab output
Adds phase corresponding to integer lag
Output matches with matlab output
1D Complex cepstral analysis Returns the cepstrum and a phase shift factor "nd" that is useful to invert the signal back.
Output matches with matlab output
1D Inverse Complex cepstral analysis. Takes in the outputs of cceps to produce the input signal back
Output matches with matlab output
Real cepstrum and minimum phase reconstruction The real cepstrum is the inverse Fourier transform of the real logarithm of the magnitude of the Fourier transform of a sequence.
Output matches with matlab output
1D Discrete Cosine Transform (DCT) Takes Real inputs (1D tensor of N points)
To see what is exactly computed, see section REDFT10 over here: http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html
inverse 1D Discrete Cosine Transform (DCT) Takes Real inputs (1D tensor of N points)
To see what is exactly computed, see section REDFT01 over here: http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html
2D Discrete Cosine Transform (DCT) Takes Real inputs (2D tensor of NxM points)
To see what is exactly computed, see section REDFT10 over here: http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html
inverse 2D Discrete Cosine Transform (DCT) Takes Real inputs (2D tensor of NxM points)
To see what is exactly computed, see section REDFT01 over here: http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html
3D Discrete Cosine Transform (DCT) Takes Real inputs (3D tensor of NxMXP points)
To see what is exactly computed, see section REDFT10 over here: http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html
inverse 3D Discrete Cosine Transform (DCT) Takes Real inputs (3D tensor of NxMxP points)
To see what is exactly computed, see section REDFT01 over here: http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html
Discrete-time analytic signal using Hilbert transform Takes 1D inputs
Output matches with matlab output
signal.typecheck(input)
Haar wavelet (1D) return the phi and psi functions of a haar wavelet
Daubechies wavelet (1D) return the phi and psi functions of a daubechies wavelet
Calculates the discrete wavelet transform, given the phi and psi functions phi and psi are functions that take the input signal and give out the scaled signal, and the wavelet coefficients respectively.
input - input signal \phi φ(x) - scaling function \psi ψ(x) - wavelet function [maxlevels] - maximum number of levels to recurse