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

Safe HaskellNone
LanguageHaskell2010

Synthesizer.Storable.Repair

Synopsis

Documentation

removeClicks :: (Storable a, C a) => Int -> Int -> Int -> Maybe a -> Maybe a -> Vector a -> Vector a Source #

Usage: removeClicks slopeDistance maxSpikeWidth minSpikeDistance thresholdUp thresholdDown

slopeDistance is the distance of samples in which we analyse differences. The smoother the spike slope the larger slopeDistance must be.

slopeDistance should be smaller than the _minimal_ spike width. maxSpikeWidth should be smaller than the minimal spike distance. Spike distance is measured from one spike beginning to the next one.

thresholdUp is the minimal difference of two samples at slopeDistance that are to be considered an upward jump. thresholdDown is for downward jumps. If a threshold is Nothing then jumps in this direction are ignored. You should only use this if you are very sure that spikes with the according sign do not occur. Otherwise the algorithm will be confused by the jump in reverse direction at the end of the spike.

Example: removeClicks 1 5 20 (Just 0.1) (Just 0.1).

The algorithm works as follows: Chop the signal at jumps. Then begin at a certain distance behind the jump and search backwards for the matching jump at the end of the spike. If the borders of a spike are found this way, then they are connected by a linear ramp.