-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | library to make electronic music -- @package csound-expression @version 4.3 -- | Properties that specify the appearance of the GUI elements. The -- specification is inspired by CSS. All properties are set in the -- cascade manner. For example, if you want to change the font type for -- all elements you should set this property only for the top-most GUI -- element. If the property is set on the lower level it wins versus -- property that is set on the higher level. module Csound.Control.Gui.Props -- | Sets the properties for a GUI element. props :: [Prop] -> Gui -> Gui -- | Sets the properties for a GUI element on all levels. forceProps :: [Prop] -> Gui -> Gui -- | Properties of the widgets. data Prop :: * SetLabel :: String -> Prop SetMaterial :: Material -> Prop SetBoxType :: BoxType -> Prop SetColor1 :: Color -> Prop SetColor2 :: Color -> Prop SetTextColor :: Color -> Prop SetFontSize :: Int -> Prop SetFontType :: FontType -> Prop SetEmphasis :: Emphasis -> Prop SetSliderType :: SliderType -> Prop SetTextType :: TextType -> Prop SetButtonType :: ButtonType -> Prop SetOrient :: Orient -> Prop SetKnobType :: KnobType -> Prop SetLabelType :: LabelType -> Prop data BorderType :: * NoBorder :: BorderType DownBoxBorder :: BorderType UpBoxBorder :: BorderType EngravedBorder :: BorderType EmbossedBorder :: BorderType BlackLine :: BorderType ThinDown :: BorderType ThinUp :: BorderType -- | The Csound colours. type Color = Colour Double -- | A rectangle. data Rect :: * Rect :: Int -> Int -> Int -> Int -> Rect px :: Rect -> Int py :: Rect -> Int width :: Rect -> Int height :: Rect -> Int data FontType :: * Helvetica :: FontType Courier :: FontType Times :: FontType Symbol :: FontType Screen :: FontType Dingbats :: FontType data Emphasis :: * NoEmphasis :: Emphasis Italic :: Emphasis Bold :: Emphasis BoldItalic :: Emphasis -- | The type of the material of the element. It affects sliders and -- buttons. data Material :: * NoPlastic :: Material Plastic :: Material -- | The orientation of the widget (slider, roller). This property is never -- needs to be set in practice. If this property is not set then default -- orientation is calculated from the bounding box of the widget. If the -- width is greater than the height then we need to use a horizontal -- widget otherwise it should be a vertical one. data Orient :: * Hor :: Orient Ver :: Orient setBorder :: BorderType -> Gui -> Gui setLabel :: String -> Gui -> Gui setMaterial :: Material -> Gui -> Gui setColor1 :: Color -> Gui -> Gui setColor2 :: Color -> Gui -> Gui setColors :: Color -> Color -> Gui -> Gui setTextColor :: Color -> Gui -> Gui setFontSize :: Int -> Gui -> Gui setFontType :: FontType -> Gui -> Gui setEmphasis :: Emphasis -> Gui -> Gui setOrient :: Orient -> Gui -> Gui -- | The functions from this module specify the geometry of the -- GUI-elements. They tell where to render the elements. -- -- Every element is rectangular. To know where to place the element is to -- know the parameters of the bounding rectangle. All rectangles are -- relative and automatically aligned. -- -- We have two functions for grouping. They construct horizontal and -- vertical groups of the elements. Within the group we can change the -- relative size of the rectangles (by scaling one side of the -- rectangle). In place of rectangle we can put an empty space. module Csound.Control.Gui.Layout -- | Horizontal groupping of the elements. All elements are placed in the -- stright horizontal line and aligned by Y-coordinate and height. hor :: [Gui] -> Gui -- | Vertical groupping of the elements. All elements are placed in the -- stright vertical line and aligned by X-coordinate and width. ver :: [Gui] -> Gui -- | An empty space. space :: Gui -- | Scales an element within the group. It depends on the type of the -- alignment (horizontal or vertical) which side of the bounding box is -- scaled. If it's a horizontal group then the width is scaled and height -- is scaled otherwise. -- -- Every element in the group has a scaling factor. By default it equals -- to one. During rendering all scaling factors are summed and divided on -- the sum of all factors. So that factors become weights or proportions. -- This process is called normalization. Scaling one element affects not -- only this element but all other elements in the group! -- -- An example: -- -- One element is twice as large as the other two: -- --
-- 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 -- | Named channels. -- -- With named channels we can read and write values to the variables with -- dynamic names. We can specify the variable with string (Str). -- -- Csound has an C api wich is ported to many languages. With named -- channels we can interact with csound that runns a program. We can read -- and write to named channels from another program. module Csound.Control.Channel -- | Reads a value of type double. chnGetD :: Str -> SE D -- | Reads an audio signal. chnGetSig :: Str -> SE Sig -- | Reads a control signal. The control signals are updated at the lower -- rate. chnGetCtrl :: Str -> SE Sig -- | Reads a string. chnGetStr :: Str -> SE Str -- | Writes a value of type double. chnSetD :: D -> Str -> SE () -- | Writes an audio signal. chnSetSig :: Sig -> Str -> SE () -- | Writes a control signal. The control signals are updated at the lower -- rate. chnSetCtrl :: Sig -> Str -> SE () -- | Writes a string. chnSetStr :: Str -> Str -> SE () -- | Open Sound Control. module Csound.Control.Osc -- | Initializes host client. The process starts to run in the background. initOsc :: OscPort -> SE OscRef -- | Listens for the OSC-messages. The first argument is OSC-reference. We -- can create it with the function oscInit. The next two -- arguments are strings. The former specifies the path-like address to -- listen the messages. It can be: -- --
-- /foo/bar/baz ---- -- The latter specifies the type of expected arguments. The string can -- contain the characters "bcdfilmst" which stand for Boolean, character, -- double, float, 32-bit integer, 64-bit integer, MIDI, string and -- timestamp. -- -- The result is an event of messages. We can run a callback on it with -- standard function runEvt: -- --
-- runEvt :: Evt a -> (a -> SE ()) -> SE () --listenOsc :: Tuple a => OscRef -> OscAddress -> OscType -> Evt a -- | Sends OSC-messages. It takes in a name of the host computer (empty -- string is alocal machine), port on which the target machine is -- listening, OSC-addres and type. The last argument produces the values -- for OSC-messages. sendOsc :: Tuple a => OscHost -> OscPort -> OscAddress -> OscType -> Evt a -> SE () -- | Midi. module Csound.Control.Midi 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 :: (Num a, Sigs a) => (Msg -> SE a) -> SE a -- | Triggers a midi-instrument (aka Csound's massign) on the specified -- channel. midin :: (Num a, Sigs a) => Channel -> (Msg -> SE a) -> SE a -- | Triggers a midi-instrument (aka Csound's pgmassign) on the specified -- programm bank. pgmidi :: (Num a, Sigs a) => Maybe Int -> Channel -> (Msg -> SE a) -> SE 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 () -- | Produces midi amplitude and frequency as a signal. The signal fades -- out when nothing is pressed. It can be used in mono-synths. Arguments -- are portamento time and release time. A portamento time is time it -- takes for transition from one note to another. -- --
-- monoMsg portamentoTime releaseTime --monoMsg :: D -> D -> SE (Sig, Sig) -- | Produces midi amplitude and frequency as a signal and holds the last -- value till the next one is present. It can be used in mono-synths. -- Arguments are portamento time and release time. A portamento time is -- time it takes for transition from one note to another. -- --
-- holdMsg portamentoTime --holdMsg :: D -> SE (Sig, Sig) -- | Produces midi amplitude and frequency as a signal. The signal fades -- out when nothing is pressed. We can specify a channel. It can be used -- in mono-synths. Arguments are portamento time and release time. A -- portamento time is time it takes for transition from one note to -- another. -- --
-- monoMsgn chnNumber portamentoTime releaseTime --monoMsgn :: Channel -> D -> D -> SE (Sig, Sig) -- | Produces midi amplitude and frequency as a signal and holds the last -- value till the next one is present. We can specify a channel. It can -- be used in mono-synths. Arguments are portamento time and release -- time. A portamento time is time it takes for transition from one note -- to another. -- --
-- holdMsgn chnNumber portamentoTime --holdMsgn :: Channel -> D -> SE (Sig, Sig) -- | Produces midi amplitude and frequency as a signal. The signal fades -- out when nothing is pressed. We can specify a programm number and -- channel. It can be used in mono-synths. Arguments are portamento time -- and release time. A portamento time is time it takes for transition -- from one note to another. -- --
-- pgmonoMsg chnNumber portamentoTime releaseTime --pgmonoMsg :: Maybe Int -> Channel -> D -> D -> SE (Sig, Sig) -- | Produces midi amplitude and frequency as a signal and holds the last -- value till the next one is present. We can specify a programm number -- and channel. It can be used in mono-synths. Arguments are portamento -- time and release time. A portamento time is time it takes for -- transition from one note to another. -- --
-- pgholdMsg portamentoTime --pgholdMsg :: Maybe Int -> Channel -> D -> SE (Sig, Sig) -- | 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 -- | Initialization of the midi control-messages. initc7 :: D -> D -> D -> SE () -- | Allows a floating-point 7-bit MIDI signal scaled with a minimum and a -- maximum range. -- --
-- idest ctrl7 ichan, ictlno, imin, imax [, ifn] -- kdest ctrl7 ichan, ictlno, kmin, kmax [, ifn] -- adest ctrl7 ichan, ictlno, kmin, kmax [, ifn] [, icutoff] ---- -- csound doc: http://www.csounds.com/manual/html/ctrl7.html ctrl7 :: D -> D -> D -> D -> Sig -- | Initializes midi control and get the value in the specified range. midiCtrl7 :: D -> D -> D -> D -> D -> SE Sig -- | Initializes midi control and get the value in the range (-1) to 1. midiCtrl :: D -> D -> D -> SE Sig -- | Unipolar midiCtrl. Initializes midi control and get the value in the -- range 0 to 1. umidiCtrl :: D -> D -> D -> SE Sig -- | 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) 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 :: * -> * writeSERef :: Tuple a => SERef a -> a -> SE () readSERef :: Tuple a => SERef a -> SE a -- | Modifies the SERef value with given function. modifySERef :: Tuple a => SERef a -> (a -> a) -> SE () -- | Adds the given signal to the value that is contained in the reference. mixSERef :: (Num a, Tuple a) => SERef a -> a -> SE () -- | Allocates a new local (it is visible within the instrument) 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 ()) -- | Allocates a new global mutable value and initializes it with value. A -- reference can contain a tuple of variables. newGlobalSERef :: 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. globalSensorsSE :: Tuple a => a -> SE (SE a, a -> SE ()) -- | Spectral functions module Csound.Air.Spec -- | Converts signal to spectrum. toSpec :: Sig -> Spec -- | Converts spectrum to signal. fromSpec :: Spec -> Sig -- | Applies a transformation to the spectrum of the signal. mapSpec :: (Spec -> Spec) -> Sig -> Sig -- | Scales all frequencies. Usefull for transposition. For example, we can -- transpose a signal by the given amount of semitones: -- --
-- scaleSpec (semitone 1) asig --scaleSpec :: Sig -> Sig -> Sig -- | Adds given amount of Hz to all frequencies. -- --
-- addSpec hz asig --addSpec :: Sig -> Sig -> Sig -- | Scales frequency in semitones. scalePitch :: Sig -> Sig -> Sig -- | Filters module Csound.Air.Filter -- | Low-pass filter. -- --
-- lp cutoff resonance sig --lp :: Sig -> Sig -> Sig -> Sig -- | High-pass filter. -- --
-- hp cutoff resonance sig --hp :: Sig -> Sig -> Sig -> Sig -- | Band-pass filter. -- --
-- bp cutoff resonance sig --bp :: Sig -> Sig -> Sig -> Sig -- | Band-reject filter. -- --
-- br cutoff resonance sig --br :: Sig -> Sig -> Sig -> Sig -- | All-pass filter. -- --
-- alp cutoff resonance sig --alp :: 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 -- | Moog's low-pass filter. -- --
-- mlp centerFrequency qResonance signal --mlp :: Sig -> Sig -> Sig -> Sig -- | Produces smooth transitions between values in the signals. The first -- value defines a duration in seconds for a transition from one value to -- another in piecewise constant signals. slide :: Sig -> Sig -> Sig module Csound.SigSpace -- | A class for easy way to process the outputs of the instruments. class SigSpace a mapSig :: SigSpace a => (Sig -> Sig) -> a -> a -- | A class for easy way to process the outputs of the instruments. class SigSpace a => BindSig a bindSig :: BindSig a => (Sig -> SE Sig) -> a -> SE a -- | Scaling the sound. mul :: SigSpace a => Sig -> a -> a -- | A shortcut for mapSig. at :: SigSpace a => (Sig -> Sig) -> a -> a -- | Crossfade. -- --
-- 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 :: (Num a, SigSpace a) => Sig -> a -> a -> a -- | Bilinear interpolation for four signals. The signals are placed in the -- corners of the unit square. The first two signals are the xy -- coordinates in the square. -- --
-- cfd4 x y a b c d ---- --
-- cfds coeffs sigs --cfds :: (Num a, SigSpace a) => [Sig] -> [a] -> a -- | Spectral crossfade. cfdSpec :: Sig -> Spec -> Spec -> Spec -- | Spectral bilinear crossfade (see cfd4). cfdSpec4 :: Sig -> Sig -> Spec -> Spec -> Spec -> Spec -> Spec -- | Generic spectral crossfade. cfdsSpec :: [Sig] -> [Spec] -> Spec -- | Weighted sum. wsum :: (Num a, 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 BindSig (SE (Sig, Sig, Sig, Sig)) instance SigSpace (SE (Sig, Sig, Sig, Sig)) instance BindSig (SE (Sig, Sig, Sig)) instance SigSpace (SE (Sig, Sig, Sig)) instance BindSig (SE (Sig, Sig)) instance SigSpace (SE (Sig, Sig)) instance BindSig (SE Sig) instance SigSpace (SE Sig) instance BindSig (Sig, Sig, Sig, Sig) instance SigSpace (Sig, Sig, Sig, Sig) instance BindSig (Sig, Sig, Sig) instance SigSpace (Sig, Sig, Sig) instance BindSig (Sig, Sig) instance SigSpace (Sig, Sig) instance BindSig Sig instance SigSpace Sig -- | Sound fonts. Playing Sf2 samples. -- -- There are three groups of functions. Functions that are defined for -- midi messages, midi notes (it's a pair of integers from 0-127) and the -- frequencies (in Hz). Each group contains four functions. They are -- destinguished by suffixes. The function with no suffix play a sf2 file -- with linear interpolation and take stereo output. The function with -- suffix 3 read samples with cubic interpolation. The functions -- with suffix m produce mono outputs. The loopers play samples -- in loops. module Csound.Control.Sf -- | The sf2 sound font preset. It is defined with file name, bank and -- program integers. data Sf :: * Sf :: String -> Int -> Int -> Sf -- | Creates a midi instrument from sf2 sound font. Midi listens on all -- channels. It's useful to quickly test a sound font. The second -- argument is a sustain in seconds. How long it takes for the sound to -- decay. sf2 :: Sf -> D -> SE (Sig, Sig) -- | Creates a midi instrument from sf2 sound font file. The second -- argument is sustain in seconds. Reads samples with linear -- interpolation. sfMsg :: Sf -> D -> Msg -> SE (Sig, Sig) -- | Creates a midi instrument from sf2 sound font file. The second -- argument is sustain in seconds. Reads samples with cubic -- interpolation. sfMsg3 :: Sf -> D -> Msg -> SE (Sig, Sig) -- | Creates a midi instrument from sf2 sound font file. The second -- argument is sustain in seconds. Reads samples with linear -- interpolation. Produces mono output. sfMsgm :: Sf -> D -> Msg -> SE Sig -- | Creates a midi instrument from sf2 sound font file. The second -- argument is sustain in seconds. Reads samples with cubic -- interpolation. Produces mono output. sfMsg3m :: Sf -> D -> Msg -> SE Sig -- | Midi looper of the sf2 samples. The first arguments are: start, end, -- crossfade of the loop. sfMsgLooper :: Sig -> Sig -> Sig -> Sf -> D -> Msg -> SE (Sig, Sig) -- | Reads sf2 samples at given midi velocity and key (both are from 0 to -- 127). The second argument is sustain. Interpolation is linear. sfKey :: Sf -> D -> D -> D -> (Sig, Sig) -- | Reads sf2 samples at given midi velocity and key (both are from 0 to -- 127). The second argument is sustain. Interpolation is cubic. sfKey3 :: Sf -> D -> D -> D -> (Sig, Sig) -- | Reads sf2 samples at given midi velocity and key (both are from 0 to -- 127). The second argument is sustain. Interpolation is linear. The -- output is mono. sfKeym :: Sf -> D -> D -> D -> Sig -- | Reads sf2 samples at given midi velocity and key (both are from 0 to -- 127). The second argument is sustain. Interpolation is cubic. The -- output is mono. sfKey3m :: Sf -> D -> D -> D -> Sig -- | Looper of the sf2 samples. The first arguments are: start, end, -- crossfade of the loop. sfKeyLooper :: Sig -> Sig -> Sig -> Sf -> D -> D -> D -> (Sig, Sig) -- | Reads sf2 samples with amplitude in (0, 1) and frequency in Hz. The -- interpolation is linear. sfCps :: Sf -> D -> D -> D -> (Sig, Sig) -- | Reads sf2 samples with amplitude in (0, 1) and frequency in Hz. The -- interpolation is cubic. sfCps3 :: Sf -> D -> D -> D -> (Sig, Sig) -- | Reads sf2 samples with amplitude in (0, 1) and frequency in Hz. The -- interpolation is linear. The output is mono. sfCpsm :: Sf -> D -> D -> D -> Sig -- | Reads sf2 samples with amplitude in (0, 1) and frequency in Hz. The -- interpolation is cubic. The output is mono. sfCps3m :: Sf -> D -> D -> D -> Sig -- | Looper of the sf2 samples. The first arguments are: start, end, -- crossfade of the loop. sfCpsLooper :: Sig -> Sig -> Sig -> Sf -> D -> D -> D -> (Sig, 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 the global duration of the file or output signal to the given -- value. It should be used only once! The proper place is in the -- top-most expression before sending to dac or -- writeWav. setDur :: Sigs a => D -> a -> a -- | 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 -- | Sets the output to nosound. setSilent :: 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 -- | 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 () whileDo :: BoolSig -> SE () -> SE () untilDo :: BoolSig -> 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 -- | Gets an control/audio-rate value from the list by index. atTuple :: Tuple a => [a] -> Sig -> a -- | 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 -- | Gets an init-rate value from the list by index. atArg :: (Tuple a, Arg a) => [a] -> D -> 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 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 -- | Fires a single event in the given time ahead. impulseE :: D -> 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 -- | Fires a single event right now. -- --
-- loadbang = pulseE 0 --loadbang :: Evt Unit -- | Fires a single true value in the given time ahead. impulse :: D -> Sig -- | Constant event stream. It produces the same value (the first argument) -- all the time. devt :: D -> Evt a -> Evt D -- | Makes an event stream from list of events. eventList :: [(D, D, a)] -> Evt [(D, D, a)] -- | 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) -- | Represents a values with frequency of occurence. type Rnds a = [(D, a)] -- | 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 stram of lists of random values in the interval (0, -- 1). The first argument is the length of the each list. randList :: Int -> 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 -- | 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 :: D -> Evt a -> Evt (D, a) -- | 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) --trigs :: (Arg a, Sigs b) => (a -> SE b) -> Evt [(D, D, a)] -> b -- | It's like the function trigs, but delay is set to zero. scheds :: (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. schedHarps :: (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. schedUntils :: (Arg a, Sigs b) => (a -> SE b) -> Evt [a] -> Evt c -> b -- | Triggers a procedure on the event stream. trigs_ :: Arg a => (a -> SE ()) -> Evt [(D, D, a)] -> SE () -- | Triggers a procedure on the event stream. A delay time is set to zero. scheds_ :: 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. schedUntils_ :: Arg a => (a -> SE ()) -> Evt [a] -> Evt c -> SE () -- | A closure to trigger an instrument inside the body of another -- instrument. trigsBy :: (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. schedsBy :: (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. schedHarpsBy :: (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 -- scheds, schedsBy, scheds_. withDurs :: 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)) -- | 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.com/manual/html/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 -> Bool -> 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 -> Bool -> 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) -- | FLtext that is sink shows current the value of a valuator in a text -- field. setNumeric :: String -> ValDiap -> ValStep -> Double -> Sink Sig -- | A slider that serves as indicator. It consumes values instead of -- producing. -- --
-- meter valueSpan initValue --meter :: String -> ValSpan -> Double -> Sink Sig setToggle :: String -> Bool -> SinkSource (Evt D) setToggleSig :: String -> Bool -> SinkSource 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 -- | Unipolar linear knob. The value belongs to the interval [0, 1]. The -- argument is for initial value. uknob :: Double -> Source Sig -- | Exponential knob (usefull for exploring frequencies or decibels). -- --
-- xknob min max initVal ---- -- The value belongs to the interval [min, max]. The last argument is for -- initial value. xknob :: Double -> Double -> Double -> Source Sig -- | Unipolar linear slider. The value belongs to the interval [0, 1]. The -- argument is for initial value. uslider :: Double -> Source Sig -- | Exponential slider (usefull for exploring frequencies or decibels). -- --
-- xknob min max initVal ---- -- The value belongs to the interval [min, max]. The last argument is for -- initial value. xslider :: Double -> Double -> Double -> Source Sig -- | Unit linear joystick. ujoy :: (Double, Double) -> Source (Sig, Sig) -- | Horizontal radio group. hradio :: [String] -> Int -> Source (Evt D) -- | Vertical radio group. vradio :: [String] -> Int -> Source (Evt D) -- | Horizontal radio group. hradioSig :: [String] -> Int -> Source Sig -- | Vertical radio group. vradioSig :: [String] -> Int -> Source Sig -- | The sample and hold widget. You can pick a value from the list of -- doubles. The original value is a head of the list (the first element). -- The visual grouping is horizontal (notice the prefix h). It's -- common to use it with function selector. hnumbers :: [Double] -> Source Sig -- | The sample and hold widget. You can pick a value from the list of -- doubles. The original value is a head of the list (the first element). -- The visual grouping is vertical (notice the prefix v). It's -- common to use it with function selector. vnumbers :: [Double] -> Source Sig -- | The matrix of unipolar knobs. -- --
-- knobPad columnNum rowNum names initVals ---- -- It takes in the dimensions of matrix, the names (we can leave it empty -- if names are not important) and list of init values. It returns a -- function that takes in indices and produces the signal in the -- corresponding cell. knobPad :: Int -> Int -> [String] -> [Double] -> Source (Int -> Int -> Sig) -- | The matrix of toggle buttons. -- --
-- togglePad columnNum rowNum names initVals ---- -- It takes in the dimensions of matrix, the names (we can leave it empty -- if names are not important) and list of init values (on/off booleans). -- It returns a function that takes in indices and produces the event -- stream in the corresponding cell. togglePad :: Int -> Int -> [String] -> [Bool] -> Source (Int -> Int -> Evt D) -- | The matrix of buttons. -- --
-- buttonPad columnNum rowNum names ---- -- It takes in the dimensions of matrix, the names (we can leave it empty -- if names are not important). It returns a function that takes in -- indices and produces the event stream in the corresponding cell. buttonPad :: Int -> Int -> [String] -> Source (Int -> Int -> Evt Unit) -- | A generic constructor for matrixes of sound source widgets. It takes -- the constructor of the widget, a default initial value, the dimensions -- of the matrix, the list of names and the list of initial values. It -- produces the function that maps indices to corresponding values. genPad :: (String -> a -> Source b) -> a -> Int -> Int -> [String] -> [a] -> Source (Int -> Int -> b) -- | 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: -- --
-- win name (width, height) gui --win :: String -> (Int, Int) -> Gui -> SE () -- | Renders a list of panels. panels :: [Gui] -> SE () -- | Renders the GUI elements on the window. We can specify the window -- title and rectangle of the window. panelBy :: String -> Maybe Rect -> Gui -> SE () -- | Renders the GUI elements on the window. Rectangle is calculated -- automatically (window listens for keyboard events). keyPanel :: Gui -> SE () keyWin :: String -> (Int, Int) -> Gui -> SE () -- | Renders a list of panels. Panels are sensitive to keyboard events. keyPanels :: [Gui] -> SE () -- | Renders the GUI elements on the window. We can specify the window -- title and rectangle of the window. Panesls are sensitive to keyboard -- events. keyPanelBy :: String -> Maybe Rect -> Gui -> SE () -- | The shortcut for mapSource. lift1 :: (a -> b) -> Source a -> Source b -- | Combines two sound sources. Visuals are aligned horizontally and the -- sound sources a grouped with the given function. hlift2 :: (a -> b -> c) -> Source a -> Source b -> Source c -- | Combines two sound sources. Visuals are aligned vertically and the -- sound sources a grouped with the given function. vlift2 :: (a -> b -> c) -> Source a -> Source b -> Source c -- | The same as hlift2 but for three sound sources. hlift3 :: (a -> b -> c -> d) -> Source a -> Source b -> Source c -> Source d -- | The same as vlift2 but for three sound sources. vlift3 :: (a -> b -> c -> d) -> Source a -> Source b -> Source c -> Source d -- | The same as hlift2 but for four sound sources. hlift4 :: (a -> b -> c -> d -> e) -> Source a -> Source b -> Source c -> Source d -> Source e -- | The same as vlift2 but for four sound sources. vlift4 :: (a -> b -> c -> d -> e) -> Source a -> Source b -> Source c -> Source d -> Source e -- | The same as hlift2 but for five sound sources. hlift5 :: (a1 -> a2 -> a3 -> a4 -> a5 -> b) -> Source a1 -> Source a2 -> Source a3 -> Source a4 -> Source a5 -> Source b -- | The same as vlift2 but for five sound sources. vlift5 :: (a1 -> a2 -> a3 -> a4 -> a5 -> b) -> Source a1 -> Source a2 -> Source a3 -> Source a4 -> Source a5 -> Source b -- | It's just like the hlift2 but two more parameters change -- visual scaling of the widgets. hlift2' :: Double -> Double -> (a -> b -> c) -> Source a -> Source b -> Source c -- | It's just like the vlift2 but two more parameters change -- visual scaling of the widgets. vlift2' :: Double -> Double -> (a -> b -> c) -> Source a -> Source b -> Source c -- | The same as hlift2' but for three sound sources. hlift3' :: Double -> Double -> Double -> (a -> b -> c -> d) -> Source a -> Source b -> Source c -> Source d -- | The same as vlift2' but for three sound sources. vlift3' :: Double -> Double -> Double -> (a -> b -> c -> d) -> Source a -> Source b -> Source c -> Source d -- | The same as hlift2' but for four sound sources. hlift4' :: Double -> Double -> Double -> Double -> (a -> b -> c -> d -> e) -> Source a -> Source b -> Source c -> Source d -> Source e -- | The same as vlift2' but for four sound sources. vlift4' :: Double -> Double -> Double -> Double -> (a -> b -> c -> d -> e) -> Source a -> Source b -> Source c -> Source d -> Source e -- | The same as hlift2' but for five sound sources. hlift5' :: Double -> Double -> Double -> Double -> Double -> (a1 -> a2 -> a3 -> a4 -> a5 -> b) -> Source a1 -> Source a2 -> Source a3 -> Source a4 -> Source a5 -> Source b -- | The same as vlift2' but for five sound sources. vlift5' :: Double -> Double -> Double -> Double -> Double -> (a1 -> a2 -> a3 -> a4 -> a5 -> b) -> Source a1 -> Source a2 -> Source a3 -> Source a4 -> Source a5 -> Source b instance SigSpace a => SigSpace (Source a) -- | The module contains the modules that are responsible for converting -- events to signals module Csound.Control -- | 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 () -- | Render Csound file and save result sound to the wav-file. writeSnd :: RenderCsd a => String -> a -> IO () -- | Render Csound file with options and save result sound to the wav-file. writeSndBy :: 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 RenderCsd (Source (SE Sig4)) instance RenderCsd (Source (SE Sig2)) instance RenderCsd (Source (SE Sig)) instance RenderCsd (Source Sig4) instance RenderCsd (Source Sig2) instance RenderCsd (Source Sig) 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 ()) -- | Creating Function Tables (Buffers) module Csound.Tab -- | Tables (or arrays) data Tab :: * -- | nsamp — Returns the number of samples loaded into a stored function -- table number. -- --
-- nsamp(x) (init-rate args only) ---- -- csound doc: http://www.csounds.com/manual/html/nsamp.html nsamp :: Tab -> D -- | Returns a length of the table. ftlen :: Tab -> D -- | Returns the sample rate for a table that stores wav files ftsr :: Tab -> D -- | Returns the number of channels for a table that stores wav files ftchnls :: Tab -> D -- | Returns the base frequency for a table that stores wav files ftcps :: Tab -> D -- | 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(type * dur)) ---- --
-- 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 :: SigSpace a => Sig -> Sig -> a -> a -- | Rescaling of the unipolar signal (0, 1) -> (a, b) -- --
-- on a b uniSig --uon :: SigSpace a => Sig -> Sig -> a -> a -- | 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 -- | Constant random signal. It updates random numbers with given -- frequency. -- --
-- constRnd freq --rndh :: Sig -> SE Sig -- | Unipolar rndh urndh :: Sig -> SE Sig -- | Linear random signal. It updates random numbers with given frequency. -- --
-- rndi freq --rndi :: Sig -> SE Sig -- | Unipolar rndi urndi :: Sig -> SE Sig -- | White noise. white :: SE Sig -- | Pink noise. pink :: SE Sig -- | Low frequency oscillator type Lfo = Sig -- | Low frequency oscillator -- --
-- lfo shape depth rate --lfo :: (Sig -> Sig) -> Sig -> Sig -> Sig -- | Envelopes module Csound.Air.Envelope -- | Linear adsr envelope generator with release -- --
-- leg attack decay sustain release --leg :: D -> D -> D -> D -> Sig -- | Exponential adsr envelope generator with release -- --
-- xeg attack decay sustain release --xeg :: D -> D -> D -> D -> 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 -- | Looping sample and hold envelope. The first argument is the list of -- pairs: -- --
-- [a, durA, b, durB, c, durc, ...] ---- -- It's a list of values and durations. The durations are relative to the -- period of repetition. The period is specified with the second -- argument. The second argument is the frequency of repetition measured -- in Hz. -- --
-- lpshold valDurs frequency --lpshold :: [Sig] -> Sig -> Sig -- | Looping linear segments envelope. The first argument is the list of -- pairs: -- --
-- [a, durA, b, durB, c, durc, ...] ---- -- It's a list of values and durations. The durations are relative to the -- period of repetition. The period is specified with the second -- argument. The second argument is the frequency of repetition measured -- in Hz. -- --
-- loopseg valDurs frequency --loopseg :: [Sig] -> Sig -> Sig -- | Looping exponential segments envelope. The first argument is the list -- of pairs: -- --
-- [a, durA, b, durB, c, durc, ...] ---- -- It's a list of values and durations. The durations are relative to the -- period of repetition. The period is specified with the second -- argument. The second argument is the frequency of repetition measured -- in Hz. -- --
-- loopxseg valDurs frequency --loopxseg :: [Sig] -> Sig -> Sig -- | It's like lpshold but we can specify the phase of repetition (phase -- belongs to [0, 1]). lpsholdBy :: D -> [Sig] -> Sig -> Sig -- | It's like loopseg but we can specify the phase of repetition (phase -- belongs to [0, 1]). loopsegBy :: D -> [Sig] -> Sig -> Sig -- | It's like loopxseg but we can specify the phase of repetition (phase -- belongs to [0, 1]). loopxsegBy :: D -> [Sig] -> Sig -> Sig -- | The looping sequence of constant segments. -- --
-- linSeg [a, durA, b, durB, c, durC, ...] [scale1, scale2, scale3] cps ---- -- The first argument is the list that specifies the shape of the looping -- wave. It's the alternating values and durations of transition from one -- value to another. The durations are relative to the period. So that -- lists -- --
-- [0, 0.5, 1, 0.5, 0] and [0, 50, 1, 50, 0] ---- -- produce the same results. The second list is the list of scales for -- subsequent periods. Every value in the period is scaled with values -- from the second list. The last argument is the rate of repetition -- (Hz). holdSeq :: [Sig] -> [Sig] -> Sig -> Sig -- | The looping sequence of linear segments. -- --
-- linSeg [a, durA, b, durB, c, durC, ...] [scale1, scale2, scale3] cps ---- -- The first argument is the list that specifies the shape of the looping -- wave. It's the alternating values and durations of transition from one -- value to another. The durations are relative to the period. So that -- lists -- --
-- [0, 0.5, 1, 0.5, 0] and [0, 50, 1, 50, 0] ---- -- produce the same results. The second list is the list of scales for -- subsequent periods. Every value in the period is scaled with values -- from the second list. The last argument is the rate of repetition -- (Hz). linSeq :: [Sig] -> [Sig] -> Sig -> Sig -- | The looping sequence of exponential segments. -- --
-- expSeg [a, durA, b, durB, c, durC, ...] [scale1, scale2, scale3] cps ---- -- The first argument is the list that specifies the shape of the looping -- wave. It's the alternating values and durations of transition from one -- value to another. The durations are relative to the period. So that -- lists -- --
-- [0, 0.5, 1, 0.5, 0] and [0, 50, 1, 50, 0] ---- -- produce the same results. The second list is the list of scales for -- subsequent periods. Every value in the period is scaled with values -- from the second list. The last argument is the rate of repetition -- (Hz). expSeq :: [Sig] -> [Sig] -> Sig -> Sig -- | It's just like linseg but it loops over the envelope. linloop :: [Sig] -> Sig -- | It's just like expseg but it loops over the envelope. exploop :: [Sig] -> Sig -- | Sample and hold cyclic signal. It takes the list of -- --
-- [a, dta, b, dtb, c, dtc, ...] ---- -- the a, b, c, ... are values of the constant segments -- -- the dta, dtb, dtc, are durations in seconds of constant segments. -- -- The period of the repetition equals to the sum of all durations. sah :: [Sig] -> Sig stepSeq :: [Sig] -> Sig -> Sig -- | Sample and hold sequence. It outputs the looping sequence of constan -- elements. constSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar triangle. triSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar square. sqrSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar sawtooth. sawSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar inveted sawtooth. isawSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar exponential sawtooth. xsawSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar inverted exponential sawtooth. ixsawSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar inveted square. isqrSeq :: [Sig] -> Sig -> Sig -- | Step sequencer with unipolar exponential triangle. xtriSeq :: [Sig] -> Sig -> Sig -- | The looping ADSR envelope. -- --
-- xadsrSeq attack decay sustain release weights frequency ---- -- The sum of attack, decay, sustain and release time durations should be -- equal to one. adsrSeq :: Sig -> Sig -> Sig -> Sig -> [Sig] -> Sig -> Sig -- | The looping exponential ADSR envelope. there is a fifth segment at the -- end of the envelope during which the envelope equals to zero. -- --
-- xadsrSeq attack decay sustain release weights frequency ---- -- The sum of attack, decay, sustain and release time durations should be -- equal to one. xadsrSeq :: Sig -> Sig -> Sig -> Sig -> [Sig] -> Sig -> Sig -- | The looping ADSR envelope with the rest at the end. -- --
-- adsrSeq attack decay sustain release rest weights frequency ---- -- The sum of attack, decay, sustain, release and rest time durations -- should be equal to one. adsrSeq_ :: Sig -> Sig -> Sig -> Sig -> Sig -> [Sig] -> Sig -> Sig -- | The looping exponential ADSR envelope. there is a fifth segment at the -- end of the envelope during which the envelope equals to zero. -- --
-- xadsrSeq_ attack decay sustain release rest weights frequency ---- -- The sum of attack, decay, sustain, release and rest time durations -- should be equal to one. xadsrSeq_ :: Sig -> Sig -> Sig -> Sig -> Sig -> [Sig] -> 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 -- | Patterns module Csound.Air.Misc -- | 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 number of copies, chorus width and wave shape. chorusPitch :: Int -> Sig -> (Sig -> Sig) -> Sig -> Sig -- | 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 ---- --
-- gaussVol (minVolume, maxVolume) --rndVol :: SigSpace a => (D, D) -> a -> SE a -- | Random volume (with gauss distribution) -- --
-- gaussVol radiusOfDistribution --gaussVol :: SigSpace a => D -> a -> SE a -- | It picks a signal from the list by integer index. The original value -- is taken from the head of the list (the first element). selector :: (Num a, SigSpace a) => [a] -> Sig -> a -- | Hi-fi output for stereo signals. Saves the stereo signal to file. The -- length of the file is defined in seconds. -- --
-- writeHifi fileLength fileName asig --writeHifi :: D -> String -> SE Sig2 -> IO () -- | Creates running arpeggios. -- --
-- arpeggiBy ampWeights pitches instrument cps ---- -- It plays an instrument with fast sequence of notes. We can specify the -- pitches and amplitude weights of the notes as well as frequency of -- repetition. arpeggi :: SigSpace a => [Sig] -> [Sig] -> (Sig -> a) -> Sig -> a -- | Creates running arpeggios. -- --
-- arpeggiBy ampWave pitchwave ampWeights pitches instrument cps ---- -- It plays an instrument with fast sequence of notes. We can specify -- amplitude envelope wave, pitch envelope wave, the pitches and -- amplitude weights of the notes as well as frequency of repetition. arpBy :: SigSpace a => ([Sig] -> Sig -> Sig) -> ([Sig] -> Sig -> Sig) -> [Sig] -> [Sig] -> (Sig -> a) -> Sig -> a -- | Low-pass filter pictured as joystick. Ox is for center frequency and -- Oy is for resonance. lpJoy :: Source (Sig -> Sig) -- | Sound file playback module Csound.Air.Wav -- | Reads stereo signal from the sound-file (wav or mp3 or aiff). readSnd :: String -> (Sig, Sig) -- | Reads stereo signal from the sound-file (wav or mp3 or aiff) and loops -- it with the file length. loopSnd :: String -> (Sig, Sig) -- | Reads stereo signal from the sound-file (wav or mp3 or aiff) and loops -- it with the given period (in seconds). loopSndBy :: D -> String -> (Sig, Sig) -- | Reads the wav file with the given speed (if speed is 1 it's a norma -- playback). We can use negative speed to read file in reverse. readWav :: Sig -> String -> (Sig, Sig) -- | Reads th wav file and loops over it. loopWav :: Sig -> String -> (Sig, Sig) -- | Reads a segment from wav file. readSegWav :: D -> D -> Sig -> String -> (Sig, Sig) -- | Reads th wav file and loops over it. Scales the tempo with first -- argument. tempoLoopWav :: Sig -> String -> (Sig, Sig) -- | Reads the wav file with the given speed (if speed is 1 it's a norma -- playback). We can use negative speed to read file in reverse. Scales -- the tempo with first argument. tempoReadWav :: Sig -> String -> (Sig, Sig) -- | The mono variant of the function readSnd. readSnd1 :: String -> Sig -- | The mono variant of the function loopSnd. loopSnd1 :: String -> Sig -- | The mono variant of the function loopSndBy. loopSndBy1 :: D -> String -> Sig -- | The mono variant of the function readWav. readWav1 :: Sig -> String -> Sig -- | The mono variant of the function loopWav. loopWav1 :: Sig -> String -> Sig -- | Reads a segment from wav file. readSegWav1 :: D -> D -> Sig -> String -> Sig -- | Reads th mono wav file and loops over it. Scales the tempo with first -- argument. tempoLoopWav1 :: Sig -> String -> Sig -- | Reads the mono wav file with the given speed (if speed is 1 it's a -- norma playback). We can use negative speed to read file in reverse. -- Scales the tempo with first argument. tempoReadWav1 :: Sig -> String -> Sig data LoopMode Once :: LoopMode Loop :: LoopMode Bounce :: LoopMode -- | Loads the sample in the table. The sample should be short. The size of -- the table is limited. It's up to 6 minutes for ramSnd :: LoopMode -> Sig -> String -> Sig2 ramSnd1 :: LoopMode -> Sig -> String -> Sig -- | The sample format. data SampleFormat -- | 32-bit floating point samples without header NoHeaderFloat32 :: SampleFormat -- | 16-bit integers without header NoHeaderInt16 :: SampleFormat -- | 16-bit integers with a header. The header type depends on the render -- (-o) format HeaderInt16 :: SampleFormat -- | u-law samples with a header UlawSamples :: SampleFormat -- | 16-bit integers with a header Int16 :: SampleFormat -- | 32-bit integers with a header Int32 :: SampleFormat -- | 32-bit floats with a header Float32 :: SampleFormat -- | 8-bit unsigned integers with a header Uint8 :: SampleFormat -- | 24-bit integers with a header Int24 :: SampleFormat -- | 64-bit floats with a header Float64 :: SampleFormat -- | Writes a sound signal to the file with the given format. It supports -- only four formats: Wav, Aiff, Raw and Ircam. writeSigs :: FormatType -> SampleFormat -> String -> [Sig] -> SE () -- | Writes wav files. writeWav :: String -> (Sig, Sig) -> SE () -- | Writes aiff files. writeAiff :: String -> (Sig, Sig) -> SE () -- | Writes mono signals to wav files. writeWav1 :: String -> Sig -> SE () -- | Writes mono signals to aiff files. writeAiff1 :: String -> Sig -> SE () -- | Length in seconds of the sound file. lengthSnd :: String -> D -- | Produces repeating segments with the given time in seconds. segments :: D -> Evt (D, Unit) -- | Takes only given amount (in seconds) from the signal (the rest is -- silence). takeSnd :: Sigs a => D -> a -> a -- | Delays signals by the given amount (in seconds). delaySnd :: Sigs a => D -> a -> a -- | Plays the first signal for some time (in seconds) and then switches to -- the next one. -- --
-- afterSnd dur sig1 sig2 --afterSnd :: (Num b, Sigs b) => D -> b -> b -> b -- | Delays a signal by the first argument and takes only second argument -- amount of signal (everything is measured in seconds). segmentSnd :: Sigs a => D -> D -> a -> a -- | Repeats the signal with the given period. repeatSnd :: Sigs a => D -> a -> a -- | Converts stereosignal to mono with function mean. toMono :: (Sig, Sig) -> Sig instance Show LoopMode instance Eq LoopMode instance Enum LoopMode instance Eq SampleFormat instance Ord SampleFormat instance Enum SampleFormat -- | Effects module Csound.Air.Fx -- | Mono version of the cool reverberation opcode reverbsc. -- --
-- 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 -> Sig2 -> Sig2 -- | 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 :: Sig2 -> Sig2 -- | Stereo reverb for small hall. smallHall2 :: Sig2 -> Sig2 -- | Stereo reverb for large hall. largeHall2 :: Sig2 -> Sig2 -- | The magic cave reverb (stereo). magicCave2 :: Sig2 -> Sig2 -- | The simplest delay with feedback. Arguments are: delay length and -- decay ratio. -- --
-- echo delayLength ratio --echo :: D -> Sig -> Sig -> SE Sig -- | Delay with feedback. -- --
-- fdelay delayLength decayRatio balance --fdelay :: D -> Sig -> Sig -> Sig -> SE Sig -- | Delay with feedback. -- --
-- fdelay maxDelayLength delayLength feedback balance --fvdelay :: D -> Sig -> Sig -> Sig -> Sig -> SE Sig -- | Multitap delay. Arguments are: max delay length, list of pairs -- (delayLength, decayRatio), balance of mixed signal with -- processed signal. -- --
-- fdelay maxDelayLength delays balance asig --fvdelays :: D -> [(Sig, Sig)] -> Sig -> Sig -> SE Sig -- | Generic multitap delay. It's just like fvdelays but instead -- of constant feedbackLevel it expects a function for processing a -- delayed signal on the tap. -- --
-- fdelay maxDelayLength delays balance asig --funDelays :: D -> [(Sig, Sig -> Sig)] -> Sig -> Sig -> SE Sig -- | Distortion. -- --
-- distort distLevel asig --distortion :: Sig -> Sig -> Sig -- | Chorus. -- --
-- chorus depth rate balance asig --chorus :: Sig -> Sig -> Sig -> Sig -> SE Sig -- | Flanger. Lfo depth ranges in 0 to 1. -- -- flanger lfo feedback balance asig flange :: Lfo -> Sig -> Sig -> Sig -> Sig -- | First order phaser. phase1 :: Sig -> Lfo -> Sig -> Sig -> Sig -> Sig -- | Second order phaser. Sweeping gaps in the timbre are placed -- harmonicaly harmPhase :: Sig -> Lfo -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -- | Second order phaser. Sweeping gaps in the timbre are placed by powers -- of the base frequency. powerPhase :: Sig -> Lfo -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -- | Distortion -- --
-- fxDistort level drive tone sigIn --fxDistort :: Sig -> Sig -> Sig -> Sig -> Sig -- | Stereo distortion. fxDistort2 :: Sig -> Sig -> Sig -> Sig2 -> Sig2 -- | Stereo chorus. -- --
-- stChorus2 mix rate depth width sigIn --stChorus2 :: Sig -> Sig -> Sig -> Sig -> Sig2 -> Sig2 -- | Phaser -- --
-- fxPhaser mix rate depth freq feedback sigIn --fxPhaser :: Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -- | Stereo phaser. fxPhaser2 :: Sig -> Sig -> Sig -> Sig -> Sig -> Sig2 -> Sig2 -- | Flanger -- --
-- fxFlanger mix feedback rate depth delay sigIn --fxFlanger :: Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -- | Stereo flanger fxFlanger2 :: Sig -> Sig -> Sig -> Sig -> Sig -> Sig2 -> Sig2 -- | Analog delay. -- --
-- analogDelay mix feedback time tone sigIn --analogDelay :: Sig -> Sig -> Sig -> Sig -> Sig -> SE Sig -- | Stereo analog delay. analogDelay2 :: Sig -> Sig -> Sig -> Sig -> Sig2 -> SE Sig2 -- | Simplified delay -- --
-- fxEcho maxDelayLength delTime feedback sigIn --fxEcho :: D -> Sig -> Sig -> Sig -> SE Sig -- | Simplified stereo delay. fxEcho2 :: D -> Sig -> Sig -> Sig2 -> SE Sig2 -- | Filter effect (a pair of butterworth low and high pass filters). -- --
-- fxFilter lowPassfFreq highPassFreq gain --fxFilter :: Sig -> Sig -> Sig -> Sig -> Sig -- | Stereo filter effect (a pair of butterworth low and high pass -- filters). fxFilter2 :: Sig -> Sig -> Sig -> Sig2 -> Sig2 -- | Adds filtered white noize to the signal -- --
-- fxWhite lfoFreq depth sigIn --fxWhite :: Sig -> Sig -> Sig -> SE Sig -- | Adds filtered white noize to the stereo signal fxWhite2 :: Sig -> Sig -> Sig2 -> SE Sig2 -- | Adds filtered pink noize to the signal -- --
-- fxWhite lfoFreq depth sigIn --fxPink :: Sig -> Sig -> Sig -> SE Sig -- | Adds filtered pink noize to the stereo signal fxPink2 :: Sig -> Sig -> Sig2 -> SE Sig2 -- | Equalizer -- --
-- equalizer gainsAndFrequencies gain sigIn --equalizer :: [(Sig, Sig)] -> Sig -> Sig -> Sig -- | Stereo equalizer. equalizer2 :: [(Sig, Sig)] -> Sig -> Sig2 -> Sig2 -- | Equalizer with frequencies: 100, 400, 1600, 6400 eq4 :: [Sig] -> Sig -> Sig2 -> Sig2 -- | Equalizer with frequencies: 100, 200, 400, 800, 1600, 3200, 6400 eq7 :: [Sig] -> Sig -> Sig2 -> Sig2 -- | Gain -- --
-- fxGain gain sigIn --fxGain :: Sig -> Sig2 -> Sig2 -- | UIs for live performances module Csound.Air.Live -- | Widget that represents a mixer. mixer :: [(String, SE Sig2)] -> Source Sig2 -- | Widget that represents a mixer with horizontal grouping of elements. hmixer :: [(String, SE Sig2)] -> Source Sig2 -- | Transforms the mono signal to the stereo input for the mixer widget. mixMono :: String -> Sig -> (String, SE Sig2) -- | The stereo signal processing function. type FxFun = Sig2 -> SE Sig2 class FxUI a applyFxArgs :: FxUI a => a -> [Sig] -> Sig2 -> SE Sig2 arityFx :: FxUI a => a -> Int -- | Creates a widget that represents a stereo signal processing function. -- The parameters of the widget are updated with sliders. For example -- let's create a simple gain widget. It can be encoded like this: -- --
-- uiGain :: Bool -> Double -> Source FxFun
-- uiGain isOn gain = fxBox "Gain" fx isOn [("gain", gain)]
-- where
-- fx :: Sig -> Sig2 -> Sig2
-- fx = mul
--
--
-- Let's look at the arguments of the function
--
-- -- fxBox name fx isOn args ---- --
-- uiDistort isOn levelOfDistortion drive tone --uiDistort :: Bool -> Double -> Double -> Double -> Source FxFun -- | The chorus widget. The arguments are -- --
-- uiChorus isOn mix rate depth width --uiChorus :: Bool -> Double -> Double -> Double -> Double -> Source FxFun -- | The flanger widget. The arguments are -- --
-- uiFlanger isOn mix feedback rate depth delay --uiFlanger :: Bool -> Double -> Double -> Double -> Double -> Double -> Source FxFun -- | The phaser widget. The arguments are -- --
-- uiPhaser isOn mix feedback rate depth frequency --uiPhaser :: Bool -> Double -> Double -> Double -> Double -> Double -> Source FxFun -- | The delay widget. The arguments are -- --
-- uiDelay isOn mix feedback delayTime tone --uiDelay :: Bool -> Double -> Double -> Double -> Double -> Source FxFun -- | The simplified delay widget. The arguments are -- --
-- uiEcho isOn maxDelayTime delayTime feedback --uiEcho :: Bool -> D -> Double -> Double -> Source FxFun -- | The pair of low and high pass filters -- --
-- uiFilter isOn lowPassfrequency highPassFrequency gain --uiFilter :: Bool -> Double -> Double -> Double -> Source FxFun -- | The reverb widget. The arguments are: -- --
-- uiReverb mix depth --uiReverb :: Bool -> Double -> Double -> Source FxFun -- | The gain widget. The arguments are -- --
-- uiGain isOn amountOfGain --uiGain :: Bool -> Double -> Source FxFun -- | The filtered white noize widget. The arguments are -- --
-- uiWhite isOn centerFreqOfFilter amountOfNoize --uiWhite :: Bool -> Double -> Double -> Source FxFun -- | The filtered pink noize widget. The arguments are -- --
-- uiPink isOn centerFreqOfFilter amountOfNoize --uiPink :: Bool -> Double -> Double -> Source FxFun -- | The constructor for signal processing functions with no arguments -- (controlls). uiFx :: FxUI a => String -> a -> Bool -> Source FxFun -- | The reverb for room. uiRoom :: Bool -> Source FxFun -- | The reverb for hall. uiHall :: Bool -> Source FxFun -- | The reverb for magic cave. uiCave :: Bool -> Source FxFun -- | the widget for mixing in a signal to the signal. uiSig :: String -> Bool -> Source Sig2 -> Source FxFun -- | A mixer widget represented as an effect. The effect sums the signals -- with given wieghts. uiMix :: Bool -> [(String, SE Sig2)] -> Source FxFun data AdsrBound AdsrBound :: Double -> Double -> Double -> AdsrBound attBound :: AdsrBound -> Double decBound :: AdsrBound -> Double relBound :: AdsrBound -> Double data AdsrInit AdsrInit :: Double -> Double -> Double -> Double -> AdsrInit attInit :: AdsrInit -> Double decInit :: AdsrInit -> Double susInit :: AdsrInit -> Double relInit :: AdsrInit -> Double linAdsr :: String -> AdsrBound -> AdsrInit -> Source Sig expAdsr :: String -> AdsrBound -> AdsrInit -> Source Sig -- | A widget with four standard waveforms: pure tone, triangle, square and -- sawtooth. The last parameter is a default waveform (it's set at init -- time). classicWaves :: String -> Int -> Source (Sig -> Sig) -- | Slider for master volume masterVolume :: Source Sig -- | Knob for master volume masterVolumeKnob :: Source Sig instance FxUI a => FxUI (Sig -> a) instance FxUI FxFun instance FxUI (Sig2 -> Sig2) instance SigSpace FxFun -- | The vital tools. module Csound.Air -- | 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