hommage-0.0.5: Haskell Offline Music Manipulation And Generation EDSLSource codeContentsIndex
Sound.Hommage.Osc
Contents
Sound Generators
Functions for Lists
Functions for single values
Other Functions
Synopsis
osc :: [Double] -> [Double] -> [Double]
sinus :: [Double] -> [Double]
cosinus :: [Double] -> [Double]
rect :: [Double] -> [Double]
saw :: [Double] -> [Double]
tri :: [Double] -> [Double]
randomList :: Random a => (a, a) -> [a]
sampleAndHold :: (Ord a, Num a) => b -> [a] -> [b] -> [b]
average :: Fractional a => Int -> [a] -> [a]
terminateAt :: Int -> (a -> Bool) -> [a] -> [a]
follow :: Double -> [Double] -> [Double] -> [Double]
compress :: Double -> Double -> Double
noteToFrequency :: Double -> Double -> Double
adjustFrequency :: Double -> Double -> Double -> Double
splitWaves :: [Double] -> [[Double]]
crossfade :: [Double] -> [Double] -> [Double]
Sound Generators
oscSource
:: [Double]The sound to play. Output will be finite if sound is finite.
-> [Double]Speed, 1.0 = normal, 0.0 < X < 1.0 = slower resp. lower, 1.0 < X = faster resp. higher, X < 0.0 => X = abs X.
-> [Double]Output
Play given sound with variable speed resp. frequency. (General definition: Usually a frequency of 1.0 means a period of 1024 values). Use scratchSample or scratchSampleSignal for backward playing.
sinus :: [Double] -> [Double]Source
A sinus wave generator with a period of 1024/N for frequency N
cosinus :: [Double] -> [Double]Source
A cosinus wave generator
rect :: [Double] -> [Double]Source
A rectangle wave generator
saw :: [Double] -> [Double]Source
A sawtooth wave generator
tri :: [Double] -> [Double]Source
A triangle wave generator
randomList :: Random a => (a, a) -> [a]Source
Functions for Lists
sampleAndHold :: (Ord a, Num a) => b -> [a] -> [b] -> [b]Source
Current output value is repeatet until the first list argument value switches from zero or below to a non-zero positive value, the actual value of the second list argument is then taken for output.
average :: Fractional a => Int -> [a] -> [a]Source
Maps the values to the average of the last N values (including the actual)
terminateAt :: Int -> (a -> Bool) -> [a] -> [a]Source
If predicate holds for N elements, list is cut.
follow :: Double -> [Double] -> [Double] -> [Double]Source
Functions for single values
These Functions can be used with map:
compress :: Double -> Double -> DoubleSource
 compress p x = x / (abs p + abs x)
noteToFrequencySource
:: DoubleBase,
-> DoubleNotenumber
-> Double2 ^ (Notenumber / Base)
Transforms a notevalue into a frequency. A Notevalue of 0.0 means a frequency of 1.0.
adjustFrequencySource
:: DoublePeriod
-> DoubleNew Frequency (Hz) for old frequency of 1.0
-> DoubleInput Frequency
-> DoubleOutput Frequency
Adjusts the frequency. If given oscillator has period X for frequency of 1.0 and you want it to produce a wave with Y Hz at frequency of 1.0, use map (adjustFrequency X Y) to adjust the input of the oscillator.
Other Functions
These Functions are not simple (i. e. linear) list transformers:
splitWaves :: [Double] -> [[Double]]Source
Splits a wave into parts. they are split when a value equal or less than zero is followed by a value greater than zero.
crossfadeSource
:: [Double]w1
-> [Double]w2
-> [Double]result
Create a wave with the beginning of w1, the ending of w2 and the length of the longer one of them.
Produced by Haddock version 2.4.2