-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | library to make electronic music -- -- Let's make music with text! We can use Csound to describe our music. -- Csound has so many fantastic sound generators. It's very efficient. -- But sometimes Csound is too low level. So many details: integer -- identifiers for instruments and arrays, should I use control rate or -- audio rate signals, lack of abstractions, no nested expressions and it -- has limited set of types. This library embeds Csound in Haskell. We -- can use powerful Csound's primitives and glue them together with -- Haskell abstractions. The module Csound.Base exports all types -- and functions. -- -- Tutorials: -- --
-- csound ---- -- It should print a long message with version and available flags and -- libraries. -- -- If everything is installed to install the library we can open the -- command line terminal and type: -- --
-- cabal install csound-expression ---- -- Acknowledgements (I'd like to mention those who supported me a lot -- with their music and ideas): -- --
-- hor [a, b, sca 2 c] ---- -- Why is it so? Let's look at the hidden scaling factors: -- --
-- hor [sca 1 a, sca 1 b, sca 2 c] ---- -- During rendering we scale all the scaling fators so that total sum -- equals to one: -- --
-- hor [sca 0.25 a, sca 0.25 b, sca 0.5 c] --sca :: Double -> Gui -> Gui -- | Weighted horizontal grouping. It takes a list of scaling factors and -- elements. horSca :: [(Double, Gui)] -> Gui -- | Weighted vertical grouping. It takes a list of scaling factors and -- elements. verSca :: [(Double, Gui)] -> Gui -- | Sets the padding of the element. How much empty space to reserve -- outside the element. padding :: Int -> Gui -> Gui -- | Sets the margin of the element. How much empty space to reserve -- between the elements within the group. It affects only compound -- elements. margin :: Int -> Gui -> Gui module Csound.Control.SE -- | The Csound's IO-monad. All values that produce side effects -- are wrapped in the SE-monad. data SE a :: * -> * -- | It describes a reference to mutable values. data SERef a :: * -> * SERef :: (a -> SE ()) -> SE a -> SERef a writeSERef :: SERef a -> a -> SE () readSERef :: SERef a -> SE a -- | Allocates a new mutable value and initializes it with value. A -- reference can contain a tuple of variables. newSERef :: Tuple a => a -> SE (SERef a) -- | An alias for the function newSERef. It returns not the -- reference to mutable value but a pair of reader and writer functions. sensorsSE :: Tuple a => a -> SE (SE a, a -> SE ()) module Csound.Control.Evt -- | A stream of events. We can convert a stream of events to the procedure -- with the function runEvt. It waits for events and invokes the -- given procedure when the event happens. data Evt a :: * -> * Evt :: (Bam a -> SE ()) -> Evt a runEvt :: Evt a -> Bam a -> SE () -- | A procedure. Something that takes a value and suddenly bams with it. type Bam a = a -> SE () -- | Converts booleans to events. boolToEvt :: BoolSig -> Evt Unit -- | Converts an event to boolean signal. It forgets everything about the -- event values. Signal equals to one when an event happens and zero -- otherwise. evtToBool :: Evt a -> SE BoolSig -- | Triggers an event when signal equals to 1. sigToEvt :: Sig -> Evt Unit -- | Converts events to signals. stepper :: Tuple a => a -> Evt a -> SE a -- | Filters events with predicate. filterE :: (a -> BoolD) -> Evt a -> Evt a -- | Filters events with effectful predicate. filterSE :: (a -> SE BoolD) -> Evt a -> Evt a -- | Accumulator for events with side effects. accumSE :: Tuple s => s -> (a -> s -> SE (b, s)) -> Evt a -> Evt b -- | Accumulator for events. accumE :: Tuple s => s -> (a -> s -> (b, s)) -> Evt a -> Evt b -- | Accumulator with filtering. It can skip the events from the event -- stream. If the third element of the triple equals to 1 then we should -- include the event in the resulting stream. If the element equals to 0 -- we skip the event. filterAccumE :: Tuple s => s -> (a -> s -> (BoolD, b, s)) -> Evt a -> Evt b -- | Accumulator for events with side effects and filtering. Event triggers -- only if the first element in the tripplet is true. filterAccumSE :: Tuple s => s -> (a -> s -> SE (BoolD, b, s)) -> Evt a -> Evt b -- | A snapshot of the signal. It converts a type of the signal to the type -- of the value in the given moment. Instances: -- --
-- type instance Snap D = D -- type instance Snap Str = Str -- type instance Snap Tab = Tab -- -- type instance Snap Sig = D -- -- type instance Snap (a, b) = (Snap a, Snap b) -- type instance Snap (a, b, c) = (Snap a, Snap b, Snap c) -- type instance Snap (a, b, c, d) = (Snap a, Snap b, Snap c, Snap d) -- type instance Snap (a, b, c, d, e) = (Snap a, Snap b, Snap c, Snap d, Snap e) -- type instance Snap (a, b, c, d, e, f) = (Snap a, Snap b, Snap c, Snap d, Snap e, Snap f) ---- | Get values of some signal at the given events. snapshot :: (Tuple a, Tuple (Snap a)) => (Snap a -> b -> c) -> a -> Evt b -> Evt c -- | Constructs an event stream that contains values from the given signal. -- Events happens only when the signal changes. snaps :: Sig -> Evt D -- | Executes actions synchronized with global tempo (in Hz). -- --
-- runEvtSync tempoCps evt proc --sync :: (Default a, Tuple a) => D -> Evt a -> Evt a -- | the sync function but time is measured in beats per minute. syncBpm :: (Default a, Tuple a) => D -> Evt a -> Evt a -- | Behaves like metro, but returns an event stream. metroE :: Sig -> Evt Unit -- | Behaves like changed, but returns an event stream. changedE :: [Sig] -> Evt Unit -- | Behaves like trigger, but returns an event stream. triggerE :: Sig -> Sig -> Sig -> Evt Unit -- | Constructs an event stream that contains an infinite repetition values -- from the given list. When an event happens this function takes the -- next value from the list, if there is no values left it starts from -- the beggining of the list. cycleE :: (Tuple a, Arg a) => [a] -> Evt b -> Evt a -- | When something happens on the given event stream resulting event -- stream contains an application of some unary function to the given -- initial value. So the event stream contains the values: -- --
-- [s0, f s0, f (f s0), f (f (f s0)), ...] --iterateE :: Tuple a => a -> (a -> a) -> Evt b -> Evt a -- | Substitutes all values in the input stream with the given constant -- value. repeatE :: Tuple a => a -> Evt b -> Evt a -- | Accumulates a values from the given event stream with binary function. -- It's a variant of the fold for event streams. -- --
-- appendE z f evt ---- -- When value a happens with evt, the resulting event -- stream contains a value (z f a) and in the next time -- z equals to this value. appendE :: Tuple a => a -> (a -> a -> a) -> Evt a -> Evt a -- | A special variant of the function appendE for the monoids. -- Initial value is mempty and binary function is mappend -- which belong to the instance of the class Monoid. mappendE :: (Monoid a, Tuple a) => Evt a -> Evt a -- | Splits event stream on two streams with predicate. partitionE :: (a -> BoolD) -> Evt a -> (Evt a, Evt a) -- | Splits a toggle event stream on on-events and off-events. splitToggle :: Evt D -> (Evt D, Evt D) -- | Constructs an event stream that contains values from the given list -- which are taken in the random order. oneOf :: (Tuple a, Arg a) => [a] -> Evt b -> Evt a -- | Constructs an event stream that contains values from the given list -- which are taken in the random order. In the list we specify not only -- values but the frequencies of occurrence. Sum of the frequencies -- should be equal to one. freqOf :: (Tuple a, Arg a) => Rnds a -> Evt b -> Evt a -- | This function combines the functions accumE and freqOf. -- We transform the values of the event stream with stateful function -- that produce not just values but the list of values with frequencies -- of occurrence. We apply this function to the current state and the -- value and then at random pick one of the values. freqAccum :: (Tuple s, Tuple (b, s), Arg (b, s)) => s -> (a -> s -> Rnds (b, s)) -> Evt a -> Evt b -- | An event stream of the random values in the interval (0, 1). randDs :: Evt b -> Evt D -- | An event stream of the integers taken from the given diapason. randInts :: (D, D) -> Evt b -> Evt D -- | Skips elements at random. -- --
-- randSkip prob ---- -- where prob is probability of includinng the element in the -- output stream. randSkip :: D -> Evt a -> Evt a -- | Skips elements at random. -- --
-- randSkip probFun ---- -- It behaves just like randSkip, but probability depends on the -- value. randSkipBy :: (a -> D) -> Evt a -> Evt a -- |
-- range (xMin, xMax) === cycleE [xMin .. pred xMax] --range :: (D, D) -> Evt b -> Evt D -- | Turns an event of indices to the event of the values from the list. A -- value is taken with index. listAt :: (Tuple a, Arg a) => [a] -> Evt D -> Evt a -- | Specialization of the function masked. -- --
-- every n [a, b, c, ..] evt ---- -- constructs a mask that skips first n elements and then -- produces an event and skips next (a - 1) events, then produces an -- event and skips next (b - 1) events and so on. It's useful for -- construction of the percussive beats. For example -- --
-- every 0 [2] (metroE 2) ---- -- triggers an event on the odd beats. With this function we can create a -- complex patterns of cyclic events. every :: (Tuple a, Arg a) => Int -> [Int] -> Evt a -> Evt a -- | Filters events with the mask. A mask is a list of ones and zeroes. -- n'th element from the given list should be included in the resulting -- stream if the n'th element from the list equals to one or skipped if -- the element equals to zero. masked :: (Tuple a, Arg a) => [D] -> Evt a -> Evt a -- | We can convert notes to sound signals with instruments. An instrument -- is a function: -- --
-- (Arg a, Sigs b) => a -> SE b ---- -- It takes a tuple of primitive Csound values (number, string or array) -- and converts it to the tuple of signals and it makes some side effects -- along the way so the output is wrapped in the SE-monad. -- -- There are only three ways of making a sound with an instrument: -- --
-- (Arg a) => a -> SE () ---- -- To invoke the procedures there are functions with trailing underscore. -- For example we have the function trig to convert event stream -- to sound: -- --
-- trig :: (Arg a, Sigs b) => (a -> SE b) -> Evts (D, D, a) -> b ---- -- and we have a trig with underscore to convert the event -- stream to the sequence of the procedure invkations: -- --
-- trig_ :: (Arg a) => (a -> SE ()) -> Evts (D, D, a) -> SE () ---- -- To invoke instruments from another instrumetnts we use artificial -- closures made with functions with trailing xxxBy. For example: -- --
-- trigBy :: (Arg a, Arg c, Sigs b) => (a -> SE b) -> (c -> Evts (D, D, a)) -> (c -> b) ---- -- Notice that the event stream depends on the argument of the type c. -- Here goes all the parameters that we want to pass from the outer -- instrument. Unfortunately we can not just create the closure, because -- our values are not the real values. It's a text of the programm (a -- tiny snippet of it) to be executed. For a time being I don't know how -- to make it better. So we need to pass the values explicitly. -- -- For example, if we want to make an arpeggiator: -- --
-- pureTone :: D -> SE Sig -- pureTone cps = return $ mul env $ osc $ sig cps -- where env = linseg [0, 0.01, 1, 0.25, 0] -- -- majArpeggio :: D -> SE Sig -- majArpeggio = return . schedBy pureTone evts -- where evts cps = withDur 0.5 $ fmap (* cps) $ cycleE [1, 5/3, 3/2, 2] $ metroE 5 -- -- main = dac $ mul 0.5 $ midi $ onMsg majArpeggio ---- -- We should use schedBy to pass the frequency as a parameter to -- the event stream. module Csound.Control.Instr -- | A class that represents Csound scores. All functions that use score -- are defined in terms of this class. If you want to use your own score -- representation, just define two methods of the class. -- -- The properties: -- --
-- forall a . toCsdEventList (singleCsdEvent a) === CsdEventList 1 [(0, 1, a)] --class Functor f => CsdSco (f :: * -> *) toCsdEventList :: CsdSco f => f a -> CsdEventList a singleCsdEvent :: CsdSco f => CsdEvent a -> f a -- | Special type that represents a scores of sound signals. If an -- instrument is triggered with the scores the result is wrapped in the -- value of this type. data Mix a :: * -> * -- | Plays a bunch of notes with the given instrument. -- --
-- res = sco instrument scores --sco :: (CsdSco f, Arg a, Sigs b) => (a -> SE b) -> f a -> f (Mix b) -- | Renders a scores to the sound signals. we can use it inside the other -- instruments. Warning: if we use a score that lasts for an hour in the -- note that lasts for 5 seconds all the events would be generated, -- though we will hear only first five seconds. So the semantics is good -- but implementation is inefficient for such a cases (consider event -- streams for such cases). mix :: (Sigs a, CsdSco f) => f (Mix a) -> a -- | Applies an effect to the sound. Effect is applied to the sound on the -- give track. -- --
-- res = eff effect sco ---- --
-- (startTime, duration, parameters) --type CsdEvent a = (Double, Double, a) -- | Mixes the scores and plays them in the loop. mixLoop :: (CsdSco f, Sigs a) => f (Mix a) -> a -- | Invokes a procedure for the given bunch of events. sco_ :: (CsdSco f, Arg a) => (a -> SE ()) -> f a -> f (Mix Unit) -- | Converts a bunch of procedures scheduled with scores to a single -- procedure. mix_ :: CsdSco f => f (Mix Unit) -> SE () -- | Mixes the procedures and plays them in the loop. mixLoop_ :: CsdSco f => f (Mix Unit) -> SE () -- | Imitates a closure for a bunch of notes to be played within another -- instrument. mixBy :: (Arg a, Sigs b, CsdSco f) => (a -> f (Mix b)) -> a -> b data Msg :: * type Channel = Int -- | Triggers a midi-instrument (aka Csound's massign) for all channels. -- It's useful to test a single instrument. midi :: Sigs a => (Msg -> SE a) -> a -- | Triggers a midi-instrument (aka Csound's massign) on the specified -- channel. midin :: Sigs a => Channel -> (Msg -> SE a) -> a -- | Triggers a midi-instrument (aka Csound's pgmassign) on the specified -- programm bank. pgmidi :: Sigs a => Maybe Int -> Channel -> (Msg -> SE a) -> a ampCps :: Msg -> (D, D) -- | Triggers a midi-procedure (aka Csound's massign) for all channels. midi_ :: (Msg -> SE ()) -> SE () -- | Triggers a midi-procedure (aka Csound's pgmassign) on the given -- channel. midin_ :: Channel -> (Msg -> SE ()) -> SE () -- | Triggers a midi-procedure (aka Csound's pgmassign) on the given -- programm bank. pgmidi_ :: Maybe Int -> Channel -> (Msg -> SE ()) -> SE () -- | Get the note number of the current MIDI event, expressed in -- cycles-per-second. -- --
-- icps cpsmidi ---- -- csound doc: http://www.csounds.com/manual/html/cpsmidi.html cpsmidi :: Msg -> D -- | Get the velocity of the current MIDI event. -- --
-- iamp ampmidi iscal [, ifn] ---- -- csound doc: http://www.csounds.com/manual/html/ampmidi.html ampmidi :: Msg -> D -> D -- | Triggers an instrument with an event stream. The event stream contains -- triples: -- --
-- (delay_after_event_is_fired, duration_of_the_event, argument_for_the_instrument) --trig :: (Arg a, Sigs b) => (a -> SE b) -> Evt (D, D, a) -> b -- | It's like the function trig, but delay is set to zero. sched :: (Arg a, Sigs b) => (a -> SE b) -> Evt (D, a) -> b -- | An instrument is triggered with event stream and delay time is set to -- zero (event fires immediately) and duration is set to inifinite time. -- The note is held while the instrument is producing something. If the -- instrument is silent for some seconds (specified in the first -- argument) then it's turned off. schedHarp :: (Arg a, Sigs b) => D -> (a -> SE b) -> Evt a -> b -- | Invokes an instrument with first event stream and holds the note until -- the second event stream is active. schedUntil :: (Arg a, Sigs b) => (a -> SE b) -> Evt a -> Evt c -> b -- | Invokes an instrument with toggle event stream (1 stands for on and 0 -- stands for off). schedToggle :: Sigs b => SE b -> Evt D -> b -- | Triggers a procedure on the event stream. trig_ :: Arg a => (a -> SE ()) -> Evt (D, D, a) -> SE () -- | Triggers a procedure on the event stream. A delay time is set to zero. sched_ :: Arg a => (a -> SE ()) -> Evt (D, a) -> SE () -- | Invokes an instrument with first event stream and holds the note until -- the second event stream is active. schedUntil_ :: Arg a => (a -> SE ()) -> Evt a -> Evt c -> SE () -- | A closure to trigger an instrument inside the body of another -- instrument. trigBy :: (Arg a, Sigs b, Arg c) => (a -> SE b) -> (c -> Evt (D, D, a)) -> c -> b -- | A closure to trigger an instrument inside the body of another -- instrument. schedBy :: (Arg a, Sigs b, Arg c) => (a -> SE b) -> (c -> Evt (D, a)) -> c -> b -- | A closure to trigger an instrument inside the body of another -- instrument. schedHarpBy :: (Arg a, Sigs b, Arg c) => D -> (a -> SE b) -> (c -> Evt a) -> c -> b -- | Sets the same duration for all events. It's useful with the functions -- sched, schedBy, sched_. -- --
-- withDur dur events === fmap (\x -> (dur, x)) events --withDur :: D -> Evt a -> Evt (D, a) class Sigs (SigOuts a) => Outs a where type family SigOuts a :: * toOuts :: Outs a => a -> SE (SigOuts a) onArg :: Outs b => (a -> b) -> (a -> SE (SigOuts b)) -- | Converts a value to the midi-instrument. It's used with the functions -- midi, midin. class MidiInstr a where type family MidiInstrOut a :: * onMsg :: MidiInstr a => a -> Msg -> SE (MidiInstrOut a) -- | Constructs a drum-like instrument. Drum like instrument has a single -- argument that signifies an amplitude. class AmpInstr a where type family AmpInstrOut a :: * onAmp :: AmpInstr a => a -> D -> SE (AmpInstrOut a) -- | Constructs a simple instrument that takes in a tuple of two arguments. -- They are amplitude and the frequency (in Hz or cycles per second). class CpsInstr a where type family CpsInstrOut a :: * onCps :: CpsInstr a => a -> (D, D) -> SE (CpsInstrOut a) -- | Primitive GUI elements. -- -- There is a convention that constructors take only parameters that -- specify the logic of the widget. The view is set for GUI-elements with -- other functions. module Csound.Control.Gui.Widget -- | The diapason of the continuous value. data ValDiap :: * ValDiap :: Double -> Double -> ValDiap valDiapMin :: ValDiap -> Double valDiapMax :: ValDiap -> Double type ValStep = Double data ValScaleType :: * Linear :: ValScaleType Exponential :: ValScaleType -- | A value span is a diapason of the value and a type of the scale (can -- be linear or exponential). data ValSpan :: * ValSpan :: ValDiap -> ValScaleType -> ValSpan valSpanDiap :: ValSpan -> ValDiap valSpanScale :: ValSpan -> ValScaleType -- | Makes a linear ValSpan with specified boundaries. -- --
-- linSpan minVal maxVal --linSpan :: Double -> Double -> ValSpan -- | Makes an exponential ValSpan with specified boundaries. -- --
-- expSpan minVal maxVal --expSpan :: Double -> Double -> ValSpan -- | Unit span. A special case: -- --
-- uspan = linSpan 0 1 --uspan :: ValSpan -- | Bipolar unit span. A special case: -- --
-- uspan = linSpan (-1) 1 --bspan :: ValSpan -- | An exponential unit span. A special case: -- --
-- uspan = expSpan 0 1 --uspanExp :: ValSpan -- | Allows the user to increase/decrease a value with mouse clicks on a -- corresponding arrow button. Output is an event stream that contains -- values when counter changes. -- --
-- count diapason fineValStep maybeCoarseValStep initValue ---- -- doc: http:www.csounds.commanualhtml/FLcount.html count :: ValDiap -> ValStep -> Maybe ValStep -> Double -> Source (Evt D) -- | A variance on the function count, but it produces a signal of -- piecewise constant function. countSig :: ValDiap -> ValStep -> Maybe ValStep -> Double -> Source Sig -- | It is a squared area that allows the user to modify two output values -- at the same time. It acts like a joystick. -- --
-- joy valueSpanX valueSpanY (initX, initY) ---- -- doc: http://www.csounds.com/manual/html/FLjoy.html joy :: ValSpan -> ValSpan -> (Double, Double) -> Source (Sig, Sig) -- | A FLTK widget opcode that creates a knob. -- --
-- knob valueSpan initValue ---- -- doc: http://www.csounds.com/manual/html/FLknob.html knob :: String -> ValSpan -> Double -> Source Sig data KnobType :: * ThreeD :: Maybe Int -> KnobType Pie :: KnobType Clock :: KnobType Flat :: KnobType setKnobType :: KnobType -> Gui -> Gui -- | FLroller is a sort of knob, but put transversally. -- --
-- roller valueSpan step initVal ---- -- doc: http://www.csounds.com/manual/html/FLroller.html roller :: String -> ValSpan -> ValStep -> Double -> Source Sig -- | FLslider puts a slider into the corresponding container. -- --
-- slider valueSpan initVal ---- -- doc: http://www.csounds.com/manual/html/FLslider.html slider :: String -> ValSpan -> Double -> Source Sig -- | Constructs a list of linear unit sliders (ranges in [0, 1]). It takes -- a list of init values. sliderBank :: String -> [Double] -> Source [Sig] data SliderType :: * Fill :: SliderType Engraved :: SliderType Nice :: SliderType setSliderType :: SliderType -> Gui -> Gui -- | numeric (originally FLtext in the Csound) allows the user to modify a -- parameter value by directly typing it into a text field. -- --
-- numeric diapason step initValue ---- -- doc: http://www.csounds.com/manual/html/FLtext.html numeric :: String -> ValDiap -> ValStep -> Double -> Source Sig data TextType :: * NormalText :: TextType NoDrag :: TextType NoEdit :: TextType setTextType :: TextType -> Gui -> Gui -- | A FLTK widget that displays text inside of a box. If the text is -- longer than 255 characters the text is split on several parts (Csound -- limitations). -- --
-- box text ---- -- doc: http://www.csounds.com/manual/html/FLbox.html box :: String -> Display -- | The type of the box. Some values are not implemented on the Csound -- level. data BoxType :: * FlatBox :: BoxType UpBox :: BoxType DownBox :: BoxType ThinUpBox :: BoxType ThinDownBox :: BoxType EngravedBox :: BoxType EmbossedBox :: BoxType BorderBox :: BoxType ShadowBox :: BoxType Roundedbox :: BoxType RoundedShadowBox :: BoxType RoundedFlatBox :: BoxType RoundedUpBox :: BoxType RoundedDownBox :: BoxType DiamondUpBox :: BoxType DiamondDownBox :: BoxType OvalBox :: BoxType OvalShadowBox :: BoxType OvalFlatBox :: BoxType setBoxType :: BoxType -> Gui -> Gui -- | A FLTK widget opcode that creates a button. -- --
-- button text ---- -- doc: http://www.csounds.com/manual/html/FLbutton.html button :: String -> Source (Evt Unit) -- | The type of the button. It affects toggle buttons and button banks. -- -- In Csound buttons and toggle buttons are constructed with the same -- function (but with different button types). But in this library they -- are contructed by different functions (button and -- toggle). Normal button is a plain old button, but other -- values specify toggle buttons. So this property doesn't affect the -- buttons (since they could be only normal buttons). data ButtonType :: * NormalButton :: ButtonType LightButton :: ButtonType CheckButton :: ButtonType RoundButton :: ButtonType setButtonType :: ButtonType -> Gui -> Gui -- | A FLTK widget opcode that creates a toggle button. -- --
-- button text ---- -- doc: http://www.csounds.com/manual/html/FLbutton.html toggle :: String -> Source (Evt D) -- | A FLTK widget opcode that creates a bank of buttons. Result is (x, y) -- coordinate of the triggered button. -- --
-- butBank xNumOfButtons yNumOfButtons ---- -- doc: http://www.csounds.com/manual/html/FLbutBank.html butBank :: String -> Int -> Int -> (Int, Int) -> Source (Evt (D, D)) -- | A variance on the function toggle, but it produces a signal of -- piecewise constant function. toggleSig :: String -> Source Sig -- | A variance on the function butBank, but it produces a signal of -- piecewise constant function. Result is (x, y) coordinate of the -- triggered button. butBankSig :: String -> Int -> Int -> (Int, Int) -> Source (Sig, Sig) -- | A FLTK widget opcode that creates a bank of buttons. -- --
-- butBank xNumOfButtons yNumOfButtons ---- -- doc: http://www.csounds.com/manual/html/FLbutBank.html butBank1 :: String -> Int -> Int -> (Int, Int) -> Source (Evt D) butBankSig1 :: String -> Int -> Int -> (Int, Int) -> Source Sig -- | A radio button. It takes a list of values with labels. radioButton :: Arg a => String -> [(String, a)] -> Int -> Source (Evt a) -- | A matrix of values. matrixButton :: Arg a => String -> Int -> Int -> [a] -> (Int, Int) -> Source (Evt a) -- | Radio button that returns functions. Useful for picking a waveform or -- type of filter. funnyRadio :: Tuple b => String -> [(String, a -> b)] -> Int -> Source (a -> b) -- | Matrix of functional values. funnyMatrix :: Tuple b => String -> Int -> Int -> [(a -> b)] -> (Int, Int) -> Source (a -> b) -- | FLvalue shows current the value of a valuator in a text field. -- --
-- value initVal ---- -- doc: http://www.csounds.com/manual/html/FLvalue.html value :: String -> Double -> Sink Sig -- | A slider that serves as indicator. It consumes values instead of -- producing. -- --
-- meter valueSpan initValue --meter :: String -> ValSpan -> Double -> Sink Sig -- | Appends a title to a group of widgets. setTitle :: String -> Gui -> SE Gui -- | Keyboard events. data KeyEvt :: * Press :: Key -> KeyEvt Release :: Key -> KeyEvt -- | Keys. data Key :: * CharKey :: Char -> Key F1 :: Key F2 :: Key F3 :: Key F4 :: Key F5 :: Key F6 :: Key F7 :: Key F8 :: Key F9 :: Key F10 :: Key F11 :: Key F12 :: Key Scroll :: Key CapsLook :: Key LeftShift :: Key RightShift :: Key LeftCtrl :: Key RightCtrl :: Key Enter :: Key LeftAlt :: Key RightAlt :: Key LeftWinKey :: Key RightWinKey :: Key Backspace :: Key ArrowUp :: Key ArrowLeft :: Key ArrowRight :: Key ArrowDown :: Key Insert :: Key Home :: Key PgUp :: Key Delete :: Key End :: Key PgDown :: Key NumLock :: Key NumDiv :: Key NumMul :: Key NumSub :: Key NumHome :: Key NumArrowUp :: Key NumPgUp :: Key NumArrowLeft :: Key NumSpace :: Key NumArrowRight :: Key NumEnd :: Key NumArrowDown :: Key NumPgDown :: Key NumIns :: Key NumDel :: Key NumEnter :: Key NumPlus :: Key Num7 :: Key Num8 :: Key Num9 :: Key Num4 :: Key Num5 :: Key Num6 :: Key Num1 :: Key Num2 :: Key Num3 :: Key Num0 :: Key NumDot :: Key -- | The stream of keyboard press/release events. keyIn :: KeyEvt -> Evt Unit -- | Shortcut for press CharKey events. charOn :: Char -> Evt Unit -- | Shortcut for release CharKey events. charOff :: Char -> Evt Unit -- | GUI (Graphical User Interface) elements are handy to change the -- parameters of the sound in real time. It includes sliders, knobs, -- rollers, buttons and other widgets. -- -- A GUI element consists of two parts. They are view (how it looks) and -- logic (what's going on with it). For example a slider can be -- horizontal or vertical or green or yellow or small or big. It's the -- view of the slider. And a slider can produce a continuous signal -- within the given interval. It's a logic of the slider. -- -- Let's talk about the view. The view is divided on two parts: -- --
-- cfd coeff sig1 sig2 ---- -- If coeff equals 0 then we get the first signal and if it equals 1 we -- get the second signal. cfd :: SigSpace a => Sig -> a -> a -> a -- | Generic crossfade for n coefficients and n+1 signals. -- --
-- cfds coeffs sigs --cfds :: SigSpace a => [Sig] -> [a] -> a -- | Spectral crossfade. cfdSpec :: Sig -> Spec -> Spec -> Spec -- | Generic spectral crossfade. cfdsSpec :: [Sig] -> [Spec] -> Spec -- | Weighted sum. wsum :: SigSpace a => [(Sig, a)] -> a instance Fractional (a -> (Sig, Sig, Sig, Sig)) instance Fractional (a -> (Sig, Sig, Sig)) instance Fractional (a -> (Sig, Sig)) instance Fractional (a -> Sig) instance Fractional (a -> SE (Sig, Sig, Sig, Sig)) instance Fractional (a -> SE (Sig, Sig, Sig)) instance Fractional (a -> SE (Sig, Sig)) instance Fractional (a -> SE Sig) instance Fractional (SE (Sig, Sig, Sig, Sig)) instance Fractional (SE (Sig, Sig, Sig)) instance Fractional (SE (Sig, Sig)) instance Fractional (SE Sig) instance Fractional (Sig, Sig, Sig, Sig) instance Fractional (Sig, Sig, Sig) instance Fractional (Sig, Sig) instance Num (a -> SE (Sig, Sig, Sig, Sig)) instance Num (a -> SE (Sig, Sig, Sig)) instance Num (a -> SE (Sig, Sig)) instance Num (a -> SE Sig) instance Num (a -> (Sig, Sig, Sig, Sig)) instance Num (a -> (Sig, Sig, Sig)) instance Num (a -> (Sig, Sig)) instance Num (a -> Sig) instance Num (SE (Sig, Sig, Sig, Sig)) instance Num (SE (Sig, Sig, Sig)) instance Num (SE (Sig, Sig)) instance Num (SE Sig) instance Num (Sig, Sig, Sig, Sig) instance Num (Sig, Sig, Sig) instance Num (Sig, Sig) instance SigSpace (SE (Sig, Sig, Sig, Sig)) instance SigSpace (SE (Sig, Sig, Sig)) instance SigSpace (SE (Sig, Sig)) instance SigSpace (SE Sig) instance SigSpace (Sig, Sig, Sig, Sig) instance SigSpace (Sig, Sig, Sig) instance SigSpace (Sig, Sig) instance SigSpace Sig module Csound.Options -- | Csound options. The default values are -- --
-- flags = def -- the only flag set by default is "no-displays" -- -- to supress the display of the tables -- sampleRate = 44100 -- blockSize = 64 -- gain = 0.5 -- tabFi = fineFi 13 [(idLins, 11), (idExps, 11), (idConsts, 9), (idSplines, 11), (idStartEnds, 12)] } --data Options :: * Options :: Flags -> Maybe Int -> Maybe Int -> Maybe Double -> Maybe TabFi -> Options -- | Csound command line flags csdFlags :: Options -> Flags -- | The sample rate csdSampleRate :: Options -> Maybe Int -- | The number of audio samples in one control step csdBlockSize :: Options -> Maybe Int -- | A gain of the final output csdGain :: Options -> Maybe Double -- | Default fidelity of the arrays csdTabFi :: Options -> Maybe TabFi -- | Sets sample rate and block size -- --
-- setRates sampleRate blockSize --setRates :: Int -> Int -> Options -- | Sets hardware and software buffers. -- --
-- setBufs hardwareBuf ioBuf --setBufs :: Int -> Int -> Options setGain :: Double -> Options setJack :: String -> Options setOutput :: String -> Options setInput :: String -> Options setDac :: Options setAdc :: Options setDacBy :: String -> Options setAdcBy :: String -> Options setThru :: Options data Flags :: * Flags :: AudioFileOutput -> IdTags -> Maybe Rtaudio -> Maybe PulseAudio -> MidiIO -> MidiRT -> Maybe Rtmidi -> Displays -> Config -> Maybe String -> Flags audioFileOutput :: Flags -> AudioFileOutput idTags :: Flags -> IdTags rtaudio :: Flags -> Maybe Rtaudio pulseAudio :: Flags -> Maybe PulseAudio midiIO :: Flags -> MidiIO midiRT :: Flags -> MidiRT rtmidi :: Flags -> Maybe Rtmidi displays :: Flags -> Displays config :: Flags -> Config flagsVerbatim :: Flags -> Maybe String data AudioFileOutput :: * AudioFileOutput :: Maybe FormatSamples -> Maybe FormatType -> Maybe String -> Maybe String -> Bool -> Bool -> Maybe Dither -> AudioFileOutput formatSamples :: AudioFileOutput -> Maybe FormatSamples formatType :: AudioFileOutput -> Maybe FormatType output :: AudioFileOutput -> Maybe String input :: AudioFileOutput -> Maybe String nosound :: AudioFileOutput -> Bool nopeaks :: AudioFileOutput -> Bool dither :: AudioFileOutput -> Maybe Dither data FormatHeader :: * NoHeader :: FormatHeader RewriteHeader :: FormatHeader data FormatSamples :: * Bit24 :: FormatSamples Alaw :: FormatSamples Uchar :: FormatSamples Schar :: FormatSamples FloatSamples :: FormatSamples Ulaw :: FormatSamples Short :: FormatSamples Long :: FormatSamples data FormatType :: * Aiff :: FormatType Au :: FormatType Avr :: FormatType Caf :: FormatType Flac :: FormatType Htk :: FormatType Ircam :: FormatType Mat4 :: FormatType Mat5 :: FormatType Nis :: FormatType Paf :: FormatType Pvf :: FormatType Raw :: FormatType Sd2 :: FormatType Sds :: FormatType Svx :: FormatType Voc :: FormatType W64 :: FormatType Wav :: FormatType Wavex :: FormatType Xi :: FormatType data Dither :: * Triangular :: Dither Uniform :: Dither data IdTags :: * IdTags :: Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> IdTags idArtist :: IdTags -> Maybe String idComment :: IdTags -> Maybe String idCopyright :: IdTags -> Maybe String idDate :: IdTags -> Maybe String idSoftware :: IdTags -> Maybe String idTitle :: IdTags -> Maybe String data Rtaudio :: * PortAudio :: Rtaudio Alsa :: Rtaudio Jack :: String -> String -> String -> Rtaudio jackClient :: Rtaudio -> String jackInport :: Rtaudio -> String jackOutport :: Rtaudio -> String Mme :: Rtaudio CoreAudio :: Rtaudio NoRtaudio :: Rtaudio data PulseAudio :: * PulseAudio :: String -> String -> String -> PulseAudio paServer :: PulseAudio -> String paOutput :: PulseAudio -> String paInput :: PulseAudio -> String data MidiIO :: * MidiIO :: Maybe String -> Maybe String -> Maybe String -> Bool -> Bool -> MidiIO midiFile :: MidiIO -> Maybe String midiOutFile :: MidiIO -> Maybe String muteTracks :: MidiIO -> Maybe String rawControllerMode :: MidiIO -> Bool terminateOnMidi :: MidiIO -> Bool data MidiRT :: * MidiRT :: Maybe String -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe String -> MidiRT midiDevice :: MidiRT -> Maybe String midiKey :: MidiRT -> Maybe Int midiKeyCps :: MidiRT -> Maybe Int midiKeyOct :: MidiRT -> Maybe Int midiKeyPch :: MidiRT -> Maybe Int midiVelocity :: MidiRT -> Maybe Int midiVelocityAmp :: MidiRT -> Maybe Int midiOutDevice :: MidiRT -> Maybe String data Rtmidi :: * PortMidi :: Rtmidi AlsaMidi :: Rtmidi MmeMidi :: Rtmidi WinmmMidi :: Rtmidi VirtualMidi :: Rtmidi NoRtmidi :: Rtmidi data Displays :: * Displays :: Maybe Int -> Maybe DisplayMode -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Bool -> Bool -> Maybe Int -> Displays csdLineNums :: Displays -> Maybe Int displayMode :: Displays -> Maybe DisplayMode displayHeartbeat :: Displays -> Maybe Int messageLevel :: Displays -> Maybe Int mAmps :: Displays -> Maybe Int mRange :: Displays -> Maybe Int mWarnings :: Displays -> Maybe Int mDb :: Displays -> Maybe Int mColours :: Displays -> Maybe Int mBenchmarks :: Displays -> Maybe Int msgColor :: Displays -> Bool displayVerbose :: Displays -> Bool listOpcodes :: Displays -> Maybe Int data DisplayMode :: * NoDisplay :: DisplayMode PostScriptDisplay :: DisplayMode AsciiDisplay :: DisplayMode data Config :: * Config :: Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe String -> Maybe (String, String) -> Maybe (String, String) -> Bool -> Maybe Int -> Maybe (Int, String) -> Maybe Double -> Maybe Int -> Config hwBuf :: Config -> Maybe Int ioBuf :: Config -> Maybe Int newKr :: Config -> Maybe Int newSr :: Config -> Maybe Int scoreIn :: Config -> Maybe String omacro :: Config -> Maybe (String, String) smacro :: Config -> Maybe (String, String) setSched :: Config -> Bool schedNum :: Config -> Maybe Int strsetN :: Config -> Maybe (Int, String) skipSeconds :: Config -> Maybe Double setTempo :: Config -> Maybe Int -- | Rendering of Csound files and playing the music in real time. -- -- How are we going to get the sound out of Haskell code? Instruments are -- ready and we have written all the scores for them. Now, it's time to -- use the rendering functions. We can render haskell expressions to -- Csound code. A rendering function takes a value that represents a -- sound (it's a tuple of signals) and produces a string with Csound -- code. It can take a value that represents the flags for the csound -- compiler and global settings (Options). Then we can save this -- string to file and convert it to sound with csound compiler -- --
-- csound -o music.wav music.csd ---- -- Or we can play it in real time with -odac flag. It sends the sound -- directly to soundcard. It's usefull when we are using midi or tweek -- the parameters in real time with sliders or knobs. -- --
-- csound -odac music.csd ---- -- The main function of this module is renderCsdBy. Other function -- are nothing but wrappers that produce the Csound code and make -- something useful with it (saving to file, playing with specific player -- or in real time). module Csound.IO class RenderCsd a renderCsdBy :: RenderCsd a => Options -> a -> IO String -- | Renders Csound file. renderCsd :: RenderCsd a => a -> IO String -- | Render Csound file and save it to the give file. writeCsd :: RenderCsd a => String -> a -> IO () -- | Render Csound file with options and save it to the give file. writeCsdBy :: RenderCsd a => Options -> String -> a -> IO () -- | Renders Csound file, saves it to the given file, renders with csound -- command and plays it with the given program. -- --
-- playCsd program file csd ---- -- Produces files file.csd (with renderCsd) and -- file.wav (with csound) and then invokes: -- --
-- program "file.wav" --playCsd :: RenderCsd a => (String -> IO ()) -> String -> a -> IO () -- | Works just like playCsd but you can supply csound options. playCsdBy :: RenderCsd a => Options -> (String -> IO ()) -> String -> a -> IO () -- | Renders to tmp.csd and tmp.wav and plays with mplayer. mplayer :: RenderCsd a => a -> IO () -- | Renders to tmp.csd and tmp.wav and plays with mplayer. mplayerBy :: RenderCsd a => Options -> a -> IO () -- | Renders to tmp.csd and tmp.wav and plays with totem player. totem :: RenderCsd a => a -> IO () -- | Renders to tmp.csd and tmp.wav and plays with totem player. totemBy :: RenderCsd a => Options -> a -> IO () -- | Renders csound code to file tmp.csd and plays it with -- -odac option (sound output goes to soundcard in real time). dac :: RenderCsd a => a -> IO () -- | dac with options. dacBy :: RenderCsd a => Options -> a -> IO () -- | Output to dac with virtual midi keyboard. vdac :: RenderCsd a => a -> IO () -- | Output to dac with virtual midi keyboard with specified options. vdacBy :: RenderCsd a => Options -> a -> IO () -- | Renders to file tmp.csd and invokes the csound on it. csd :: RenderCsd a => a -> IO () -- | Renders to file tmp.csd and invokes the csound on it. csdBy :: RenderCsd a => Options -> a -> IO () instance (Sigs a, Sigs b) => RenderCsd (a -> SE b) instance (Sigs a, Sigs b) => RenderCsd (a -> b) instance RenderCsd (SE ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))) instance RenderCsd (SE ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))) instance RenderCsd (SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) instance RenderCsd (SE (Sig, Sig, Sig, Sig, Sig, Sig)) instance RenderCsd (SE (Sig, Sig, Sig, Sig)) instance RenderCsd (SE (Sig, Sig)) instance RenderCsd (SE Sig) instance RenderCsd ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) instance RenderCsd ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) instance RenderCsd (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) instance RenderCsd (Sig, Sig, Sig, Sig, Sig, Sig) instance RenderCsd (Sig, Sig, Sig, Sig) instance RenderCsd (Sig, Sig) instance RenderCsd Sig instance RenderCsd (SE ()) -- | The module contains the modules that are responsible for converting -- events to signals module Csound.Control -- | The Csound types. -- -- There are several primitive types: -- --
-- oscil 0.5 440 sinWave `withInits` (0.5 :: D) --withInits :: (Tuple a, Tuple b) => a -> b -> a -- | A special case of withInits. Here all inits are numbers. withDs :: Tuple a => a -> [D] -> a -- | A special case of withInits. Here all inits are signals. withSigs :: Tuple a => a -> [Sig] -> a -- | A special case of withInits. Here all inits are arrays. withTabs :: Tuple a => a -> [Tab] -> a -- | Appends an init value which is a number. withD :: Tuple a => a -> D -> a -- | Appends an init value which is a signal. withSig :: Tuple a => a -> Sig -> a -- | Appends an init value which is a table. withTab :: Tuple a => a -> Tab -> a -- | Applies a seed to the random value. It's equivalent to the -- withD but it has a special meaning of canceling the side -- effect. When random opcode is provided with seed value it's no longer -- contains a side effect so we don't need to restrict it. withSeed :: SE Sig -> D -> Sig quot' :: SigOrD a => a -> a -> a rem' :: SigOrD a => a -> a -> a div' :: SigOrD a => a -> a -> a mod' :: SigOrD a => a -> a -> a ceil' :: SigOrD a => a -> a floor' :: SigOrD a => a -> a round' :: SigOrD a => a -> a int' :: SigOrD a => a -> a frac' :: SigOrD a => a -> a -- | Creates a constant boolean signal. boolSig :: BoolD -> BoolSig -- | Invokes the given procedure if the boolean signal is true. when1 :: BoolSig -> SE () -> SE () -- | The chain of when1s. Tests all the conditions in sequence if -- everything is false it invokes the procedure given in the second -- argument. whens :: [(BoolSig, SE ())] -> SE () -> SE () type Sig2 = (Sig, Sig) type Sig4 = (Sig, Sig, Sig, Sig) type Sig6 = (Sig, Sig, Sig, Sig, Sig, Sig) type Sig8 = (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) ar1 :: Sig -> Sig ar2 :: (Sig, Sig) -> (Sig, Sig) ar4 :: (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig) ar6 :: (Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig) ar8 :: (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) -- | A tuple of Csound values. class Tuple a tupleMethods :: Tuple a => TupleMethods a -- | Defines instance of type class Tuple for a new type in terms of -- an already defined one. makeTupleMethods :: Tuple a => (a -> b) -> (b -> a) -> TupleMethods b -- | Csound's empty tuple. data Unit :: * -- | Constructs Csound's empty tuple. unit :: Unit -- | ifB for tuples of csound values. ifTuple :: Tuple a => BoolSig -> a -> a -> a -- | guardedB for tuples of csound values. guardedTuple :: Tuple b => [(BoolSig, b)] -> b -> b -- | caseB for tuples of csound values. caseTuple :: Tuple b => a -> [(a -> BoolSig, b)] -> b -> b class Tuple a => Arg a -- | ifB for constants. ifArg :: (Arg a, Tuple a) => BoolD -> a -> a -> a -- | guardedB for constants. guardedArg :: (Tuple b, Arg b) => [(BoolD, b)] -> b -> b -- | caseB for constants. caseArg :: (Tuple b, Arg b) => a -> [(a -> BoolD, b)] -> b -> b -- | The tuples of signals. class Tuple a => Sigs a -- | Creating Function Tables (Buffers) module Csound.Tab -- | Tables (or arrays) data Tab :: * -- | Table size fidelity (how many points in the table by default). data TabFi :: * -- | Sets different table size for different GEN-routines. -- --
-- fineFi n ps ---- -- where -- --
-- coarseFi n ---- -- where n is a degree of 2. For example, n = 10 sets -- size to 1024 points for all tables by default. coarseFi :: Int -> TabFi -- | Table contains all provided values (table is extended to contain all -- values and to be of the power of 2 or the power of two plus one). (by -- default it skips normalization). doubles :: [Double] -> Tab wavs :: String -> Double -> Int -> Tab mp3s :: String -> Double -> Tab type PartialStrength = Double type PartialNumber = Double type PartialPhase = Double type PartialDC = Double -- | Series of harmonic partials: -- --
-- sine = sines [1] ---- --
-- saw = sines $ fmap (1 / ) [1 .. 10] ---- --
-- square = sines $ fmap (1 / ) [1, 3 .. 11] ---- --
-- triangle = sines $ zipWith (\a b -> a / (b ** 2)) (cycle [1, -1]) [1, 3 .. 11] --sines :: [PartialStrength] -> Tab -- | Specifies series of possibly inharmonic partials. sines3 :: [(PartialNumber, PartialStrength, PartialPhase)] -> Tab -- | Just like sines3 but phases are set to zero. sines2 :: [(PartialNumber, PartialStrength)] -> Tab -- | Just like sines2 but partial strength is set to one. sines1 :: [PartialNumber] -> Tab -- | Specifies series of possibly inharmonic partials with direct current. sines4 :: [(PartialNumber, PartialStrength, PartialPhase, PartialDC)] -> Tab -- | Generates values similar to the opcode buzz. -- --
-- buzzes numberOfHarmonics [lowestHarmonic, coefficientOfAttenuation] ---- -- With buzzes n [l, r] you get n harmonics from -- l that are attenuated by the factor of r on each -- step. buzzes :: Double -> [Double] -> Tab -- | Table for pure sine wave. sine :: Tab -- | Table for pure cosine wave. cosine :: Tab -- | Table for sigmoid wave. sigmoid :: Tab -- | Constant segments (sample and hold). -- --
-- consts [a, n1, b, n2, c, ...] ---- -- where -- --
-- lins [a, n1, b, n2, c, ...] ---- -- where -- --
-- cubes [a, n1, b, n2, c, ...] ---- -- where -- --
-- exps [a, n1, b, n2, c, ...] ---- -- where -- --
-- splines [a, n1, b, n2, c, ...] ---- -- where -- --
-- startEnds [val1, dur1, type1, val2, dur2, type2, val3, ... typeX, valN] ---- --
-- beg + (end - beg) * (1 - exp( i*type)) / (1 - exp( ---- --
-- econsts [a, b, c, ...] ---- -- is the same as -- --
-- consts [a, 1, b, 1, c, ...] --econsts :: [Double] -> Tab -- | Equally spaced segments of straight lines. -- --
-- elins [a, b, c, ...] ---- -- is the same as -- --
-- lins [a, 1, b, 1, c, ...] --elins :: [Double] -> Tab -- | Equally spaced segments of cubic polynomials. -- --
-- ecubes [a, b, c, ...] ---- -- is the same as -- --
-- cubes [a, 1, b, 1, c, ...] --ecubes :: [Double] -> Tab -- | Equally spaced segments of exponential curves. -- --
-- eexps [a, b, c, ...] ---- -- is the same as -- --
-- exps [a, 1, b, 1, c, ...] --eexps :: [Double] -> Tab -- | Equally spaced spline curve. -- --
-- esplines [a, b, c, ...] ---- -- is the same as -- --
-- splines [a, 1, b, 1, c, ...] --esplines :: [Double] -> Tab -- | Equally spaced interpolation for the function startEnds -- --
-- estartEnds [val1, type1, val2, typ2, ...] ---- -- is the same as -- --
-- estartEnds [val1, 1, type1, val2, 1, type2, ...] --estartEnds :: [Double] -> Tab -- | Polynomials. -- --
-- polys xl xr [c0, c1, c2, ..] ---- -- where -- --
-- c0 + c1 * x + c2 * x * x + ... --polys :: Double -> Double -> [Double] -> Tab -- | Chebyshev polynomials of the first kind. -- --
-- polys xl xr [h0, h1, h2, ..] ---- -- where -- --
-- polys xl xr [h0, h1, h2, ..] ---- -- where -- --
-- bessels xint ---- -- the function is defined within the interval [0, xint]. bessels :: Double -> Tab winHamming :: [Double] -> Tab winHanning :: [Double] -> Tab winBartlett :: [Double] -> Tab winBlackman :: [Double] -> Tab winHarris :: [Double] -> Tab winGaussian :: [Double] -> Tab winKaiser :: [Double] -> Tab winRectangle :: [Double] -> Tab winSync :: [Double] -> Tab -- | Creates a table of doubles (It's f-table in Csound). Arguments are: -- --
-- on a b biSig --on :: Sig -> Sig -> Sig -> Sig -- | Rescaling of the unipolar signal (0, 1) -> (a, b) -- --
-- on a b uniSig --uon :: Sig -> Sig -> Sig -> Sig -- | Unipolar pure tone. uosc :: Sig -> Sig -- | Unipolar oscBy. uoscBy :: Tab -> Sig -> Sig -- | Unipolar sawtooth. usaw :: Sig -> Sig -- | Unipolar integrated sawtooth. uisaw :: Sig -> Sig -- | Unipolar pulse. upulse :: Sig -> Sig -- | Unipolar square wave. usqr :: Sig -> Sig -- | Unipolar triangle wave. utri :: Sig -> Sig -- | Unipolar band-limited oscillator. ublosc :: Tab -> Sig -> Sig -- | Makes time intervals relative to the note's duration. So that: -- --
-- onIdur [a, t1, b, t2, c] ---- -- becomes: -- --
-- [a, t1 * idur, b, t2 * idur, c] --onIdur :: [D] -> [D] -- | The opcode linseg with time intervals relative to the total -- duration of the note. lindur :: [D] -> Sig -- | The opcode expseg with time intervals relative to the total -- duration of the note. expdur :: [D] -> Sig -- | The opcode linen with time intervals relative to the total -- duration of the note. Total time is set to the value of idur. -- --
-- linendur asig rise decay --linendur :: Sig -> D -> D -> Sig -- | Makes time intervals relative to the note's duration. So that: -- --
-- onDur dt [a, t1, b, t2, c] ---- -- becomes: -- --
-- [a, t1 * dt, b, t2 * dt, c] --onDur :: D -> [D] -> [D] -- | The opcode linseg with time intervals relative to the total -- duration of the note given by the user. lindurBy :: D -> [D] -> Sig -- | The opcode expseg with time intervals relative to the total -- duration of the note given by the user. expdurBy :: D -> [D] -> Sig -- | The opcode linen with time intervals relative to the total -- duration of the note. Total time is set to the value of the first -- argument. -- --
-- linendurBy dt asig rise decay --linendurBy :: D -> Sig -> D -> D -> Sig -- | Reads table once during the note length. once :: Tab -> Sig -- | Reads table once during a given period of time. onceBy :: D -> Tab -> Sig -- | Reads table several times during the note length. several :: Tab -> Sig -> Sig -- | Loops over line segments with the given rate. -- --
-- oscLins [a, durA, b, durB, c, durC ..] cps ---- -- where -- --
-- oscElins [a, b, c] === oscLins [a, 1, b, 1, c] --oscElins :: [D] -> Sig -> Sig -- | Loops over exponential segments with the given rate. -- --
-- oscLins [a, durA, typeA, b, durB, typeB, c, durC, typeC ..] cps ---- -- where -- --
-- oscLins [a, typeA, b, typeB, c, typeC ..] === oscLins [a, 1, typeA, b, 1, typeB, c, 1, typeC ..] --oscEexps :: [D] -> Sig -> Sig -- |
-- oscLine a b cps ---- -- Goes from a to b and back by line segments. One -- period is equal to 2/cps so that one period is passed by -- 1/cps seconds. oscLine :: D -> D -> Sig -> Sig -- | Fades in with the given attack time. fadeIn :: D -> Sig -- | Fades out with the given attack time. fadeOut :: D -> Sig -- | A combination of fade in and fade out. -- --
-- fades attackDuration decayDuration --fades :: D -> D -> Sig -- | Fades in by exponent with the given attack time. expFadeIn :: D -> Sig -- | Fades out by exponent with the given attack time. expFadeOut :: D -> Sig -- | A combination of exponential fade in and fade out. -- --
-- expFades attackDuration decayDuration --expFades :: D -> D -> Sig -- | Low-pass filter. -- --
-- lp cutoff sig --lp :: Sig -> Sig -> Sig -- | High-pass filter. -- --
-- hp cutoff sig --hp :: Sig -> Sig -> Sig -- | Band-pass filter. -- --
-- bp cutoff bandwidth sig --bp :: Sig -> Sig -> Sig -> Sig -- | Band-regect filter. -- --
-- br cutoff bandwidth sig --br :: Sig -> Sig -> Sig -> Sig -- | Low-pass filter. -- --
-- blp cutoff sig --blp :: Sig -> Sig -> Sig -- | High-pass filter. -- --
-- bhp cutoff sig --bhp :: Sig -> Sig -> Sig -- | Band-pass filter. -- --
-- bbp cutoff bandwidth sig --bbp :: Sig -> Sig -> Sig -> Sig -- | Band-regect filter. -- --
-- bbr cutoff bandwidth sig --bbr :: Sig -> Sig -> Sig -> Sig -- | Balanced low-pass filter. lpb :: Sig -> Sig -> Sig -- | Balanced high-pass filter. hpb :: Sig -> Sig -> Sig -- | Balanced band-pass filter. bpb :: Sig -> Sig -> Sig -> Sig -- | Balanced band-reject filter. brb :: Sig -> Sig -> Sig -> Sig -- | Balanced butterworth low-pass filter. blpb :: Sig -> Sig -> Sig -- | Balanced butterworth high-pass filter. bhpb :: Sig -> Sig -> Sig -- | Balanced butterworth band-pass filter. bbpb :: Sig -> Sig -> Sig -> Sig -- | Balanced butterworth band-reject filter. bbrb :: Sig -> Sig -> Sig -> Sig -- | Moog's low-pass filter. -- --
-- mlp centerFrequency qResonance signal --mlp :: Sig -> Sig -> Sig -> Sig readSnd :: String -> (Sig, Sig) loopSnd :: String -> (Sig, Sig) loopSndBy :: D -> String -> (Sig, Sig) readWav :: Sig -> String -> (Sig, Sig) loopWav :: Sig -> String -> (Sig, Sig) readSnd1 :: String -> Sig loopSnd1 :: String -> Sig loopSndBy1 :: D -> String -> Sig readWav1 :: Sig -> String -> Sig loopWav1 :: Sig -> String -> Sig takeSnd :: Sigs a => Double -> a -> a repeatSnd :: Sigs a => D -> a -> a lengthSnd :: String -> D toMono :: (Sig, Sig) -> Sig segments :: D -> Evt (D, Unit) -- | Mean value. mean :: Fractional a => [a] -> a -- | Adds vibrato to the sound unit. Sound units is a function that takes -- in a frequency. vibrate :: Sig -> Sig -> (Sig -> a) -> (Sig -> a) -- | Adds a random vibrato to the sound unit. Sound units is a function -- that takes in a frequency. randomPitch :: Sig -> Sig -> (Sig -> a) -> (Sig -> SE a) -- | Chorus takes a list of displacments from the base frequencies and a -- sound unit. Output is mean of signals with displacments that is -- applied to the base frequency. chorus :: Fractional a => [Sig] -> (Sig -> a) -> Sig -> a -- | Applies a resonator to the signals. A resonator is a list of band pass -- filters. A list contains the parameters for the filters: -- --
-- [(centerFrequency, bandWidth)] --resons :: [(Sig, Sig)] -> Sig -> Sig -- | A resonator with user defined band pass filter. Warning: a filter -- takes in a center frequency, band width and the signal. The signal -- comes last (this order is not standard in the Csound but it's more -- convinient to use with Haskell). resonsBy :: (cps -> bw -> Sig -> Sig) -> [(cps, bw)] -> Sig -> Sig -- | Chain of mass-spring-damping filters. -- --
-- modes params baseCps exciter ---- --
-- dryWet ratio effect asig ---- --
-- reverbsc1 asig feedbackLevel cutOffFreq --reverbsc1 :: Sig -> Sig -> Sig -> Sig -- | Mono reverb (based on reverbsc) -- --
-- rever1 feedback asig --rever1 :: Sig -> Sig -> (Sig, Sig) -- | Mono reverb (based on reverbsc) -- --
-- rever2 feedback asigLeft asigRight --rever2 :: Sig -> Sig -> Sig -> (Sig, Sig) -- | Reverb with given time. reverTime :: Sig -> Sig -> Sig -- | Mono reverb for small room. smallRoom :: Sig -> (Sig, Sig) -- | Mono reverb for small hall. smallHall :: Sig -> (Sig, Sig) -- | Mono reverb for large hall. largeHall :: Sig -> (Sig, Sig) -- | The magic cave reverb (mono). magicCave :: Sig -> (Sig, Sig) -- | Stereo reverb for small room. smallRoom2 :: Sig -> Sig -> (Sig, Sig) -- | Stereo reverb for small hall. smallHall2 :: Sig -> Sig -> (Sig, Sig) -- | Stereo reverb for large hall. largeHall2 :: Sig -> Sig -> (Sig, Sig) -- | The magic cave reverb (stereo). magicCave2 :: Sig -> Sig -> (Sig, Sig) -- | Basic types and functions. -- -- This module re-exports everything. -- -- WARNING (for Csound users): the maximum amplitude is 1.0. There is no -- way to alter it. Don't define your amplitudes with 9000 or 11000. But -- the good news are: all signals are clipped by 1 so that you can not -- damage your ears and your speakers by a little typo. module Csound.Base