synthesizer-core-0.8.1: Audio signal processing coded in Haskell: Low level part

Copyright(c) Henning Thielemann 2008
Portabilityrequires multi-parameter type classes
Safe HaskellNone






amplify :: C a => a -> T a -> T a Source #

amplifyVector :: C a v => a -> T v -> T v Source #

envelope Source #


:: C a 
=> T a

the envelope

-> T a

the signal to be enveloped

-> T a 

envelopeVector Source #


:: C a v 
=> T a

the envelope

-> T v

the signal to be enveloped

-> T v 

fadeInOut :: C a => Int -> Int -> Int -> T a -> T a Source #

generic :: C a v => T a -> T v -> T v Source #

Unmodulated non-recursive filter

binomial :: (C a, C a, C a v) => a -> a -> T v -> T v Source #

binomial1 :: C v => T v -> T v Source #

sums :: C v => Int -> T v -> T v Source #

Moving (uniformly weighted) average in the most trivial form. This is very slow and needs about n * length x operations.

inverseFrequencyModulationFloor :: (Ord t, C t) => T t -> T v -> T v Source #

This is inverse to frequency modulation. If all control values in ctrl are above one, then it holds: frequencyModulation ctrl (inverseFrequencyModulationFloor ctrl xs) == xs . Otherwise inverseFrequencyModulationFloor is lossy. For the precise property we refer to Test.Sound.Synthesizer.Plain.Interpolation. The modulation uses constant interpolation. Other interpolation types are tricky to implement, since they would need interpolation on non-equidistant grids. Ok, at least linear interpolation could be supported with acceptable effort, but perfect reconstruction would be hard to get. The process is not causal in any of its inputs, however control and input are aligned.

If you use interpolation for resampling or frequency modulation, you may want to smooth the signal before resampling according to the local resampling factor. However you cannot simply use the resampling control to also control the smoothing, because of the subsequent distortion by resampling. Instead you have to stretch the control inversely to the resampling factor. This is the task of this function. It may be applied like:

frequencyModulation ctrl (smooth (inverseFrequencyModulationFloor ctrl ctrl) xs)

inverseFrequencyModulationCeiling :: (Ord t, C t) => T t -> T v -> T v Source #

differentiate :: C v => T v -> T v Source #

Forward difference quotient. Shortens the signal by one. Inverts run in the sense that differentiate (zero : integrate x) == x. The signal is shifted by a half time unit.

differentiateCenter :: C v => T v -> T v Source #

Central difference quotient. Shortens the signal by two elements, and shifts the signal by one element. (Which can be fixed by prepending an appropriate value.) For linear functions this will yield essentially the same result as differentiate. You obtain the result of differentiateCenter if you smooth the one of differentiate by averaging pairs of adjacent values.

ToDo: Vector variant

differentiate2 :: C v => T v -> T v Source #

Second derivative. It is differentiate2 == differentiate . differentiate but differentiate2 should be faster.