vocoder-0.1.0.0: Phase vocoder
Copyright(c) Marek Materzok 2021
LicenseBSD2
Safe HaskellNone
LanguageHaskell2010

Vocoder.Filter

Description

This module defines some useful frequency-domain filters for use in the vocoder framework.

Synopsis

Documentation

type FreqStep = Double Source #

A frequency step is a coefficient relating physical frequency (in Hz) to FFT bin numbers. It is used to define filters independently of the FFT window size.

type Filter m = FreqStep -> STFTFrame -> m STFTFrame Source #

The type of frequency-domain filters. A frequency-domain filter is a function transforming STFT frames which can depend on the frequency step.

composeFilters :: Monad m => Filter m -> Filter m -> Filter m Source #

Sequential composition of filters.

addFilters :: Monad m => Filter m -> Filter m -> Filter m Source #

Addition of filters.

idFilter :: Monad m => Filter m Source #

Identity filter.

amplitudeFilter :: Monad m => (FreqStep -> Moduli -> Moduli) -> Filter m Source #

Creates a filter which transforms only amplitudes, leaving phase increments unchanged.

linearAmplitudeFilter :: Monad m => (Double -> Double) -> Filter m Source #

Creates a filter which scales amplitudes depending on frequency.

amplify :: Monad m => Double -> Filter m Source #

Creates an "amplifier" which scales all frequencies.

lowpassBrickwall :: Monad m => Double -> Filter m Source #

Creates a brickwall lowpass filter.

highpassBrickwall :: Monad m => Double -> Filter m Source #

Creates a brickwall highpass filter.

bandpassBrickwall :: Monad m => Double -> Double -> Filter m Source #

Creates a brickwall bandpass filter.

bandstopBrickwall :: Monad m => Double -> Double -> Filter m Source #

Creates a brickwall bandstop filter.

lowpassButterworth :: Monad m => Double -> Double -> Filter m Source #

Creates an n-th degree Butterworth-style lowpass filter.

highpassButterworth :: Monad m => Double -> Double -> Filter m Source #

Creates an n-th degree Butterworth-style highpass filter.

bandpassButterworth :: Monad m => Double -> Double -> Double -> Filter m Source #

Creates an n-th degree Butterworth-style bandpass filter.

bandstopButterworth :: Monad m => Double -> Double -> Double -> Filter m Source #

Creates an n-th degree Butterworth-style bandstop filter.

pitchShiftInterpolate :: Monad m => Double -> Filter m Source #

Creates an interpolative pitch-shifting filter.

convolution :: Vector Double -> Moduli -> Moduli Source #

Convolves the amplitude spectrum using a kernel.

convolutionFilter :: Monad m => Vector Double -> Filter m Source #

Creates a filter which convolves the spectrum using a kernel.

envelope :: Length -> Moduli -> Moduli Source #

Calculates the envelope of an amplitude spectrum using convolution.

envelopeFilter :: Monad m => Length -> Filter m Source #

Creates a filter which replaces the amplitudes with their envelope.

randomPhaseFilter :: MonadIO m => Filter m Source #

Sets the phase increments so that the bins have horizontal consistency. This erases the phase information, introducing "phasiness".