-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | library to make electronic music -- -- Welcome to the simplest textual synthesizer. -- --
-- dac $ osc 440 ---- -- Csound-expression is a Haskell framework for computer music. With the -- help of the library we can create our instruments on the fly. A few -- lines in the interpreter is enough to get the cool sound going out of -- your speakers. It can be used for simple daily sound-file processing -- or for a full-blown live performances. -- -- Got interested? Check out the guide: -- https://github.com/anton-k/csound-expression/blob/master/tutorial/Index.md -- -- Acknowledgements (I'd like to mention those who supported me a lot -- with their music and ideas): -- --
-- hor [a, b, sca 2 c] ---- -- Why is it so? Let's look at the hidden scaling factors: -- --
-- hor [sca 1 a, sca 1 b, sca 2 c] ---- -- During rendering we scale all the scaling fators so that total sum -- equals to one: -- --
-- hor [sca 0.25 a, sca 0.25 b, sca 0.5 c] --sca :: Double -> Gui -> Gui -- | Weighted horizontal grouping. It takes a list of scaling factors and -- elements. horSca :: [(Double, Gui)] -> Gui -- | Weighted vertical grouping. It takes a list of scaling factors and -- elements. verSca :: [(Double, Gui)] -> Gui -- | Sets the padding of the element. How much empty space to reserve -- outside the element. padding :: Int -> Gui -> Gui -- | Sets the margin of the element. How much empty space to reserve -- between the elements within the group. It affects only compound -- elements. margin :: Int -> Gui -> Gui -- | 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 () 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 Ref a :: * -> * writeRef :: Tuple a => Ref a -> a -> SE () readRef :: Tuple a => Ref a -> SE a -- | Modifies the Ref value with given function. modifyRef :: Tuple a => Ref a -> (a -> a) -> SE () -- | Adds the given signal to the value that is contained in the reference. mixRef :: (Num a, Tuple a) => Ref 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. newRef :: Tuple a => a -> SE (Ref a) -- | An alias for the function newRef. 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. newGlobalRef :: Tuple a => a -> SE (Ref a) -- | An alias for the function newRef. 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 ()) 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 -- | Sets midi device setMidiDevice :: String -> Options -- | Sets midi device to all. setMa :: 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 CoreMidi :: Rtmidi MmeMidi :: Rtmidi WinmmeMidi :: 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 () equalsTo :: EqB a => a -> a -> BooleanOf a notEqualsTo :: EqB a => a -> a -> BooleanOf a lessThan :: OrdB a => a -> a -> BooleanOf a greaterThan :: OrdB a => a -> a -> BooleanOf a lessThanEquals :: OrdB a => a -> a -> BooleanOf a greaterThanEquals :: OrdB a => a -> a -> BooleanOf a 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, Num a) => Sigs a 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 -- | Rescaling of the bipolar signal (-1, 1) -> (a, b) -- --
-- 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 class SigSpace b => At a b c where type family AtOut a b c :: * at :: At a b c => (a -> b) -> c -> AtOut a b c -- | It applies an effect and mixes the processed signal with original one. -- The first argument is for proportion of drywet -- (originalprocessed). It's like at but it allows to -- balance processed signal with original one. mixAt :: (At a b c, c ~ AtOut a b c, SigSpace c, Num c) => Sig -> (a -> b) -> c -> c -- | It applies an effect and balances the processed signal by original -- one. bat :: At Sig a b => (Sig -> a) -> b -> AtOut Sig a b -- | 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 Csound.SigSpace.SigSpace Csound.Typed.Types.Prim.Sig instance Csound.SigSpace.BindSig Csound.Typed.Types.Prim.Sig instance Csound.SigSpace.SigSpace (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.BindSig (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.SigSpace (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.BindSig (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.SigSpace (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.BindSig (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.SigSpace (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.BindSig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.SigSpace (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance Csound.SigSpace.BindSig (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance Csound.SigSpace.SigSpace (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance Csound.SigSpace.BindSig (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance Csound.SigSpace.SigSpace (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance Csound.SigSpace.BindSig (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance GHC.Num.Num (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (a -> Csound.Typed.Types.Prim.Sig) instance GHC.Num.Num (a -> (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (a -> (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (a -> (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (a -> Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance GHC.Num.Num (a -> Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (a -> Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Num.Num (a -> Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance GHC.Real.Fractional (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance GHC.Real.Fractional (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig) instance GHC.Real.Fractional (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance GHC.Real.Fractional (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (a -> Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance GHC.Real.Fractional (a -> Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (a -> Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (a -> Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (a -> Csound.Typed.Types.Prim.Sig) instance GHC.Real.Fractional (a -> (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (a -> (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance GHC.Real.Fractional (a -> (Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig, Csound.Typed.Types.Prim.Sig)) instance Csound.SigSpace.SigSpace a => Csound.SigSpace.At Csound.Typed.Types.Prim.Sig Csound.Typed.Types.Prim.Sig a instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) Csound.Typed.Types.Prim.Sig instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) Csound.Typed.Types.Tuple.Sig2 instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) Csound.Typed.Types.Tuple.Sig3 instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) Csound.Typed.Types.Tuple.Sig4 instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig3) instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig4) instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Prim.Sig instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Prim.Sig instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) Csound.Typed.Types.Prim.Sig instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) Csound.Typed.Types.Tuple.Sig2 instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) -- | Filters module Csound.Air.Filter -- | First order low pass filter (tone in Csound, 6 dB) -- --
-- lp1 centerFreq asig --lp1 :: Sig -> Sig -> Sig -- | First order high pass filter (atone in Csound, 6 dB) -- --
-- hp1 centerFreq asig --hp1 :: Sig -> Sig -> Sig -- | 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 -- | Resonance band pass filter (yet another implementation, it's reson in -- Csound) -- --
-- bp2 centerFreq q asig --bp2 :: Sig -> Sig -> Sig -> Sig -- | Resonance band reject filter (yet another implementation, it's areson -- in Csound) -- --
-- br2 centerFreq q asig --br2 :: 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 -- | Resonant filter. -- --
-- f centerFreq q asig --type ResonFilter = Sig -> Sig -> Sig -> Sig -- | Filter without a resonance. -- --
-- f centerFreq q asig --type FlatFilter = Sig -> Sig -> Sig -- | Applies a filter n-times. The n is given in the first rgument. filt :: Int -> ResonFilter -> ResonFilter -- | Applies a flat filter (without resonance) n-times. The n is given in -- the first rgument. flatFilt :: Int -> FlatFilter -> FlatFilter -- | Moog's low-pass filter. -- --
-- mlp centerFrequency qResonance signal --mlp :: Sig -> Sig -> Sig -> Sig -- | Another implementation of moog low pass filter (it's moogvcf in -- Csound). The arguments have are just like in the mlp filter. mlp2 :: Sig -> Sig -> Sig -> Sig -- | Mooglowpass filter with 18 dB. mlp3 :: Sig -> Sig -> Sig -> Sig -- | Low pass filter 18 dB with built in distortion module. -- --
-- lp18 distortion centerFreq resonance asig ---- --
-- formant bandPassFilter formants asig ---- -- It expects a band pass filter, a list of formants and processed -- signal. The signal is processed with each filter the result is a sum -- of all proceessed signals. Formant filters are used to mimic the -- vocalization of the sound. formant :: ResonFilter -> [(Sig, Sig)] -> Sig -> Sig -- | Formant filter that sings an A. singA :: Sig -> Sig -- | Formant filter that sings an O. singO :: Sig -> Sig -- | Formant filter that sings an E. singE :: Sig -> Sig -- | Formant filter that sings an U. singU :: Sig -> Sig -- | Formant filter that sings an O. singO2 :: 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. smooth :: Sig -> Sig -> Sig -- | Makes slides 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 -- | 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.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 () type Tick = Evt Unit -- | Converts booleans to events. boolToEvt :: BoolSig -> Evt Unit evtToBool :: Evt a -> BoolSig -- | Triggers an event when signal equals to 1. sigToEvt :: Sig -> Evt Unit evtToSig :: D -> (Evt D) -> Sig -- | 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 -- | Constructs an event stream that contains pairs from the given pair of -- signals. Events happens when any signal changes. snaps2 :: Sig2 -> Evt (D, D) -- | Executes actions synchronized with global tempo (in Hz). -- --
-- runEvtSync tempoCps evt proc --sync :: (Default a, Tuple a) => Sig -> Evt a -> Evt a -- | the sync function but time is measured in beats per minute. syncBpm :: (Default a, Tuple a) => Sig -> Evt a -> Evt a -- | Creates a stream of events that happen with the given frequency. metro :: Sig -> Evt Unit -- | Creates a stream of ticks that happen around the given frequency with -- given deviation. -- --
-- gaussTrig freq deviation --gaussTrig :: Sig -> Sig -> Tick -- | Creates a stream of random events. The argument is a number of events -- per second. -- --
-- dust eventsPerSecond --dust :: Sig -> Tick -- | Csound's original metro function. metroSig :: Sig -> Sig -- | Creates a signal that contains a random ones that happen with given -- frequency. dustSig :: Sig -> SE Sig -- | Creates a signal that contains a random ones or negative ones that -- happen with given frequency. dustSig2 :: Sig -> SE Sig -- | 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 -- | Behaves like metro, but returns an event stream. -- | Deprecated: Use metro instead metroE :: Sig -> Evt Unit -- | 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 (Sco 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) -- | Takes the ns events from the event stream and ignores the rest of the -- stream. takeE :: Int -> Evt a -> Evt a -- | Drops the ns events from the event stream and leaves the rest of the -- stream. dropE :: Int -> Evt a -> Evt a -- | Takes events while the predicate is true. takeWhileE :: (a -> BoolD) -> Evt a -> Evt a -- | Drops events while the predicate is true. dropWhileE :: (a -> BoolD) -> Evt a -> Evt a -- | Splits a toggle event stream on on-events and off-events. splitToggle :: Evt D -> (Evt D, Evt D) -- | Converts clicks to alternating 0 and 1 (toggle event stream) toTog :: Tick -> Evt D -- | Converts clicks to alternating 1 and 0 (toggle event stream with first -- value set to 1) toTog1 :: Tick -> 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 type Sco a = Track D 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 :: (Arg a, Sigs b) => (a -> SE b) -> Sco a -> Sco (Mix b) -- | Renders a scores to the sound signals. we can use it inside the other -- instruments. mix :: Sigs a => Sco (Mix a) -> a -- | Applies an effect to the sound. Effect is applied to the sound on the -- give track. -- --
-- res = eff effect sco ---- --
-- monoMsg channel portamentoTime releaseTime --monoMsg :: MidiChn -> 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 :: MidiChn -> D -> SE (Sig, Sig) -- | Listens to midi on event on the given key as event stream. The event -- stream carries the level of volume (ranges from 0 to 1). midiKeyOn :: MidiChn -> D -> SE (Evt D) -- | Listens to midi on event off the given key as event stream. midiKeyOff :: MidiChn -> D -> SE Tick -- | 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 -- | Invokes ooverloaded instruments with midi. Example: -- --
-- dac $ tryMidi (mul (fades 0.01 0.1) . tri) --tryMidi :: (MidiInstr a, Sigs (MidiInstrOut a)) => a -> SE (MidiInstrOut a) -- | 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) instance GHC.Classes.Eq Csound.Control.Midi.MidiChn instance GHC.Show.Show Csound.Control.Midi.MidiChn -- | 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 setKnob :: String -> ValSpan -> Double -> SinkSource Sig setSlider :: String -> ValSpan -> Double -> SinkSource 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 -- | Creates an event in the output stream when one of the chars is -- pressed. strOn :: String -> Tick -- | Creates an event in the output stream when one of the chars is -- depressed. strOff :: String -> Tick -- | 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 :: Range 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 :: Range 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 -- | Pair of minimum and maximum values. type Range a = (a, a) -- | Creates a knob that outputs only integers in the given range. It -- produces an event stream of integer values. It can be used with list -- access functions listAt, atTuple, atArg. -- --
-- rangeKnob needInit (min, max) initVal ---- -- The first argument is a boolean. If it's true than the initial value -- is put in the output stream. If its False the initial value is -- skipped. rangeKnob :: Bool -> Range Int -> Int -> Source (Evt D) -- | Creates a slider that outputs only integers in the given range. It -- produces an event stream of integer values. It can be used with list -- access functions listAt, atTuple, atArg. -- --
-- rangeSlider needInit (min, max) initVal ---- -- The first argument is a boolean. If it's true than the initial value -- is put in the output stream. If its False the initial value is -- skipped. rangeSlider :: Bool -> Range Int -> Int -> Source (Evt D) -- | Creates a knob that outputs only integers in the given range. It -- produces a signal of integer values. -- --
-- rangeKnobSig (min, max) initVal --rangeKnobSig :: Range Int -> Int -> Source Sig -- | Creates a slider that outputs only integers in the given range. It -- produces a signal of integer values. -- --
-- rangeSliderSig (min, max) initVal --rangeSliderSig :: Range Int -> Int -> Source Sig -- | 2d range range slider. Outputs a pair of event streams. Each stream -- contains changes in the given direction (Ox or Oy). -- --
-- rangeJoy needsInit rangeX rangeY (initX, initY) ---- -- The first argument is a boolean. If it's true than the initial value -- is put in the output stream. If its False the initial value is -- skipped. rangeJoy :: Bool -> Range Int -> Range Int -> (Int, Int) -> Source (Evt D, Evt D) -- | 2d range range slider. It produces a single event stream. The event -- fires when any signal changes. -- --
-- rangeJoy2 needsInit rangeX rangeY (initX, initY) ---- -- The first argument is a boolean. If it's true than the initial value -- is put in the output stream. If its False the initial value is -- skipped. rangeJoy2 :: Bool -> Range Int -> Range Int -> (Int, Int) -> Source (Evt (D, D)) -- | 2d range range slider. It produces the pair of integer signals rangeJoySig :: Range Int -> Range Int -> (Int, Int) -> Source (Sig, 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) -- | It's like simple button, but it can be controlled with -- external control. The first argument is for external control. button' :: Tick -> String -> Source Tick -- | It's like simple toggle, but it can be controlled with -- external control. The first argument is for external control. toggle' :: Evt D -> String -> Bool -> Source (Evt D) toggleSig' :: Sig -> String -> Bool -> Source Sig -- | It's like simple knob, but it can be controlled with external -- control. The first argument is for external control. knob' :: Sig -> String -> ValSpan -> Double -> Source Sig -- | It's like simple slider, but it can be controlled with -- external control. The first argument is for external control. slider' :: Sig -> String -> ValSpan -> Double -> Source Sig -- | It's like simple uknob, but it can be controlled with -- external control. The first argument is for external control. uknob' :: Sig -> Double -> Source Sig -- | It's like simple uslider, but it can be controlled with -- external control. The first argument is for external control. uslider' :: Sig -> Double -> Source Sig -- | It's like simple hradio, but it can be controlled with -- external control. The first argument is for external control. hradio' :: Evt D -> [String] -> Int -> Source (Evt D) -- | It's like simple vradio, but it can be controlled with -- external control. The first argument is for external control. vradio' :: Evt D -> [String] -> Int -> Source (Evt D) -- | It's like simple hradioSig, but it can be controlled with -- external control. The first argument is for external control. hradioSig' :: Sig -> [String] -> Int -> Source Sig -- | It's like simple vradioSig, but it can be controlled with -- external control. The first argument is for external control. vradioSig' :: Sig -> [String] -> Int -> Source Sig -- | 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 () -- | Groups a list of Source-widgets. The visuals are horizontally aligned. hlifts :: ([a] -> b) -> [Source a] -> Source b -- | Groups a list of Source-widgets. The visuals are vertically aligned. vlifts :: ([a] -> b) -> [Source a] -> Source b -- | 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 -- | Groups a list of Source-widgets. The visuals are horizontally aligned. -- It uses the list of proportions. hlifts' :: [Double] -> ([a] -> b) -> [Source a] -> Source b -- | Groups a list of Source-widgets. The visuals are vertically aligned. -- It uses the list of proportions. vlifts' :: [Double] -> ([a] -> b) -> [Source a] -> 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 -- | Monadic bind with horizontal concatenation of visuals. hbind :: Source a -> (a -> Source b) -> Source b -- | Monadic bind with vertical concatenation of visuals. vbind :: Source a -> (a -> Source b) -> Source b -- | Monadic apply with horizontal concatenation of visuals. happly :: (a -> Source b) -> Source a -> Source b -- | Monadic apply with vertical concatenation of visuals. vapply :: (a -> Source b) -> Source a -> Source b hmapM :: (a -> Source b) -> [a] -> Source [b] vmapM :: (a -> Source b) -> [a] -> Source [b] -- | Monadic bind with horizontal concatenation of visuals. It expects -- scaling factors for visuals as first two arguments. hbind' :: Double -> Double -> Source a -> (a -> Source b) -> Source b -- | Monadic bind with vertical concatenation of visuals. It expects -- scaling factors for visuals as first two arguments. vbind' :: Double -> Double -> Source a -> (a -> Source b) -> Source b -- | Monadic apply with horizontal concatenation of visuals. It expects -- scaling factors for visuals as first two arguments. happly' :: Double -> Double -> (a -> Source b) -> Source a -> Source b -- | Monadic apply with vertical concatenation of visuals. It expects -- scaling factors for visuals as first two arguments. vapply' :: Double -> Double -> (a -> Source b) -> Source a -> Source b hmapM' :: [Double] -> (a -> Source b) -> [a] -> Source [b] vmapM' :: [Double] -> (a -> Source b) -> [a] -> Source [b] instance Csound.SigSpace.SigSpace a => Csound.SigSpace.SigSpace (Csound.Typed.Gui.Widget.Source a) instance Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) a => Csound.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) (Csound.Typed.Gui.Widget.Source a) instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 a => Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.Gui.Widget.Source a) instance Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) a => Csound.SigSpace.At Csound.Typed.Types.Tuple.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) (Csound.Typed.Gui.Widget.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 with flags set to -- -odac and -Ma (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 Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE ()) instance Csound.IO.RenderCsd Csound.Typed.Types.Prim.Sig instance Csound.IO.RenderCsd Csound.Typed.Types.Tuple.Sig2 instance Csound.IO.RenderCsd Csound.Typed.Types.Tuple.Sig4 instance Csound.IO.RenderCsd Csound.Typed.Types.Tuple.Sig6 instance Csound.IO.RenderCsd Csound.Typed.Types.Tuple.Sig8 instance Csound.IO.RenderCsd (Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8) instance Csound.IO.RenderCsd (Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig4) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig6) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig8) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8)) instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE (Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8)) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> Csound.Typed.Types.Prim.Sig) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> Csound.Typed.Types.Tuple.Sig2) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> Csound.Typed.Types.Tuple.Sig4) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> Csound.Typed.Types.Tuple.Sig6) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> Csound.Typed.Types.Tuple.Sig8) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> (Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8)) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> (Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8, Csound.Typed.Types.Tuple.Sig8)) instance (Csound.Typed.Types.Tuple.Sigs a, Csound.Typed.Types.Tuple.Sigs b) => Csound.IO.RenderCsd (a -> Csound.Typed.GlobalState.SE.SE b) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source Csound.Typed.Types.Prim.Sig) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source Csound.Typed.Types.Tuple.Sig2) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source Csound.Typed.Types.Tuple.Sig4) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig)) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig2)) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Tuple.Sig4)) -- | Creating Function Tables (Buffers) module Csound.Tab -- | Tables (or arrays) data Tab :: * -- | The default table. It's rendered to (-1) in the Csound. noTab :: 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 -- | Creates a new table. The Tab could be used while the instrument is -- playing. When the instrument is retriggered the new tab is allocated. -- --
-- newTab size --newTab :: D -> SE Tab -- | Creates a new global table. It's generated only once. It's persisted -- between instrument calls. -- --
-- newGlobalTab identifier size --newGlobalTab :: D -> SE Tab -- | Calculates the number of samples needed to store the given amount of -- seconds. It multiplies the value by the current sample rate. tabSizeSeconds :: D -> D -- | Calculates the closest power of two value for a given size. tabSizePower2 :: D -> D -- | Calculates the closest power of two value in samples for a given size -- in seconds. tabSizeSecondsPower2 :: D -> D data WavChn WavLeft :: WavChn WavRight :: WavChn WavAll :: WavChn data Mp3Chn Mp3Mono :: Mp3Chn Mp3Stereo :: Mp3Chn Mp3Left :: Mp3Chn Mp3Right :: Mp3Chn Mp3All :: Mp3Chn -- | Loads wav or aiff file to table -- --
-- wavs fileName skipTime channel ---- -- skipTime specifies from what second it should read the file. -- -- with channel argument we can read left, right or both channels. wavs :: String -> Double -> WavChn -> Tab -- | Loads mp3 file to table: -- --
-- mp3s fileName skipTime format ---- -- skipTime specifies from what second it should read the file. -- -- format is: 1 - for mono files, 2 - for stereo files, 3 - for left -- channel of stereo file, 4 for right channel of stereo file mp3s :: String -> Double -> Mp3Chn -> 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 -- | Creates tanh sigmoid. The argument is the radius of teh sigmoid. tanhSigmoid :: Double -> 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: -- --
-- kstart tablewa kfn, asig, koff ---- -- csound docs: http://www.csounds.com/manual/html/tablewa.html tablewa :: Tab -> Sig -> Sig -> SE Sig -- | Transforms phasor that is defined in seconds to relative phasor that -- ranges in 0 to 1. sec2rel :: Tab -> Sig -> Sig -- | Container list of tables data TabList :: * tabList :: [Tab] -> TabList fromTabList :: TabList -> Sig -> Tab fromTabListD :: TabList -> D -> Tab instance GHC.Classes.Eq Csound.Tab.Mp3Chn instance GHC.Show.Show Csound.Tab.Mp3Chn instance GHC.Classes.Eq Csound.Tab.WavChn instance GHC.Show.Show Csound.Tab.WavChn instance Data.Default.Class.Default Csound.Tab.WavChn instance Data.Default.Class.Default Csound.Tab.Mp3Chn -- | Basic waveforms that are used most often. A waveform function takes in -- a time varied frequency (in Hz). module Csound.Air.Wave -- | A pure tone (sine wave). osc :: Sig -> Sig -- | An oscillator with user provided waveform. oscBy :: Tab -> Sig -> Sig -- | A sawtooth. saw :: Sig -> Sig -- | Integrated sawtooth: 4 * x * (1 - x). isaw :: Sig -> Sig -- | Pulse (not normalized). pulse :: Sig -> Sig -- | A square wave. sqr :: Sig -> Sig -- | Pulse width modulation (width range is 0 to 1) -- --
-- pw dutyCycle cps --pw :: Sig -> Sig -> Sig -- | A triangle wave. tri :: Sig -> Sig -- | Triangle wave with ramp factor (factor's range is 0 to 1) -- --
-- ramp factor cps --ramp :: Sig -> Sig -> Sig -- | A band-limited oscillator with user defined waveform (it's stored in -- the table). blosc :: Tab -> Sig -> Sig -- | A pure tone (sine wave) with initial phase (the first argiment). osc' :: D -> Sig -> Sig -- | An oscillator with user provided waveform with initial phase (the -- second argiment). oscBy' :: Tab -> D -> Sig -> Sig -- | A sawtooth. saw' :: D -> Sig -> Sig -- | Integrated sawtooth: 4 * x * (1 - x). isaw' :: D -> Sig -> Sig -- | Pulse (not normalized). pulse' :: D -> Sig -> Sig -- | A square wave. sqr' :: D -> Sig -> Sig -- | Pulse width modulation (width range is 0 to 1) -- --
-- pw' dutyCycle phase cps --pw' :: Sig -> D -> Sig -> Sig -- | A triangle wave. tri' :: D -> Sig -> Sig -- | Triangle wave with ramp factor (factor's range is 0 to 1) -- --
-- ramp' factor phase cps --ramp' :: Sig -> D -> Sig -> Sig -- | A band-limited oscillator with user defined waveform (it's stored in -- the table). blosc' :: Tab -> D -> Sig -> Sig rndOsc :: Sig -> SE Sig rndOscBy :: Tab -> Sig -> SE Sig rndSaw :: Sig -> SE Sig rndIsaw :: Sig -> SE Sig rndPulse :: Sig -> SE Sig rndSqr :: Sig -> SE Sig rndPw :: Sig -> Sig -> SE Sig rndTri :: Sig -> SE Sig rndRamp :: Sig -> Sig -> SE Sig rndBlosc :: Tab -> Sig -> SE Sig -- | Turns a bipolar sound (ranges from -1 to 1) to unipolar (ranges from 0 -- to 1) unipolar :: Sig -> Sig -- | Turns an unipolar sound (ranges from 0 to 1) to bipolar (ranges from -- -1 to 1) bipolar :: Sig -> Sig -- | Unipolar pure tone. uosc :: Sig -> Sig -- | Unipolar oscBy. uoscBy :: Tab -> Sig -> Sig -- | Unipolar sawtooth. usaw :: Sig -> Sig -- | Unipolar integrated sawtooth. uisaw :: Sig -> Sig -- | Unipolar pulse. upulse :: Sig -> Sig -- | Unipolar square wave. usqr :: Sig -> Sig -- | Unipolar pulse width modulation wave. upw :: Sig -> Sig -> Sig -- | Unipolar triangle wave. utri :: Sig -> Sig -- | Unipolar triangle wave with ram factor. uramp :: Sig -> Sig -> Sig -- | Unipolar band-limited oscillator. ublosc :: Tab -> Sig -> Sig uosc' :: D -> Sig -> Sig uoscBy' :: Tab -> D -> Sig -> Sig usaw' :: D -> Sig -> Sig uisaw' :: D -> Sig -> Sig upulse' :: D -> Sig -> Sig usqr' :: D -> Sig -> Sig upw' :: Sig -> D -> Sig -> Sig utri' :: D -> Sig -> Sig uramp' :: Sig -> D -> Sig -> Sig ublosc' :: Tab -> D -> Sig -> Sig urndOsc :: Sig -> SE Sig urndOscBy :: Tab -> Sig -> SE Sig urndSaw :: Sig -> SE Sig urndIsaw :: Sig -> SE Sig urndPulse :: Sig -> SE Sig urndSqr :: Sig -> SE Sig urndPw :: Sig -> Sig -> SE Sig urndTri :: Sig -> SE Sig urndRamp :: Sig -> Sig -> SE Sig urndBlosc :: Tab -> Sig -> SE 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 -- | Frequency modulation -- --
-- fosc carrierFreq modulatorFreq modIndex cps --fosc :: Sig -> Sig -> Sig -> Sig -> Sig -- | Low frequency oscillator type Lfo = Sig -- | Low frequency oscillator -- --
-- lfo shape depth rate --lfo :: (Sig -> Sig) -> Sig -> Sig -> Sig -- | Scales the oscillator by frequency. That's how we can rise the pitch -- by 2 semitones and 15 cents: -- --
-- detune (semitone 2 * cent 15) osc --detune :: Sig -> (Sig -> a) -> (Sig -> a) -- | Unision by Hertz. It creates n oscillators that are playing the same -- pitch slightly detuned. The oscillatos's pitch is evenly distributed -- in Hz. -- --
-- multiHz numberOfUnits amountHz wave --multiHz :: Fractional a => Int -> Sig -> (Sig -> a) -> (Sig -> a) -- | Unision by Cents. It creates n oscillators that are playing the same -- pitch slightly detuned. The oscillatos's pitch is evenly distributed -- in cents. -- --
-- multiCent numberOfUnits amountCent wave --multiCent :: Fractional a => Int -> Sig -> (Sig -> a) -> (Sig -> a) -- | Oscillators are detuned randomly in the given interval. -- --
-- multiRnd numberOfUnits amountCent wave --multiRnd :: Fractional a => Int -> Sig -> (Sig -> a) -> (Sig -> SE a) -- | Oscillators are detuned randomly with Gauss distribution in the given -- interval. -- --
-- multiGauss numberOfUnits amountCent wave --multiGauss :: Fractional a => Int -> Sig -> (Sig -> a) -> (Sig -> SE a) -- | Oscillators are detuned randomly in the given interval. Useful for -- waves that return a signals with Side Effects. -- --
-- multiRnd numberOfUnits amountCent wave --multiRndSE :: Fractional a => Int -> Sig -> (Sig -> SE a) -> (Sig -> SE a) -- | Oscillators are detuned randomly with Gauss distribution in the given -- interval. Useful for waves that return a signals with Side Effects. -- --
-- multiGauss numberOfUnits amountCent wave --multiGaussSE :: Fractional a => Int -> Sig -> (Sig -> SE a) -> (Sig -> SE a) -- | Unipolar random splines. It generates the splines with unipolar output -- (ranges from 0 to 1). Arguments affect the frequency for generation of -- new values. -- --
-- urspline cpsMin cpsMax --urspline :: Sig -> Sig -> SE Sig -- | Bipolar random splines. It generates the splines with bipolar output -- (ranges from -1 to 1). Arguments affect the frequency for generation -- of new values. -- --
-- birspline cpsMin cpsMax --birspline :: Sig -> Sig -> SE Sig -- | Output is a set of harmonically related sine partials. -- --
-- buz numOfHarmonics frequency --buz :: Sig -> Sig -> Sig -- | Output is a set of harmonically related cosine partials. -- --
-- gbuz (minHarm, maxHarm) ratio frequency --gbuz :: (Sig, Sig) -> Sig -> Sig -> Sig -- | Buz with phase buz' :: D -> Sig -> Sig -> Sig -- | Gbuz with phase gbuz' :: D -> (Sig, Sig) -> Sig -> Sig -> Sig -- | Tools to build Fm synthesis graphs -- -- Example -- --
-- f a = fmOut1 $ do -- x1 <- fmOsc 1 -- x2 <- fmOsc 2 -- x1 `fmod` [(a, x2)] -- return x1 --module Csound.Air.Fm type Fm a = State St a data FmNode -- | Creates fm node with generic wave. -- --
-- fmOsc' wave modFreq --fmOsc' :: (Sig -> SE Sig) -> Sig -> Fm FmNode -- | Creates fm node with sine wave. -- --
-- fmOsc modFreq --fmOsc :: Sig -> Fm FmNode -- | Creates fm node with signal generator (it's independent from the main -- frequency). fmSig :: Sig -> Fm FmNode fmod :: FmNode -> [(Sig, FmNode)] -> Fm () -- | Renders Fm synth to function. fmOut :: Fm [(Sig, FmNode)] -> Sig -> SE [Sig] -- | Renders mono output. fmOut1 :: Fm FmNode -> Sig -> SE Sig -- | Renders stereo output. fmOut2 :: Fm (FmNode, FmNode) -> Sig -> SE Sig2 data FmSpec FmSpec :: [Sig -> SE Sig] -> [Sig] -> [Sig] -> [Sig] -> FmSpec [fmWave] :: FmSpec -> [Sig -> SE Sig] [fmCps] :: FmSpec -> [Sig] [fmInd] :: FmSpec -> [Sig] [fmOuts] :: FmSpec -> [Sig] data FmGraph FmGraph :: [(Int, [Int])] -> [Int] -> FmGraph [fmGraph] :: FmGraph -> [(Int, [Int])] [fmGraphOuts] :: FmGraph -> [Int] fmRun :: FmGraph -> FmSpec -> Sig -> SE Sig -- |
-- +--+ -- 6 | -- +--+ -- 5 -- | -- 2 4 -- | | -- 1 3 -- +---+ --dx_1 :: FmGraph -- |
-- 6 -- | -- 5 -- +--+ | -- 2 | 4 -- +--+ | -- 1 3 -- +-----+ --dx_2 :: FmGraph -- |
-- +--+ -- 3 6 | -- | +--+ -- 2 5 -- | | -- 1 4 -- +---+ --dx_3 :: FmGraph -- |
-- +--+ -- 3 6 | -- | | | -- 2 5 | -- | | | -- 1 4 | -- | +--+ -- +---+ --dx_4 :: FmGraph -- | 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 -- | 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 -- | A function transformer (decorator). We can transform an envelope -- producer so that all values are sumed with some random value. The -- amplitude of the random value is given with the first argument. -- -- It can transform linseg, expseg, sequence producers and simplified -- sequence producers. -- -- An example: -- --
-- dac $ mul (humanVal 0.1 sqrSeq [1, 0.5, 0.2, 0.1] 1) $ white ---- -- As you can see it transforms the whole function. So we don't need for -- extra parenthesis. class HumanizeValue a where type family HumanizeValueOut a :: * humanVal :: HumanizeValue a => Sig -> a -> HumanizeValueOut a -- | A function transformer (decorator). We can transform an envelope -- producer so that all durations are sumed with some random value. The -- amplitude of the random value is given with the first argument. -- -- It can transform linseg, expseg, sequence producers and simplified -- sequence producers. -- -- An example: -- --
-- dac $ mul (humanTime 0.1 sqrSeq [1, 0.5, 0.2, 0.1] 1) $ white ---- -- As you can see it transforms the whole function. So we don't need for -- extra parenthesis. class HumanizeTime a where type family HumanizeTimeOut a :: * humanTime :: HumanizeTime a => Sig -> a -> HumanizeTimeOut a -- | A function transformer (decorator). We can transform an envelope -- producer so that all values and durations are sumed with some random -- value. The amplitude of the random value is given with the first two -- arguments. -- -- It can transform linseg, expseg, sequence producers and simplified -- sequence producers. -- -- An example: -- --
-- dac $ mul (humanValTime 0.1 0.1 sqrSeq [1, 0.5, 0.2, 0.1] 1) $ white ---- -- As you can see it transforms the whole function. So we don't need for -- extra parenthesis. class HumanizeValueTime a where type family HumanizeValueTimeOut a :: * humanValTime :: HumanizeValueTime a => Sig -> Sig -> a -> HumanizeValueTimeOut a -- | Alias for humanVal. hval :: HumanizeValue a => Sig -> a -> HumanizeValueOut a -- | Alias for humanTime. htime :: HumanizeTime a => Sig -> a -> HumanizeTimeOut a -- | Alias for humanValTime. hvalTime :: HumanizeValueTime a => Sig -> Sig -> a -> HumanizeValueTimeOut a -- | 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 -- | A sequence of unipolar waves with pulse width moulation (see upw). The -- first argument is a duty cycle in range 0 to 1. pwSeq :: Sig -> [Sig] -> Sig -> Sig -- | A sequence of unipolar inverted waves with pulse width moulation (see -- upw). The first argument is a duty cycle in range 0 to 1. ipwSeq :: Sig -> [Sig] -> Sig -> Sig -- | A sequence of unipolar triangle waves with ramp factor (see uramp). -- The first argument is a ramp factor cycle in range 0 to 1. rampSeq :: Sig -> [Sig] -> Sig -> Sig -- | A sequence of unipolar inverted triangle waves with ramp factor (see -- uramp). The first argument is a ramp factor cycle in range 0 to 1. irampSeq :: Sig -> [Sig] -> Sig -> Sig -- | A sequence of unipolar exponential triangle waves with ramp factor -- (see uramp). The first argument is a ramp factor cycle in range 0 to -- 1. xrampSeq :: Sig -> [Sig] -> Sig -> Sig -- | A sequence of unipolar inverted exponential triangle waves with ramp -- factor (see uramp). The first argument is a ramp factor cycle in range -- 0 to 1. ixrampSeq :: Sig -> [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 -- | The seq is a type for step sequencers. The step sequencer is a -- monophonic control signal. Most often step sequencer is a looping -- segment of some values. It's used to create bas lines or conrtrol the -- frequency of the filter in dub or trance music. There are simple -- functions for creation of step sequencers defined in the module -- Csound.Air.Envelope. -- -- Basically the step sequence is a list of pairs: -- --
-- [(valA, durA), (valB, durB), (valC, durC)] ---- -- each pair defines a segment of height valN that lasts for durN. The -- sequence is repeated with the given frequency. Each segment has -- certain shape. It can be a constant or line segment or fragment of -- square wave or fragment of an adsr envelope. There are many predefined -- functions. -- -- With Seq we can construct control signals in very flexible way. We can -- use the score composition functions for creation of sequences. We can -- use mel for sequencing of individual steps, we can use -- str for stretching the sequence in time domain, we can delay -- with del. -- -- Here is an example: -- --
-- dac $ tri $ seqConst [str 0.25 $ mel [440, 220, 330, 220], 110] 1 ---- -- We can see how the function str was used to make a certain -- segment faster. There are numerical instaces for Seq. Bt it defines -- only functions fronInteger and fromRational. data Seq -- | Creates a toSeq :: Sig -> Seq -- | Squashes a sequence to a single beat. onBeat :: Seq -> Seq -- | Squashes a sequence to a single beat and then stretches to the given -- value. onBeats :: Sig -> Seq -> Seq -- | A sequence of constant segments. seqConst :: [Seq] -> Sig -> Sig -- | A linear sequence. seqLin :: [Seq] -> Sig -> Sig -- | An exponential sequence. seqExp :: [Seq] -> Sig -> Sig -- | The sequence of pulse width waves. The first argument is a duty cycle -- (ranges from 0 to 1). seqPw :: Sig -> [Seq] -> Sig -> Sig -- | The sequence of inversed pulse width waves. iseqPw :: Sig -> [Seq] -> Sig -> Sig -- | The sequence of square waves. seqSqr :: [Seq] -> Sig -> Sig -- | The sequence of inversed square waves. iseqSqr :: [Seq] -> Sig -> Sig -- | The sequence of sawtooth waves. seqSaw :: [Seq] -> Sig -> Sig -- | The sequence of inversed sawtooth waves. iseqSaw :: [Seq] -> Sig -> Sig -- | The sequence of exponential sawtooth waves. xseqSaw :: [Seq] -> Sig -> Sig -- | The sequence of inversed exponential sawtooth waves. ixseqSaw :: [Seq] -> Sig -> Sig -- | The sequence of ramp functions. The first argument is a duty cycle. seqRamp :: Sig -> [Seq] -> Sig -> Sig -- | The sequence of inversed ramp functions. The first argument is a duty -- cycle. iseqRamp :: Sig -> [Seq] -> Sig -> Sig -- | The sequence of triangular waves. seqTri :: [Seq] -> Sig -> Sig -- | The sequence of ramped triangular waves. seqTriRamp :: Sig -> [Seq] -> Sig -> Sig -- | The sequence of ADSR-envelopes. -- --
-- seqAdsr att dec sus rel ---- -- It has to be: -- --
-- att + dec + sus_time + rel == 1 --seqAdsr :: Sig -> Sig -> Sig -> Sig -> [Seq] -> Sig -> Sig -- | The sequence of exponential ADSR-envelopes. xseqAdsr :: Sig -> Sig -> Sig -> Sig -> [Seq] -> Sig -> Sig -- | The sequence of ADSR-envelopes with rest at the end. -- --
-- seqAdsr att dec sus rel rest ---- -- It has to be: -- --
-- att + dec + sus_time + rel + rest == 1 --seqAdsr_ :: Sig -> Sig -> Sig -> Sig -> Sig -> [Seq] -> Sig -> Sig -- | The sequence of exponential ADSR-envelopes with rest at the end. xseqAdsr_ :: Sig -> Sig -> Sig -> Sig -> Sig -> [Seq] -> Sig -> Sig -- | Function for creation of accented beats. The steady beat pattern of -- accents is repeated. The first argument describes the list of -- integers. Each integer is a main beat and the length of the beat. We -- can create a typical latino beat: -- --
-- dac $ mul (seqSaw [seqPat [3, 3, 2]] 1) white --seqPat :: [Int] -> Seq -- | It's like seqPat but inplace of rests it fills the gaps with -- segments ascending in value. -- --
-- dac $ mul (seqSaw [seqAsc [3, 3, 2]] 1) white --seqAsc :: [Int] -> Seq -- | It's like seqPat but inplace of rests it fills the gaps with -- segments descending in value. -- --
-- dac $ mul (seqSaw [seqDesc [3, 3, 2]] 1) white --seqDesc :: [Int] -> Seq -- | It's like seqPat but inplace of rests it fills the gaps with -- 0.5s. -- --
-- dac $ mul (seqSaw [seqHalf [3, 3, 2]] 1) white --seqHalf :: [Int] -> Seq instance Temporal.Class.Duration Csound.Air.Envelope.Seq instance Temporal.Class.Rest Csound.Air.Envelope.Seq instance Temporal.Class.Delay Csound.Air.Envelope.Seq instance Temporal.Class.Melody Csound.Air.Envelope.Seq instance Temporal.Class.Stretch Csound.Air.Envelope.Seq instance GHC.Num.Num Csound.Air.Envelope.Seq instance GHC.Real.Fractional Csound.Air.Envelope.Seq instance Csound.Air.Envelope.HumanizeValue ([Csound.Air.Envelope.Seq] -> Csound.Typed.Types.Prim.Sig -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeValue ([Csound.Typed.Types.Prim.Sig] -> Csound.Typed.Types.Prim.Sig -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeValue ([Csound.Typed.Types.Prim.D] -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeValue ([Csound.Typed.Types.Prim.D] -> Csound.Typed.Types.Prim.D -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeTime ([Csound.Air.Envelope.Seq] -> Csound.Typed.Types.Prim.Sig -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeTime ([Csound.Typed.Types.Prim.D] -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeTime ([Csound.Typed.Types.Prim.D] -> Csound.Typed.Types.Prim.D -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeValueTime ([Csound.Air.Envelope.Seq] -> Csound.Typed.Types.Prim.Sig -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeValueTime ([Csound.Typed.Types.Prim.D] -> Csound.Typed.Types.Prim.Sig) instance Csound.Air.Envelope.HumanizeValueTime ([Csound.Typed.Types.Prim.D] -> Csound.Typed.Types.Prim.D -> Csound.Typed.Types.Prim.Sig) -- | 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 -- | Settings for cross filtering algorithm. -- -- They are the defaults for opvodes: pvsifd, tradsyn, -- trcross and partials. -- --
-- mincer fidelity table pointer pitch ---- -- fidelity is the parameter that specifies the size of the window (for -- FFT transform). The size equals to formula (fidelity + 11) ^ 2. If you -- don't know what to choose choose 0 for pitched sounds and -2 for -- drums. The table contains the sample to playback. The pointer loops -- over the table. The pitch specifies a scaling factor for pitch. So we -- can raise tone an octave up by setting the pitch to 2. ramTab :: Fidelity -> Tab -> Sig -> Sig -> Sig -- | mincer — Phase-locked vocoder processing. -- -- mincer implements phase-locked vocoder processing using function -- tables containing sampled-sound sources, with GEN01, and mincer will -- accept deferred allocation tables. -- -- This opcode allows for time and frequency-independent scaling. Time is -- controlled by a time index (in seconds) to the function table position -- and can be moved forward and backward at any chosen speed, as well as -- stopped at a given position ("frozen"). The quality of the effect is -- generally improved with phase locking switched on. -- --
-- asig mincer atimpt, kamp, kpitch, ktab, klock[,ifftsize,idecim] ---- -- csound doc: http://www.csounds.com/manual/html/mincer.html mincer :: Sig -> Sig -> Sig -> Tab -> Sig -> Sig -- | Looping phasor. It creates a looping pointer to the file. It's used in -- the function ram. -- -- Ther arguments are: file name, start and end of the looping segment -- (in seconds), and the playback speed. data Phsr Phsr :: String -> Sig -> Sig -> Sig -> Phsr [phsrFile] :: Phsr -> String [phsrStart] :: Phsr -> Sig [phsrEnd] :: Phsr -> Sig [phsrSpeed] :: Phsr -> Sig -- | Creates a pointer signal for reading audio from the table in loops. -- --
-- lphase length start end speed ---- -- Arguments are: -- --
-- ram fidelity phasor pitch ---- -- fidelity corresponds to the size of the FFT-window. The function -- performs the FFT transform and it has to know the size. It's not the -- value for the size it's an integer value that proportional to the -- size. The higher the value the higher the size the lower the value the -- lower the size. The default value is 0. Zero is best for most of the -- cases. For drums we can lower it to (-2). -- -- The phasor is a quadruple of values -- --
-- (Phsr fileName startTime endTime playbackSpeed) ---- -- we can read the file from startTime to endTime (in seconds) and we can -- set the speed for playback. If speed is negative file is played in -- reverse. The playback is looped. So to scale the tempo or play in -- reverse we can change the playbackSpeed. -- -- The last argument is pitch factor. We can rise by octave with factor -- 2. It's good place to use the function semitone. It produces factors -- for a number in semitones. -- -- Note that all parameters (except window size) are signals. It makes -- this function very flexible. We can change the speed of playback and -- start and end of the reading segment as we wish. -- --
-- ram 0 (Phsr "file.wav" 0 1 1.2) 1 ---- -- PS: here is the formula for window size: 2 ** (fidelity + 11) ram :: Fidelity -> Phsr -> Sig -> Sig2 ram1 :: Fidelity -> Phsr -> Sig -> Sig -- | Fidelity corresponds to the size of the FFT-window that is used by -- functions of RAM-family. The function performs the FFT transform and -- it has to know the size. It's not the value for the size it's an -- integer value that proportional to the size. The higher the value the -- higher the size the lower the value the lower the size. The default -- value is 0. Zero is best for most of the cases. For drums we can lower -- it to (-2). -- -- PS: here is the formula for window size: 2 ** (fidelity + 11). So the -- fidelity is actually the degree for power of two. The FFT-algorithm -- requires the window size to be a power of two. -- -- The lower fidelity is the less power is consumed by the function. type Fidelity = D -- | Scaling factor for tempo. The 1 is inherent tempo. type TempoSig = Sig -- | Scaling factor for pitch. The 1 is inherent pitch. type PitchSig = Sig -- | Reads file once and scales it by tempo and pitch. readRam :: Fidelity -> TempoSig -> PitchSig -> String -> Sig2 -- | Loop over file and scales it by tempo and pitch. loopRam :: Fidelity -> TempoSig -> PitchSig -> String -> Sig2 -- | Reads a segment from file once and scales it by tempo and pitch. -- Segment is defined in seconds. readSeg :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig2 -- | Loops over a segment of file and scales it by tempo and pitch. Segment -- is defined in seconds. loopSeg :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig2 -- | Reads a relative segment from file once and scales it by tempo and -- pitch. Segment is defined in seconds. The end ponits for the segment -- are relative to the total length of the file. readRel :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig2 -- | Loops over a relative segment of file and scales it by tempo and -- pitch. Segment is defined in seconds. The end ponits for the segment -- are relative to the total length of the file. loopRel :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig2 -- | The mono version of readRam. readRam1 :: Fidelity -> TempoSig -> PitchSig -> String -> Sig -- | The mono version of loopRam. loopRam1 :: Fidelity -> TempoSig -> PitchSig -> String -> Sig -- | The mono version of readSeg. readSeg1 :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig -- | The mono version of loopSeg. loopSeg1 :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig -- | The mono version of readRel. readRel1 :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> String -> Sig -- | The mono version of loopRel. loopRel1 :: Fidelity -> (Sig, Sig) -> TempoSig -> PitchSig -> 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 (Sco 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 -- | Creates a sequence of signals. Each segment lasts for fixed amount of -- time given in the first argument. lineSnd :: (Num a, Sigs a) => D -> [a] -> a -- | Creates a sequence of signals and loops over the sequence. Each -- segment lasts for fixed amount of time given in the first argument. loopLineSnd :: (Num a, Sigs a) => D -> [a] -> a -- | 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 GHC.Enum.Enum Csound.Air.Wav.SampleFormat instance GHC.Classes.Ord Csound.Air.Wav.SampleFormat instance GHC.Classes.Eq Csound.Air.Wav.SampleFormat instance GHC.Enum.Enum Csound.Air.Wav.LoopMode instance GHC.Classes.Eq Csound.Air.Wav.LoopMode instance GHC.Show.Show Csound.Air.Wav.LoopMode module Csound.Air.Seg -- | A segment of the signal. The signal segment is a limited span of -- signal in time. The time can be measured in seconds or in events! The -- time span which is measured in events is the first occurence of the -- event in the event stream. -- -- There are handy functions for scheduling the signal segments. we can -- delay the segment or loop over it or limit it with tme interval or -- play a sequence of segments. The main feature of the segments is the -- ability to schedule the signals with event streams (like button clicks -- or midi-events). data Seg a -- | Converts signals to segments. The segment is not limited in length. toSeg :: a -> Seg a -- | Converts segments to signals. runSeg :: (Sigs a) => Seg a -> a -- | Limits the length of the segment with constant length in seconds. constLim :: D -> Seg a -> Seg a -- | Delays a segment by a given time interval in seconds. constDel :: Num a => D -> Seg a -> Seg a -- | A pause. Plays nothing for the given time interval in seconds. constRest :: Num a => D -> Seg a -- | Limits a signal with an event stream and retriggers it after stop. limSnd :: Sigs a => Tick -> a -> a instance GHC.Base.Functor Csound.Air.Seg.Seg instance Csound.SigSpace.SigSpace a => Csound.SigSpace.SigSpace (Csound.Air.Seg.Seg a) instance Csound.Typed.Types.Tuple.Sigs a => Temporal.Class.Melody (Csound.Air.Seg.Seg a) instance Csound.Typed.Types.Tuple.Sigs a => Temporal.Class.Harmony (Csound.Air.Seg.Seg a) instance Csound.Typed.Types.Tuple.Sigs a => Temporal.Class.Compose (Csound.Air.Seg.Seg a) instance Csound.Typed.Types.Tuple.Sigs a => Temporal.Class.Delay (Csound.Air.Seg.Seg a) instance Csound.Typed.Types.Tuple.Sigs a => Temporal.Class.Loop (Csound.Air.Seg.Seg a) instance (Csound.Typed.Types.Tuple.Sigs a, GHC.Num.Num a) => Temporal.Class.Rest (Csound.Air.Seg.Seg a) instance Csound.Typed.Types.Tuple.Sigs a => Temporal.Class.Limit (Csound.Air.Seg.Seg a) module Csound.Air.Sampler -- | Triggers the signal with the first stream and turns it off with the -- second stream. evtTrig :: (Sigs a) => Maybe a -> Tick -> Tick -> a -> a -- | Consider note limiting? or performance degrades every note is held to -- infinity and it continues to produce zeroes. No it's not every -- sequence note triggers it but it's best to limit them anyway evtTap :: (Sigs a) => D -> Tick -> a -> a -- | Plays a list signals. It triggers the signal with event stream and -- silences all the rest in the list so that only one signal is playing. -- We can create simple costum monosynthes with this function. The last -- event stream stops all signals. evtGroup :: (Sigs a) => Maybe a -> [(Tick, a)] -> Tick -> a -- | Triggers one signal after another with an event stream. evtCycle :: (Sigs a) => Maybe a -> Tick -> Tick -> [a] -> a syncEvtTrig :: (Sigs a) => Sig -> Maybe a -> Tick -> Tick -> a -> a syncEvtTap :: (Sigs a) => Sig -> D -> Tick -> a -> a syncEvtGroup :: (Sigs a) => Sig -> Maybe a -> [(Tick, a)] -> Tick -> a -- | Triggers one signal after another with an event stream. syncEvtCycle :: (Sigs a) => Sig -> Maybe a -> Tick -> Tick -> [a] -> a -- | Triggers a signal when one of the chars from the first string is -- pressed. Stops signal from playing when one of the chars from the -- second string is pressed. charTrig :: (Sigs a) => Maybe a -> String -> String -> a -> a charTap :: Sigs a => D -> String -> a -> a -- | Plays a signal while a key is pressed. charPush :: Sigs a => Maybe a -> Char -> a -> a -- | Toggles the signal when key is pressed. charToggle :: (Sigs a) => Maybe a -> Char -> a -> a -- | Plays a list of signals when corresponding key is pressed. Turns off -- all other signals in the group. The last string is for stopping the -- group from playing. charGroup :: (Sigs a) => Maybe a -> [(Char, a)] -> String -> a -- | Plays signals one after another when key is pressed. Stops the group -- from playing when the char from the last argument is pressed. charCycle :: Sigs a => (Maybe a) -> Char -> String -> [a] -> a -- | Triggers a signal when one of the chars from the first string is -- pressed. Stops signal from playing when one of the chars from the -- second string is pressed. Synchronizes the signal with bpm (first -- argument). syncCharTrig :: (Sigs a) => Sig -> Maybe a -> String -> String -> a -> a syncCharTap :: Sigs a => Sig -> D -> String -> a -> a -- | Plays a signal while a key is pressed. Synchronized by BPM (first -- argument). syncCharPush :: Sigs a => Sig -> Maybe a -> Char -> a -> a -- | Toggles the signal when key is pressed. Synchronizes by BPM (first -- argument). syncCharToggle :: (Sigs a) => Sig -> Maybe a -> Char -> a -> a -- | Plays a list of signals when corresponding key is pressed. Turns off -- all other signals in the group. The last string is for stopping the -- group from playing. Events are syncronized by BPM (first argument). syncCharGroup :: (Sigs a) => Sig -> Maybe a -> [(Char, a)] -> String -> a -- | Plays signals one after another when key is pressed. Stops the group -- from playing when the char from the last argument is pressed. Events -- are syncronised with BPM (first argument). syncCharCycle :: Sigs a => Sig -> Maybe a -> Char -> String -> [a] -> a -- | Plays a signal when the key is pressed. Retriggers the signal when the -- key is pressed again. The key is an integer midi code. The C1 is 60 -- and the A1 is 69. midiTrig :: (SigSpace a, Sigs a) => MidiChn -> Int -> a -> SE a -- | Plays a signal when the key is pressed. Retriggers the signal when the -- key is pressed again. Turns off the signal after specified duration (n -- seconds). The key is an integer midi code. The C1 is 60 and the A1 is -- 69. midiTap :: (SigSpace a, Sigs a) => MidiChn -> D -> Int -> a -> SE a -- | Plyas a signal while the key is pressed. The key is an integer midi -- code. The C1 is 60 and the A1 is 69. midiPush :: (SigSpace a, Sigs a) => MidiChn -> Int -> a -> SE a -- | Plays and stops a signal in the toggle mode. The key is an integer -- midi code. The C1 is 60 and the A1 is 69. midiToggle :: (SigSpace a, Sigs a) => MidiChn -> Int -> a -> SE a -- | Plays a set of signals on the list of keys. When certain key is -- pressed the corresponding signal starts to play and all the rest are -- stopped. -- --
-- headPan (azimuth, elevation) asig ---- -- azimuth and elevation are measured in ratios (0, 1), headPan :: (Sig, Sig) -> Sig -> Sig2 -- | HeadPan with optional arguments. headPan' :: HeadPanSpec -> (Sig, Sig) -> Sig -> Sig2 -- | Static head response based spacialization. It works when you listen in -- headphones. It works only with sample rate of 44100, 48000 or 96000. -- It's more efficient than headPan. -- --
-- staticHeadPan (azimuth, elevation) asig ---- -- azimuth and elevation are measured in ratios (0, 1), staticHeadPan :: (D, D) -> Sig -> Sig2 -- | The same as headPan but for stereo signals. headPan2 :: (Sig, Sig) -> Sig2 -> Sig2 -- | The same as headPan' but for stereo signals. headPan2' :: HeadPanSpec -> (Sig, Sig) -> Sig2 -> Sig2 -- | The same as staticHeadPan but for stereo signals. staticHeadPan2 :: (D, D) -> Sig2 -> Sig2 -- | Net of sounds evenly distributed oround the head. First argument is a -- pair of numbers (column, rows) in the matrix. The second argument is a -- matrix written in a single list. The rows are for elevation and the -- columns are for azimuth. -- -- A ghci session example: -- --
-- let f t x = mul 0.4 $ sched (\_ -> return $ fades 0.07 0.1 * tri x) $ withDur 0.2 $ metro t -- dac $ headPanNet (3, 2) [f 1 220, f 0.75 330, f 0.5 440, f 0.2 660, delaySnd 0.75 $ f 2 (220 * 5/4),delaySnd 0.4 $ f 1 (220 * 9/8)] --headPanNet :: (Int, Int) -> [Sig] -> Sig2 -- | The same as headPanNet but for stereo signals. headPanNet2 :: (Int, Int) -> [Sig2] -> Sig2 -- | Effects module Csound.Air.Fx -- | Mono version of the cool reverberation opcode reverbsc. -- --
-- reverbsc1 asig feedbackLevel cutOffFreq --reverbsc1 :: Sig -> Feedback -> ToneSig -> Sig -- | Mono reverb (based on reverbsc) -- --
-- rever1 feedback asig --rever1 :: Feedback -> Sig -> (Sig, Sig) -- | Mono reverb (based on reverbsc) -- --
-- rever2 feedback (asigLeft, asigRight) --rever2 :: Feedback -> Sig2 -> Sig2 -- | Reverb with given time. reverTime :: DelayTime -> 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 maximum delay time. type MaxDelayTime = D -- | The delaya time type DelayTime = Sig -- | Feedback for delay type Feedback = Sig -- | Dry/Wet mix value (ranges from 0 to 1). The 0 is all dry. The 1 is all -- wet. type Balance = Sig -- | The simplest delay with feedback. Arguments are: delay length and -- decay ratio. -- --
-- echo delayLength ratio --echo :: MaxDelayTime -> Feedback -> Sig -> SE Sig -- | Delay with feedback. -- --
-- fdelay delayLength decayRatio balance --fdelay :: MaxDelayTime -> Feedback -> Balance -> Sig -> SE Sig -- | Delay with feedback. -- --
-- fdelay maxDelayLength delayLength feedback balance --fvdelay :: MaxDelayTime -> DelayTime -> Feedback -> Balance -> 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 :: MaxDelayTime -> [(DelayTime, Feedback)] -> Balance -> 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 :: MaxDelayTime -> [(DelayTime, Sig -> Sig)] -> Balance -> Sig -> SE Sig -- | Delay for functions that use some table (as a buffer). As granular -- synth or mincer. -- --
-- tabDelay fn maxDelayTime delayTime feedback balance asig --tabDelay :: (Tab -> Sig -> SE Sig) -> MaxDelayTime -> DelayTime -> Feedback -> Balance -> Sig -> SE Sig -- | Distortion. -- --
-- distort distLevel asig --distortion :: Sig -> Sig -> Sig type DepthSig = Sig type RateSig = Sig type WidthSig = Sig type ToneSig = Sig -- | Chorus. -- --
-- chorus depth rate balance asig --chorus :: DepthSig -> RateSig -> Balance -> Sig -> SE Sig -- | Flanger. Lfo depth ranges in 0 to 1. -- -- flanger lfo feedback balance asig flange :: Lfo -> Feedback -> Balance -> Sig -> Sig -- | First order phaser. phase1 :: Sig -> Lfo -> Feedback -> Balance -> Sig -> Sig -- | Second order phaser. Sweeping gaps in the timbre are placed -- harmonicaly harmPhase :: Sig -> Lfo -> Sig -> Sig -> Feedback -> Balance -> Sig -> Sig -- | Second order phaser. Sweeping gaps in the timbre are placed by powers -- of the base frequency. powerPhase :: Sig -> Lfo -> Sig -> Sig -> Feedback -> Balance -> Sig -> Sig -- | Distortion -- --
-- fxDistort level drive tone sigIn --fxDistort :: Feedback -> Sig -> ToneSig -> Sig -> Sig -- | Stereo distortion. fxDistort2 :: Feedback -> Sig -> ToneSig -> Sig2 -> Sig2 -- | Stereo chorus. -- --
-- stChorus2 mix rate depth width sigIn --stChorus2 :: Balance -> RateSig -> DepthSig -> WidthSig -> Sig2 -> Sig2 -- | Phaser -- --
-- fxPhaser mix rate depth freq feedback sigIn --fxPhaser :: Balance -> Feedback -> RateSig -> DepthSig -> Sig -> Sig -> Sig -- | Stereo phaser. fxPhaser2 :: Balance -> Feedback -> RateSig -> DepthSig -> Sig -> Sig2 -> Sig2 -- | Flanger -- --
-- fxFlanger mix feedback rate depth delay sigIn --fxFlanger :: Balance -> Feedback -> RateSig -> DepthSig -> DelayTime -> Sig -> Sig -- | Stereo flanger fxFlanger2 :: Balance -> Feedback -> RateSig -> DepthSig -> DelayTime -> Sig2 -> Sig2 -- | Analog delay. -- --
-- analogDelay mix feedback time tone sigIn --analogDelay :: Balance -> Feedback -> DelayTime -> ToneSig -> Sig -> SE Sig -- | Stereo analog delay. analogDelay2 :: Balance -> Feedback -> DelayTime -> ToneSig -> 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 -- | Instrument plays an input signal in different modes. The segments of -- signal can be played back and forth. -- --
-- trackerSplice maxLength segLength mode ---- --
-- main = dac $ do -- let ev ch1 ch2 dt = fmap (\x -> (x, dt)) $ mconcat [ -- fmap (const 1.5) $ charOn ch1 -- , fmap (const 2.5) $ charOn ch2 -- , fmap (const 0) $ charOff ch1 <> charOff ch2] -- -- (k, dt) <- stepper (0, 0.1) $ ev 'q' 'w' 0.1 <> ev 'a' 's' 0.2 <> ev 'z' 'x' 0.4 -- mul 1.3 $ trackerSplice 0.8 dt (int' k) $ fst $ loopWav 1 "drumLoop.wav" --trackerSplice :: D -> Sig -> Sig -> Sig -> SE Sig -- | The Csound contains a set of functions for granular synthesis. -- Unfortunately they are very hard to use due to large number of -- arguments. This module attempts to set most of the arguments with -- sensible defaults. So that a novice could start to use it. The -- defaults are implemented with the help of the class Default. -- It's a standard way to implement defaults in the Haskell. The class -- Defaults defines a single constnat called def. With -- def we can get the default value for the given type. -- -- Several csound opcodes are reimplemented so that first argument -- contains secondary parameters. The type for parameters always has the -- instance for the class Default. The original csound opcodes -- are defined in the end of the module with prefix csd. -- -- Also many granular synth opcodes expect the sound file as input. There -- are predefined versions of the opcodes that take in the file names -- instead of tables with sampled sound. They have suffix Snd -- for stereo and Snd1 for mono files. -- -- For example, that's how we can use the granule opcode: -- --
-- dac $ granuleSnd1 spec [1, 2, 3] grainSize "fox.wav" ---- -- No need to set all 22 parameters. Look at the official tutorial (on -- github) for more examples. -- -- The five functions are reimplemented in this way: sndwarp, -- syncgrain, partikkel, granule, -- fof2. -- -- The most often used arguments are: -- --
-- grainy1 speed grainrate grainsize kfreqFactor file ---- --
-- grainy1 speed grainrate grainsize kfreqFactor file ---- --
-- ptrGrainy grainrate grainsize kfreqFactor tab apnter ---- --
-- ptrGrainy grainrate grainsize kfreqFactor tab apnter ---- --
-- ptrGrainy grainrate grainsize kfreqFactor tab apnter ---- --
-- sndwarp spec resample speed ftab ---- --
-- sndwarp spec resample ftab ptr ---- --
-- syncgrain spec graidDuration timeScale PitchSig ftab ---- --
-- granule spec chord grainSize ftab ---- --
-- partikkel spec grainrate grainsize kpitch ifiltabs apnters ---- --
-- grainRate = 25 -- grainSize = 2.5 --fofDelay :: MaxDelayTime -> DelayTime -> Feedback -> Balance -> Fof2Spec -> GrainRate -> GrainSize -> Sig -> SE Sig -- | Granular effect for grainy. grainyFx :: GrainRate -> GrainSize -> PitchSig -> Sig -> SE Sig -- | Granular effect for rndGrainy. rndGrainyFx :: RndGrainySpec -> GrainRate -> GrainSize -> PitchSig -> Sig -> SE Sig -- | Granular effect for sndwarp. sndwarpFx :: SndwarpSpec -> PitchSig -> Sig -> SE Sig -- | Granular effect for syncgrain. syncgrainFx :: SyncgrainSpec -> GrainSize -> TempoSig -> PitchSig -> Sig -> SE Sig -- | Granular effect for rndSyncgrain. rndSyncgrainFx :: RndSyncgrainSpec -> SyncgrainSpec -> GrainSize -> TempoSig -> PitchSig -> Sig -> SE Sig -- | Granular effect for partikkel. partikkelFx :: PartikkelSpec -> GrainRate -> GrainSize -> PitchSig -> Sig -> SE Sig -- | Granular effect for fof2. fofFx :: Fof2Spec -> GrainRate -> GrainSize -> Sig -> SE Sig -- | Reads a mono sound sample from a table and applies time-stretching -- and/or pitch modification. -- -- sndwarp reads sound samples from a table and applies time-stretching -- and/or pitch modification. Time and frequency modification are -- independent from one another. For example, a sound can be stretched in -- time while raising the pitch! -- --
-- ares [, ac] sndwarp xamp, xtimewarp, xresample, ifn1, ibeg, iwsize, \ -- irandw, ioverlap, ifn2, itimemode ---- -- csound doc: http://www.csounds.com/manual/html/sndwarp.html csdSndwarp :: Sig -> Sig -> Sig -> Tab -> D -> D -> D -> D -> Tab -> D -> Sig -- | Reads a stereo sound sample from a table and applies time-stretching -- and/or pitch modification. -- -- sndwarpst reads stereo sound samples from a table and applies -- time-stretching and/or pitch modification. Time and frequency -- modification are independent from one another. For example, a sound -- can be stretched in time while raising the pitch! -- --
-- ar1, ar2 [,ac1] [, ac2] sndwarpst xamp, xtimewarp, xresample, ifn1, \ -- ibeg, iwsize, irandw, ioverlap, ifn2, itimemode ---- -- csound doc: http://www.csounds.com/manual/html/sndwarpst.html csdSndwarpst :: Sig -> Sig -> Sig -> Tab -> D -> D -> D -> D -> Tab -> D -> Sig2 -- | Synchronous granular synthesis. -- -- syncgrain implements synchronous granular synthesis. The source sound -- for the grains is obtained by reading a function table containing the -- samples of the source waveform. For sampled-sound sources, GEN01 is -- used. syncgrain will accept deferred allocation tables. -- --
-- asig syncgrain kamp, kfreq, kpitch, kgrsize, kprate, ifun1, \ -- ifun2, iolaps ---- -- csound doc: http://www.csounds.com/manual/html/syncgrain.html csdSyncgrain :: Sig -> Sig -> Sig -> Sig -> Sig -> Tab -> Tab -> D -> Sig -- | A more complex granular synthesis texture generator. -- -- The granule unit generator is more complex than grain, but does add -- new possibilities. -- --
-- ares granule xamp, ivoice, iratio, imode, ithd, ifn, ipshift, igskip, \ -- igskip_os, ilength, kgap, igap_os, kgsize, igsize_os, iatt, idec \ -- [, iseed] [, ipitch1] [, ipitch2] [, ipitch3] [, ipitch4] [, ifnenv] ---- -- csound doc: http://www.csounds.com/manual/html/granule.html csdGranule :: Sig -> D -> D -> D -> D -> Tab -> D -> D -> D -> D -> Sig -> D -> Sig -> D -> D -> D -> Sig -- | Granular synthesizer with "per grain" control over many of its -- parameters. Has a sync input to sychronize its internal grain -- scheduler clock to an external clock source. -- -- partikkel was conceived after reading Curtis Roads' book -- Microsound, and the goal was to create an opcode that was -- capable of all time-domain varieties of granular synthesis described -- in this book. The idea being that most of the techniques only differ -- in parameter values, and by having a single opcode that can do all -- varieties of granular synthesis makes it possible to interpolate -- between techniques. Granular synthesis is sometimes dubbed particle -- synthesis, and it was thought apt to name the opcode partikkel to -- distinguish it from other granular opcodes. -- --
-- a1 [, a2, a3, a4, a5, a6, a7, a8] partikkel agrainfreq, \ -- kdistribution, idisttab, async, kenv2amt, ienv2tab, ienv_attack, \ -- ienv_decay, ksustain_amount, ka_d_ratio, kduration, kamp, igainmasks, \ -- kwavfreq, ksweepshape, iwavfreqstarttab, iwavfreqendtab, awavfm, \ -- ifmamptab, kfmenv, icosine, ktraincps, knumpartials, kchroma, \ -- ichannelmasks, krandommask, kwaveform1, kwaveform2, kwaveform3, \ -- kwaveform4, iwaveamptab, asamplepos1, asamplepos2, asamplepos3, \ -- asamplepos4, kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains \ -- [, iopcode_id] ---- -- csound doc: http://www.csounds.com/manual/html/partikkel.html csdPartikkel :: Tuple a => Sig -> Sig -> Tab -> Sig -> Sig -> Tab -> Tab -> Tab -> Sig -> Sig -> Sig -> Sig -> Tab -> Sig -> Sig -> Tab -> Tab -> Sig -> Tab -> Tab -> Tab -> Sig -> Sig -> Sig -> Tab -> Sig -> Tab -> Tab -> Tab -> Tab -> Tab -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> D -> a instance Data.Default.Class.Default Csound.Air.Granular.PartikkelSpec instance Data.Default.Class.Default Csound.Air.Granular.RndGrainySpec instance Data.Default.Class.Default Csound.Air.Granular.GranuleMode instance Data.Default.Class.Default Csound.Air.Granular.GranuleSpec instance Data.Default.Class.Default Csound.Air.Granular.SyncgrainSpec instance Data.Default.Class.Default Csound.Air.Granular.RndSyncgrainSpec instance Data.Default.Class.Default Csound.Air.Granular.SndwarpSpec instance Data.Default.Class.Default Csound.Air.Granular.Fof2Spec -- | Patches. module Csound.Air.Patch -- | A simple csound note (good for playing with midi-keyboard). It's a -- pair of amplitude (0 to 1) and freuqncy (Hz). type CsdNote a = (a, a) -- | An instrument transforms a note to a signal. type Instr a b = CsdNote a -> SE b -- | An effect processes the input signal. type Fx a = a -> SE a -- | Mono effect. type Fx1 = Fx Sig -- | Stereo effect. type Fx2 = Fx Sig2 data FxSpec a FxSpec :: DryWetRatio -> Fx a -> FxSpec a [fxMix] :: FxSpec a -> DryWetRatio [fxFun] :: FxSpec a -> Fx a type DryWetRatio = Sig -- | Mono patches. type Patch1 = Patch D Sig -- | Stereo patches. type Patch2 = Patch D Sig2 -- | A patch. It's an instrument, an effect and default dry/wet ratio. data Patch a b Patch :: Instr a b -> [FxSpec b] -> Patch a b [patchInstr] :: Patch a b -> Instr a b [patchFx] :: Patch a b -> [FxSpec b] -- | Mono continuous patches. type PatchSig1 = Patch Sig Sig -- | Stereo continuous patches. type PatchSig2 = Patch Sig Sig2 -- | Transforms all the effects for the given patch into a single function. getPatchFx :: (SigSpace a, Sigs a) => Patch b a -> Fx a dryPatch :: Patch a b -> Patch a b -- | Sets the mix of the last effect. atMix :: Sig -> Patch a b -> Patch a b -- | Sets the mix of the effects from last to first. atMixes :: [Sig] -> Patch a b -> Patch a b -- | Plays a patch with midi. Supplies a custom value for mixing effects -- (dry/wet). The 0 is a dry signal, the 1 is a wet signal. atMidi :: (SigSpace a, Sigs a) => Patch D a -> SE a -- | Simplified monosynth patch atMono :: (SigSpace a, Sigs a) => Patch Sig a -> SE a -- | Monosynth patch. Plays the patch with function monoMsg -- --
-- atMonoMidi midiChn portamentotime releaseTime patch --atMono' :: (SigSpace a, Sigs a) => MidiChn -> D -> D -> Patch Sig a -> SE a -- | Simplified monosynth patch (sharp attack and transitions) atMonoSharp :: (SigSpace a, Sigs a) => Patch Sig a -> SE a -- | Monosynth patch. Plays the patch with function holdMsg -- --
-- atMonoMidi midiChn portamentotime patch --atHoldMidi :: (SigSpace a, Sigs a) => MidiChn -> D -> Patch Sig a -> SE a -- | Plays a patch with event stream. Supplies a custom value for mixing -- effects (dry/wet). The 0 is a dry signal, the 1 is a wet signal. atSched :: (SigSpace a, Sigs a) => Patch D a -> Evt (Sco (CsdNote D)) -> SE a atSchedUntil :: (SigSpace a, Sigs a) => Patch D a -> Evt (CsdNote D) -> Evt b -> SE a -- | Plays a patch with scores. Supplies a custom value for mixing effects -- (dry/wet). The 0 is a dry signal, the 1 is a wet signal. atSco :: (SigSpace a, Sigs a) => Patch D a -> Sco (CsdNote D) -> Sco (Mix a) -- | Plays a patch at the given note. atNote :: (SigSpace b, Sigs b) => Patch a b -> CsdNote a -> SE b -- | Adds an effect to the patch's instrument. addInstrFx :: Fx b -> Patch a b -> Patch a b -- | Appends an effect before patch's effect. addPreFx :: DryWetRatio -> Fx b -> Patch a b -> Patch a b -- | Appends an effect after patch's effect. addPostFx :: DryWetRatio -> Fx b -> Patch a b -> Patch a b harmonPatch :: (Fractional a, SigSpace b, Sigs b) => [Sig] -> [a] -> Patch a b -> Patch a b deepPad :: (Fractional a, SigSpace b, Sigs b) => Patch a b -> Patch a b -- | Plays the patch when confition is true otherwise it produces silence. patchWhen :: Sigs b => BoolSig -> Patch a b -> Patch a b mixInstr :: (SigSpace b, Num b) => Sig -> Patch a b -> Patch a b -> Patch a b withSmallRoom :: Patch2 -> Patch2 withSmallRoom' :: DryWetRatio -> Patch2 -> Patch2 withSmallHall :: Patch2 -> Patch2 withSmallHall' :: DryWetRatio -> Patch2 -> Patch2 withLargeHall :: Patch2 -> Patch2 withLargeHall' :: DryWetRatio -> Patch2 -> Patch2 withMagicCave :: Patch2 -> Patch2 withMagicCave' :: DryWetRatio -> Patch2 -> Patch2 sfPatch :: Sf -> Patch2 sfPatchHall :: Sf -> Patch2 instance Csound.SigSpace.SigSpace a => Csound.SigSpace.SigSpace (Csound.Air.Patch.Patch b a) -- | 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) -- | Delay a signal by certain number of seconds There is a subtle -- difference between the function and the function delaySnd. -- The delaySig is for delaying a signal on a micro level (the -- delay time have to be small) It's implemented with delay buffer in the -- csound. But delaySnd is for delaying on macro level (the -- delay time can be big). It's implemented with scores and invocation of -- hidden instruments. -- --
-- delaySig numOfSamples asig --delaySig :: D -> Sig -> Sig -- | Wave shaper. The signal should be bepolar. It ranges within the -- interval [-1, 1]. -- --
-- wshaper table amount asig ---- -- wave shaper transforms the input signal with the table. The amount of -- transformation scales the signal from 0 to 10. the amount is ratio of -- scaling. It expects the values from the interval [0, 1]. wshaper :: Tab -> Sig -> Sig -> Sig -- | Wave shaper with sigmoid. -- --
-- genSaturator sigmoidRadius amount asig ---- --
-- genSaturator 10 --saturator :: Sig -> Sig -> Sig -- | Alias for -- --
-- genSaturator 5 --mildSaturator :: Sig -> Sig -> Sig -- | Alias for -- --
-- genSaturator 50 --hardSaturator :: Sig -> Sig -> Sig -- | Alias for -- --
-- genSaturator 100 --hardSaturator2 :: Sig -> Sig -> Sig -- | Chains all functions in the list. funSeq :: [a -> a] -> a -> a -- | Applies all functions in the list to the given input and summs them -- up. funPar :: Num a => [a -> a] -> a -> a -- | Metronome. -- --
-- ticks n bpm --ticks :: Int -> Sig -> Sig -- | Metronome with a chain of accents. A typical 7/8 for example: -- --
-- dac $ nticks [3, 2, 2] (135 * 2) --nticks :: [Int] -> Sig -> Sig ticks2 :: Int -> Sig -> Sig nticks2 :: [Int] -> Sig -> Sig ticks3 :: Int -> Sig -> Sig nticks3 :: [Int] -> Sig -> Sig ticks4 :: Int -> Sig -> Sig nticks4 :: [Int] -> Sig -> Sig testDrone :: D -> SE Sig2 testDrone2 :: D -> SE Sig2 testDrone3 :: D -> SE Sig2 testDrone4 :: D -> SE Sig2 instance Data.Default.Class.Default Csound.Air.Misc.RazorPad -- | 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 -- | Midi chooser implemented as FX-box. uiMidi :: [(String, Msg -> SE Sig2)] -> Int -> Source FxFun -- | Patch chooser implemented as FX-box. uiPatch :: [(String, Patch2)] -> Int -> 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 Csound.SigSpace.SigSpace Csound.Air.Live.FxFun instance Csound.Air.Live.FxUI (Csound.Typed.Types.Tuple.Sig2 -> Csound.Typed.Types.Tuple.Sig2) instance Csound.Air.Live.FxUI Csound.Air.Live.FxFun instance Csound.Air.Live.FxUI a => Csound.Air.Live.FxUI (Csound.Typed.Types.Prim.Sig -> a) -- | A multitap looper. module Csound.Air.Looper -- | The type for fine tuning of the looper. Let's review the values: -- --
-- def { loopTap = Just someEvt }
--
data LoopControl
LoopControl :: Maybe (Evt D) -> Maybe ([Evt D]) -> Maybe Tick -> Maybe (Evt D) -> LoopControl
[loopTap] :: LoopControl -> Maybe (Evt D)
[loopFade] :: LoopControl -> Maybe ([Evt D])
[loopDel] :: LoopControl -> Maybe Tick
[loopThrough] :: LoopControl -> Maybe (Evt D)
-- | Simple multitap Looper. We can create as many taps as we like also we
-- can create fade outs/ins insert effects and control mix.
--
-- -- sigLoop spec bpm times imputs ---- -- Arguments: -- --
-- let f = hvs1 [[100, 0.1], [300, 0.1], [600, 0.5], [800, 0.9]] -- dac $ lift1 (\x -> fmap (\[cps, q] -> mlp cps q (saw 110)) $ f x) (uknob 0.5) ---- -- Notice the exact pattern match with the list in the argument of the -- lambda function: -- --
-- \[cps, q] -> mlp cps q (saw 110)) $ f x ---- -- It's determined by the length of the items in the input list. hvs1 :: HvsMatrix1 -> Sig -> SE [Sig] -- | Two dimensional Hyper vectorial synthesis. Now we provide a list of -- lists of vectors. The length of all vectors should be the same but -- there is no limit for the number! So that's how we can control a lot -- of parameters with pair of signals. The input 2D atrix is the grid of -- samples. It finds the closest four points in the grid and interpolates -- between them (it's a weighted sum). -- --
-- hvs2 matrix (x, y) ---- -- The usage is the same as in the case of hvs1. An example: -- --
-- g = hvs2 [[[100, 0.1, 0.3], [800, 0.1, 0.5], [1400, 0.1, 0.8]], -- [[100, 0.5, 0.3], [800, 0.5, 0.5], [1400, 0.5, 0.8]], -- [[100, 0.8, 0.3], [800, 0.8, 0.5], [1400, 0.8, 0.8]]] -- -- main = dac $ do -- (g1, kx) <- uknob 0.5 -- (g2, ky) <- uknob 0.5 -- [cfq, q, w] <- g (kx, ky) -- panel $ hor [g1, g2] -- at (mlp cfq q) $ fmap (cfd w (saw 110)) (white) --hvs2 :: HvsMatrix2 -> Sig2 -> SE [Sig] -- | The three dimensional hvs3 :: HvsMatrix3 -> Sig3 -> SE [Sig] -- | Allows one-dimensional Hyper Vectorial Synthesis (HVS) controlled by -- externally-updated k-variables. -- -- hvs1 allows one-dimensional Hyper Vectorial Synthesis (HVS) controlled -- by externally-updated k-variables. -- --
-- hvs1 kx, inumParms, inumPointsX, iOutTab, iPositionsTab, iSnapTab [, iConfigTab] ---- -- csound doc: http://www.csounds.com/manual/html/hvs1.html csdHvs1 :: Sig -> D -> D -> Tab -> Tab -> Tab -> SE () -- | Allows two-dimensional Hyper Vectorial Synthesis (HVS) controlled by -- externally-updated k-variables. -- -- hvs2 allows two-dimensional Hyper Vectorial Synthesis (HVS) controlled -- by externally-updated k-variables. -- --
-- hvs2 kx, ky, inumParms, inumPointsX, inumPointsY, iOutTab, iPositionsTab, iSnapTab [, iConfigTab] ---- -- csound doc: http://www.csounds.com/manual/html/hvs2.html csdHvs2 :: Sig -> Sig -> D -> D -> D -> Tab -> Tab -> Tab -> SE () -- | Allows three-dimensional Hyper Vectorial Synthesis (HVS) controlled by -- externally-updated k-variables. -- -- hvs3 allows three-dimensional Hyper Vectorial Synthesis (HVS) -- controlled by externally-updated k-variables. -- --
-- hvs3 kx, ky, kz, inumParms, inumPointsX, inumPointsY, inumPointsZ, iOutTab, iPositionsTab, iSnapTab [, iConfigTab] ---- -- csound doc: http://www.csounds.com/manual/html/hvs3.html csdHvs3 :: Sig -> Sig -> Sig -> D -> D -> D -> D -> Tab -> Tab -> Tab -> SE ()