Copyright | (c) Marek Materzok 2021 |
---|---|
License | BSD2 |
Safe Haskell | None |
Language | Haskell2010 |
This module defines some useful frequency-domain filters for use in the vocoder framework.
Synopsis
- type FreqStep = Double
- type Filter m = FreqStep -> STFTFrame -> m STFTFrame
- composeFilters :: Monad m => Filter m -> Filter m -> Filter m
- addFilters :: Monad m => Filter m -> Filter m -> Filter m
- idFilter :: Monad m => Filter m
- amplitudeFilter :: Monad m => (FreqStep -> Moduli -> Moduli) -> Filter m
- linearAmplitudeFilter :: Monad m => (Double -> Double) -> Filter m
- amplify :: Monad m => Double -> Filter m
- lowpassBrickwall :: Monad m => Double -> Filter m
- highpassBrickwall :: Monad m => Double -> Filter m
- bandpassBrickwall :: Monad m => Double -> Double -> Filter m
- bandstopBrickwall :: Monad m => Double -> Double -> Filter m
- lowpassButterworth :: Monad m => Double -> Double -> Filter m
- highpassButterworth :: Monad m => Double -> Double -> Filter m
- bandpassButterworth :: Monad m => Double -> Double -> Double -> Filter m
- bandstopButterworth :: Monad m => Double -> Double -> Double -> Filter m
- pitchShiftInterpolate :: Monad m => Double -> Filter m
- convolution :: Vector Double -> Moduli -> Moduli
- convolutionFilter :: Monad m => Vector Double -> Filter m
- envelope :: Length -> Moduli -> Moduli
- envelopeFilter :: Monad m => Length -> Filter m
- randomPhaseFilter :: MonadIO m => Filter m
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.
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.
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".