vocoder-0.1.0.0: Phase vocoder
Copyright(c) Celina Pawlińska 2020
Marek Materzok 2021
LicenseBSD2
Safe HaskellNone
LanguageHaskell2010

Vocoder

Description

This module implements the phase vocoder algorithms. The implementation is designed to be used directly or to be integrated into some convenient abstraction (streaming or FRP).

Synopsis

Documentation

type Moduli = Vector Double Source #

Complex moduli of FFT frames. Represent signal amplitudes.

type Phase = Vector Double Source #

Complex arguments of FFT frames. Represent signal phases.

type PhaseInc = Vector Double Source #

Phase increments. Represent the deviation of the phase difference between successive frames from the expected difference for the center frequencies of the FFT bins.

type Frame = Vector Double Source #

Time domain frame.

type Window = Frame Source #

Sampled STFT window function.

type HopSize = Int Source #

Offset between successive STFT frames, in samples.

type Length = Int Source #

Size in samples.

type STFTFrame = (Moduli, PhaseInc) Source #

STFT processing unit.

type FFTOutput = Vector (Complex Double) Source #

Frequency domain frame.

data VocoderParams Source #

Configuration parameters for the phase vocoder algorithm.

vocoderParams :: Length -> HopSize -> Window -> VocoderParams Source #

Create a vocoder configuration.

vocFrameLength :: VocoderParams -> Length Source #

FFT frame length. Can be larger than vocInputFrameLength for zero-padding.

vocFreqFrameLength :: VocoderParams -> Length Source #

FFT frequency frame length.

vocWindow :: VocoderParams -> Window Source #

Window function used during analysis and synthesis.

doFFT :: VocoderParams -> Frame -> FFTOutput Source #

Perform FFT processing, which includes the actual FFT, rewinding, zero-paddding and windowing.

doIFFT :: VocoderParams -> FFTOutput -> Frame Source #

Perform IFFT processing, which includes the actual IFFT, rewinding, removing padding and windowing.

analysisBlock :: VocoderParams -> Phase -> Frame -> (Phase, STFTFrame) Source #

Perform FFT transform and frequency-domain analysis.

analysisStep :: HopSize -> Length -> Phase -> FFTOutput -> (Phase, STFTFrame) Source #

Analyze a frequency domain frame. Phase from a previous frame must be supplied. It returns the phase of the analyzed frame and the result.

analysisStage :: Traversable t => VocoderParams -> Phase -> t Frame -> (Phase, t STFTFrame) Source #

Perform analysis on a sequence of frames. This consists of FFT processing and performing analysis on frequency domain frames.

synthesisBlock :: VocoderParams -> Phase -> STFTFrame -> (Phase, Frame) Source #

Perform frequency-domain synthesis and IFFT transform.

synthesisStep :: HopSize -> Phase -> STFTFrame -> (Phase, FFTOutput) Source #

Synthesize a frequency domain frame. Phase from the previously synthesized frame must be supplied. It returns the phase of the synthesized frame and the result.

synthesisStage :: Traversable t => VocoderParams -> Phase -> t STFTFrame -> (Phase, t Frame) Source #

Perform synthesis on a sequence of frames. This consists of performing synthesis and IFFT processing.

zeroPhase :: VocoderParams -> Phase Source #

Zero phase for a given vocoder configuration. Can be used to initialize the synthesis stage.

volumeCoeff :: VocoderParams -> Double Source #

An amplitude change coefficient for the processing pipeline. Can be used to ensure that the output has the same volume as the input.

frameFromComplex :: FFTOutput -> STFTFrame Source #

Converts frame representation to magnitude and phase.

frameToComplex :: STFTFrame -> FFTOutput Source #

Converts frame representation to complex numbers.

addFrames :: STFTFrame -> STFTFrame -> STFTFrame Source #

Adds STFT frames.