hommage-0.0.5: doc/Sound.Hommage.Osc.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><TITLE
>Sound.Hommage.Osc</TITLE
><LINK HREF = "haddock.css" REL = "stylesheet" TYPE = "text/css"
></HEAD
><BODY
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "topbar"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD
><IMG SRC = "haskell_icon.gif" WIDTH = "16" HEIGHT = "16" ALT = " "
></TD
><TD CLASS = "title"
></TD
><TD CLASS = "topbut"
><A HREF = "Sound.Hommage.html"
>Parent</A
></TD
><TD CLASS = "topbut"
><A HREF = "index.html"
>Contents</A
></TD
><TD CLASS = "topbut"
><A HREF = "doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "modulebar"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD
><FONT SIZE = "6"
>Sound.Hommage.Osc</FONT
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "section4"
><B
>Contents</B
></TD
></TR
><TR
><TD
><DL
><DT
><A HREF = "#1"
> Sound Generators</A
></DT
><DT
><A HREF = "#2"
> Functions for Lists</A
></DT
><DT
><A HREF = "#3"
> Functions for single values</A
></DT
><DT
><A HREF = "#4"
> Other Functions</A
></DT
></DL
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "section1"
>Synopsis</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "body"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Aosc"
>osc</A
> :: [Double] -> [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Asinus"
>sinus</A
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Acosinus"
>cosinus</A
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Arect"
>rect</A
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Asaw"
>saw</A
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Atri"
>tri</A
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3ArandomList"
>randomList</A
> :: (Random a) => (a, a) -> [a]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3AsampleAndHold"
>sampleAndHold</A
> :: (Ord a, Num a) => b -> [a] -> [b] -> [b]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Aaverage"
>average</A
> :: (Fractional a) => Int -> [a] -> [a]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3AterminateAt"
>terminateAt</A
> :: Int -> (a -> Bool) -> [a] -> [a]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Afollow"
>follow</A
> :: Double -> [Double] -> [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Acompress"
>compress</A
> :: Double -> Double -> Double</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3AnoteToFrequency"
>noteToFrequency</A
> :: Double -> Double -> Double</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3AadjustFrequency"
>adjustFrequency</A
> :: Double -> Double -> Double -> Double</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3AsplitWaves"
>splitWaves</A
> :: [Double] -> [[Double]]</TD
></TR
><TR
><TD CLASS = "s8"
></TD
></TR
><TR
><TD CLASS = "decl"
><A HREF = "#v%3Acrossfade"
>crossfade</A
> :: [Double] -> [Double] -> [Double]</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "section1"
><A NAME = "1"
> Sound Generators</A
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Aosc"
></A
><B
>osc</B
></TD
></TR
><TR
><TD CLASS = "body"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "decl"
>:: [Double]</TD
><TD CLASS = "rdoc"
> The sound to play. Output will be finite if sound is finite.</TD
></TR
><TR
><TD CLASS = "decl"
>-> [Double]</TD
><TD CLASS = "rdoc"
> Speed, 1.0 = normal,
0.0 < X < 1.0 = slower resp. lower,
1.0 < X = faster resp. higher,
X < 0.0 => X = abs X.</TD
></TR
><TR
><TD CLASS = "decl"
>-> [Double]</TD
><TD CLASS = "rdoc"
> Output </TD
></TR
><TR
><TD CLASS = "ndoc" COLSPAN = "2"
> 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.</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Asinus"
></A
><B
>sinus</B
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "doc"
> A sinus wave generator with a period of 1024/N for frequency N </TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Acosinus"
></A
><B
>cosinus</B
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "doc"
> A cosinus wave generator</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Arect"
></A
><B
>rect</B
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "doc"
> A rectangle wave generator</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Asaw"
></A
><B
>saw</B
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "doc"
> A sawtooth wave generator</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Atri"
></A
><B
>tri</B
> :: [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "doc"
> A triangle wave generator</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3ArandomList"
></A
><B
>randomList</B
> :: (Random a) => (a, a) -> [a]</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "section1"
><A NAME = "2"
> Functions for Lists</A
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3AsampleAndHold"
></A
><B
>sampleAndHold</B
> :: (Ord a, Num a) => b -> [a] -> [b] -> [b]</TD
></TR
><TR
><TD CLASS = "doc"
> 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.</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Aaverage"
></A
><B
>average</B
> :: (Fractional a) => Int -> [a] -> [a]</TD
></TR
><TR
><TD CLASS = "doc"
> Maps the values to the average of the last N values (including the actual)</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3AterminateAt"
></A
><B
>terminateAt</B
> :: Int -> (a -> Bool) -> [a] -> [a]</TD
></TR
><TR
><TD CLASS = "doc"
> If predicate holds for N elements, list is cut.</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Afollow"
></A
><B
>follow</B
> :: Double -> [Double] -> [Double] -> [Double]</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "section1"
><A NAME = "3"
> Functions for single values</A
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "doc"
> These Functions can be used with map:</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Acompress"
></A
><B
>compress</B
> :: Double -> Double -> Double</TD
></TR
><TR
><TD CLASS = "doc"
><PRE
> compress p x = x / (abs p + abs x) </PRE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3AnoteToFrequency"
></A
><B
>noteToFrequency</B
></TD
></TR
><TR
><TD CLASS = "body"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "decl"
>:: Double</TD
><TD CLASS = "rdoc"
> Base, </TD
></TR
><TR
><TD CLASS = "decl"
>-> Double</TD
><TD CLASS = "rdoc"
> Notenumber</TD
></TR
><TR
><TD CLASS = "decl"
>-> Double</TD
><TD CLASS = "rdoc"
> 2 ^ (Notenumber / Base)</TD
></TR
><TR
><TD CLASS = "ndoc" COLSPAN = "2"
> Transforms a notevalue into a frequency. A Notevalue of 0.0 means a frequency of 1.0. </TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3AadjustFrequency"
></A
><B
>adjustFrequency</B
></TD
></TR
><TR
><TD CLASS = "body"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "decl"
>:: Double</TD
><TD CLASS = "rdoc"
> Period </TD
></TR
><TR
><TD CLASS = "decl"
>-> Double</TD
><TD CLASS = "rdoc"
> New Frequency (Hz) for old frequency of 1.0</TD
></TR
><TR
><TD CLASS = "decl"
>-> Double</TD
><TD CLASS = "rdoc"
> Input Frequency</TD
></TR
><TR
><TD CLASS = "decl"
>-> Double</TD
><TD CLASS = "rdoc"
> Output Frequency</TD
></TR
><TR
><TD CLASS = "ndoc" COLSPAN = "2"
> 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 <TT
> map (adjustFrequency X Y) </TT
> to adjust the
input of the oscillator.</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "section1"
><A NAME = "4"
> Other Functions</A
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "doc"
> These Functions are not simple (i. e. linear) list transformers:</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3AsplitWaves"
></A
><B
>splitWaves</B
> :: [Double] -> [[Double]]</TD
></TR
><TR
><TD CLASS = "doc"
> Splits a wave into parts. they are split when a value equal or less than zero is followed by a
value greater than zero.</TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "decl"
><A NAME = "v%3Acrossfade"
></A
><B
>crossfade</B
></TD
></TR
><TR
><TD CLASS = "body"
><TABLE CLASS = "vanilla" CELLSPACING = "0" CELLPADDING = "0"
><TR
><TD CLASS = "decl"
>:: [Double]</TD
><TD CLASS = "rdoc"
> w1</TD
></TR
><TR
><TD CLASS = "decl"
>-> [Double]</TD
><TD CLASS = "rdoc"
> w2</TD
></TR
><TR
><TD CLASS = "decl"
>-> [Double]</TD
><TD CLASS = "rdoc"
> result</TD
></TR
><TR
><TD CLASS = "ndoc" COLSPAN = "2"
> Create a wave with the beginning of w1, the ending of w2 and the length of the longer one of them.</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS = "s15"
></TD
></TR
><TR
><TD CLASS = "botbar"
>Produced by <A HREF = "http://www.haskell.org/haddock/"
>Haddock</A
> version HADDOCK_VERSION</TD
></TR
></TABLE
></BODY
></HTML
>