-- 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): -- --
-- 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 :: Int -> 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 -- | Reads left channel of audio-file wavLeft :: String -> Tab -- | Reads right channel of audio-file wavRight :: String -> 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 -- | Reads left channel of mp3-file mp3Left :: String -> Tab -- | Reads right channel of mp3-file mp3Right :: String -> Tab -- | Reads mono of mp3-file mp3m :: String -> Tab -- | Reads numbers from file (GEN23) -- -- csound doc: http://www.csounds.com/manual/html/GEN23.html readNumFile :: String -> Tab -- | Reads trajectory from file (GEN28) -- -- csound doc: http://www.csounds.com/manual/html/GEN28.html readTrajectoryFile :: String -> Tab -- | Reads PVOCEX files (GEN43) -- -- csound doc: http://www.csounds.com/manual/html/GEN43.html readPvocex :: String -> Int -> Tab -- | readMultichannel — Creates an interleaved multichannel table from the -- specified source tables, in the format expected by the ftconv opcode -- (GEN52). -- --
-- f # time size 52 nchannels fsrc1 offset1 srcchnls1 [fsrc2 offset2 srcchnls2 ... fsrcN offsetN srcchnlsN] ---- -- csound doc: http://www.csounds.com/manual/html/GEN52.html readMultichannel :: Int -> [(Tab, Int, Int)] -> 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 -- | Sines with bandwidth (simplified padsynth generator) -- -- bwSines harmonics bandwidth bwSines :: [Double] -> Double -> Tab -- | Sines with bandwidth (simplified padsynth generator). Only odd -- harmonics are present -- -- bwOddSines harmonics bandwidth bwOddSines :: [Double] -> Double -> Tab -- | It's just like sines3 but inplace of pure sinewave it uses supplied in -- the first argument shape. -- -- mixOnTab srcTable [(partialNumber, partialStrength, partialPahse)] -- -- phahse is in range [0, 1] mixOnTab :: Tab -> [(PartialNumber, PartialStrength, PartialPhase)] -> Tab -- | It's like mixOnTab but it's more generic since we can mix not -- only one shape. But we can specify shape for each harmonic. mixTabs :: [(Tab, PartialNumber, PartialStrength, PartialPhase)] -> Tab -- | Csound's GEN33 — Generate composite waveforms by mixing simple -- sinusoids. -- --
-- tabSines1 srcTab nh scl [fmode] ---- -- Csound docs: http://www.csounds.com/manual/html/GEN33.html tabSines1 :: Tab -> Double -> Double -> Maybe Double -> Tab -- | Csound's GEN34 — Generate composite waveforms by mixing simple -- sinusoids. -- --
-- tabSines2 srcTab nh scl [fmode] ---- -- Csound docs: http://www.csounds.com/manual/html/GEN3.html tabSines2 :: Tab -> Double -> Double -> Maybe Double -> Tab -- | "wave" — Generates a compactly supported wavelet function. -- --
-- waveletTab srcTab seq ---- -- Csound docs: http://www.csounds.com/manual/html/GENwave.html waveletTab :: Tab -> Int -> Tab -- | "wave" — Generates a compactly supported wavelet function. The result -- table is rescaled. -- --
-- waveletTab srcTab seq ---- -- Csound docs: http://www.csounds.com/manual/html/GENwave.html rescaleWaveletTab :: Tab -> Int -> Tab -- | Table for pure sine wave. sine :: Tab -- | Table for pure cosine wave. cosine :: Tab -- | Table for sigmoid wave. sigmoid :: Tab -- | Table for sigmoid rise wave. sigmoidRise :: Tab -- | Table for sigmoid fall wave. sigmoidFall :: Tab -- | Creates tanh sigmoid. The argument is the radius of teh sigmoid. tanhSigmoid :: Double -> Tab -- | Linear segments that form a singl cycle of triangle wave. triTab :: Tab -- | Linear segments that form a single cycle of sawtooth wave. sawTab :: Tab -- | Linear segments that form a single cycle of square wave. sqrTab :: Tab -- | Pulse-width wave formed with linear segments. Duty cycle rages from 0 -- to 1. 0.5 is a square wave. pwTab :: Double -> Tab -- | Tab with tanh from the given interval. -- --
-- tanhTab (start, end) --tanhTab :: (Double, Double) -> Tab -- | Tab with tanh from the given interval. The table is rescaled. -- --
-- rescaleTanhTab (start, end) --rescaleTanhTab :: (Double, Double) -> Tab -- | Tab with exponential from the given interval. -- --
-- expTab (start, end) --expTab :: (Double, Double) -> Tab -- | Tab with exponential from the given interval. The table is rescaled. -- --
-- rescaleExpTab (start, end) --rescaleExpTab :: (Double, Double) -> Tab -- | Tab with sone from the given interval. -- --
-- soneTab (start, end) equalpoint ---- --
-- soneTab (start, end) equalpoint ---- --
-- fareyTab mode num ---- -- num -- the integer n for generating Farey Sequence Fn -- -- mode -- integer to trigger a specific output to be written into the -- table: -- --
-- 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)) ---- --
-- bpLins [x1, y1, x2, y2, ..., xN, yN] ---- -- csound docs: http://www.csounds.com/manual/html/GEN27.html -- -- All x1, x2, .. should belong to the interval [0, 1]. The actual values -- are rescaled to fit the table size. bpLins :: [Double] -> Tab -- | Exponential segments in breakpoint fashion: -- --
-- bpExps [x1, y1, x2, y2, ..., xN, yN] ---- -- csound docs: http://www.csounds.com/manual/html/GEN25.html -- -- All x1, x2, .. should belong to the interval [0, 1]. The actual values -- are rescaled to fit the table size. bpExps :: [Double] -> Tab -- | Equally spaced constant segments. -- --
-- 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 etabseg :: [(Tab, PartialStrength)] -> 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 -- | Uniform (positive numbers only) uniDist :: Tab -- | Linear (positive numbers only) linDist :: Tab -- | Triangular (positive and negative numbers) triDist :: Tab -- | Exponential (positive numbers only) expDist :: Tab -- | Biexponential (positive and negative numbers) biexpDist :: Tab -- | Gaussian (positive and negative numbers) gaussDist :: Tab -- | Cauchy (positive and negative numbers) cauchyDist :: Tab -- | Positive Cauchy (positive numbers only) pcauchyDist :: Tab -- | Beta (positive numbers only) -- --
-- betaDist alpha beta ---- --
-- randDist [value1, prob1, value2, prob2, value3, prob3 ... valueN, probN] ---- -- The first number of each pair is a value, and the second is the -- probability of that value to be chosen by a random algorithm. Even if -- any number can be assigned to the probability element of each pair, it -- is suggested to give it a percent value, in order to make it clearer -- for the user. -- -- This subroutine is designed to be used together with duserrnd and urd -- opcodes (see duserrnd for more information). randDist :: [Double] -> Tab -- | rangeDist — Generates a random distribution of discrete ranges of -- values (GEN42). -- -- The first number of each group is a the minimum value of the range, -- the second is the maximum value and the third is the probability of -- that an element belonging to that range of values can be chosen by a -- random algorithm. Probabilities for a range should be a fraction of 1, -- and the sum of the probabilities for all the ranges should total 1.0. -- -- This subroutine is designed to be used together with duserrnd and urd -- opcodes (see duserrnd for more information). Since both duserrnd and -- urd do not use any interpolation, it is suggested to give a size -- reasonably big. rangeDist :: [Double] -> Tab -- | The Hamming window. The peak equals to 1. winHamming :: Tab -- | The Hanning window. The peak equals to 1. winHanning :: Tab -- | The Bartlett window. The peak equals to 1. winBartlett :: Tab -- | The Blackman window. The peak equals to 1. winBlackman :: Tab -- | The Harris window. The peak equals to 1. winHarris :: Tab -- | This creates a function that contains a Gaussian window with a maximum -- value of 1. The extra argument specifies how broad the window is, as -- the standard deviation of the curve; in this example the s.d. is 2. -- The default value is 1. -- --
-- winGauss 2 --winGauss :: Double -> Tab -- | This creates a function that contains a Kaiser window with a maximum -- value of 1. The extra argument specifies how "open" the window is, for -- example a value of 0 results in a rectangular window and a value of 10 -- in a Hamming like window. -- --
-- winKaiser openness --winKaiser :: Double -> Tab -- | The Rectangle window. The peak equals to 1. winRectangle :: Tab -- | The Sync window. The peak equals to 1. winSync :: Tab -- | Creates tables for the padsynth algorithm (described at -- http://www.paulnasca.com/algorithms-created-by-me). The table -- size should be very big the default is 18 power of 2. -- -- csound docs: -- http://csound.github.io/docs/manual/GENpadsynth.html padsynth :: PadsynthSpec -> Tab -- | Padsynth parameters. -- -- see for details: -- http://csound.github.io/docs/manual/GENpadsynth.html data PadsynthSpec PadsynthSpec :: Double -> Double -> Double -> Double -> PadsynthShape -> Double -> [Double] -> PadsynthSpec [padsynthFundamental] :: PadsynthSpec -> Double [padsynthBandwidth] :: PadsynthSpec -> Double [padsynthPartialScale] :: PadsynthSpec -> Double [padsynthHarmonicStretch] :: PadsynthSpec -> Double [padsynthShape] :: PadsynthSpec -> PadsynthShape [padsynthShapeParameter] :: PadsynthSpec -> Double [padsynthHarmonics] :: PadsynthSpec -> [Double] data PadsynthShape GaussShape :: PadsynthShape SquareShape :: PadsynthShape ExpShape :: PadsynthShape -- | Specs for padsynth algorithm: -- --
-- defPadsynthSpec partialBandwidth harmonics ---- --
-- tabHarmonics src minh maxh [ref_sr] [interp] ---- --
-- scaleTab (minValue, maxValue) sourceTab --scaleTab :: (Double, Double) -> Tab -> 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 -- | tablew — Change the contents of existing function tables. -- -- This opcode operates on existing function tables, changing their -- contents. tablew is for writing at k- or at a-rates, with the table -- number being specified at init time. Using tablew with i-rate signal -- and index values is allowed, but the specified data will always be -- written to the function table at k-rate, not during the initialization -- pass. The valid combinations of variable types are shown by the first -- letter of the variable names. -- --
-- tablew asig, andx, ifn [, ixmode] [, ixoff] [, iwgmode] -- tablew isig, indx, ifn [, ixmode] [, ixoff] [, iwgmode] -- tablew ksig, kndx, ifn [, ixmode] [, ixoff] [, iwgmode] ---- -- csound doc: http://www.csounds.com/manual/html/tablew.html tablew :: Sig -> Sig -> Tab -> SE () -- | Notice that this function is the same as tab, but it wraps -- the output in the SE-monad. So you can use the tab if your -- table is read-only and you can use readTab if you want to -- update the table and the order of read/write operation is important. -- -- Fast table opcodes. -- -- Fast table opcodes. Faster than table and tablew because don't allow -- wrap-around and limit and don't check index validity. Have been -- implemented in order to provide fast access to arrays. Support -- non-power of two tables (can be generated by any GEN function by -- giving a negative length value). -- --
-- kr tab kndx, ifn[, ixmode] -- ar tab xndx, ifn[, ixmode] ---- -- csound doc: http://www.csounds.com/manual/html/tab.html readTab :: Sig -> Tab -> SE Sig -- | Notice that this function is the same as table, but it wraps -- the output in the SE-monad. So you can use the table if your -- table is read-only and you can use readTable if you want to -- update the table and the order of read/write operation is important. -- -- Accesses table values by direct indexing. -- --
-- ares table andx, ifn [, ixmode] [, ixoff] [, iwrap] -- ires table indx, ifn [, ixmode] [, ixoff] [, iwrap] -- kres table kndx, ifn [, ixmode] [, ixoff] [, iwrap] ---- -- csound doc: http://www.csounds.com/manual/html/table.html readTable :: SigOrD a => a -> Tab -> SE a -- | Notice that this function is the same as tablei, but it wraps -- the output in the SE-monad. So you can use the tablei if your -- table is read-only and you can use readTablei if you want to -- update the table and the order of read/write operation is important. -- -- Accesses table values by direct indexing with cubic interpolation. -- --
-- ares table3 andx, ifn [, ixmode] [, ixoff] [, iwrap] -- ires table3 indx, ifn [, ixmode] [, ixoff] [, iwrap] -- kres table3 kndx, ifn [, ixmode] [, ixoff] [, iwrap] ---- -- csound doc: http://www.csounds.com/manual/html/table3.html readTable3 :: SigOrD a => a -> Tab -> SE a -- | Notice that this function is the same as table3, but it wraps -- the output in the SE-monad. So you can use the table3 if your -- table is read-only and you can use readTable3 if you want to -- update the table and the order of read/write operation is important. -- -- Accesses table values by direct indexing with linear interpolation. -- --
-- ares tablei andx, ifn [, ixmode] [, ixoff] [, iwrap] -- ires tablei indx, ifn [, ixmode] [, ixoff] [, iwrap] -- kres tablei kndx, ifn [, ixmode] [, ixoff] [, iwrap] ---- -- csound doc: http://www.csounds.com/manual/html/tablei.html readTablei :: SigOrD a => a -> Tab -> SE a -- | tableikt — Provides k-rate control over table numbers. -- -- k-rate control over table numbers. Function tables are read with -- linear interpolation. The standard Csound opcode tablei, when -- producing a k- or a-rate result, can only use an init-time variable to -- select the table number. tableikt accepts k-rate control as well as -- i-time. In all other respects they are similar to the original -- opcodes. -- --
-- ares tableikt xndx, kfn [, ixmode] [, ixoff] [, iwrap] -- kres tableikt kndx, kfn [, ixmode] [, ixoff] [, iwrap] ---- -- csound doc: http://www.csounds.com/manual/html/tableikt.html tableikt :: Sig -> Tab -> Sig -- | tablekt — Provides k-rate control over table numbers. -- -- k-rate control over table numbers. Function tables are read with -- linear interpolation. The standard Csound opcode table when producing -- a k- or a-rate result, can only use an init-time variable to select -- the table number. tablekt accepts k-rate control as well as i-time. In -- all other respects they are similar to the original opcodes. -- --
-- ares tablekt xndx, kfn [, ixmode] [, ixoff] [, iwrap] -- kres tablekt kndx, kfn [, ixmode] [, ixoff] [, iwrap] ---- -- csound doc: http://www.csounds.com/manual/html/tablekt.html tablekt :: Sig -> Tab -> Sig -- | tablexkt — Reads function tables with linear, cubic, or sinc -- interpolation. -- --
-- ares tablexkt xndx, kfn, kwarp, iwsize [, ixmode] [, ixoff] [, iwrap] ---- -- csound doc: http://www.csounds.com/manual/html/tablexkt.html tablexkt :: Sig -> Tab -> Sig -> D -> Sig -- | cuserrnd — Continuous USER-defined-distribution RaNDom generator. -- -- Continuous USER-defined-distribution RaNDom generator. -- --
-- aout cuserrnd kmin, kmax, ktableNum -- iout cuserrnd imin, imax, itableNum -- kout cuserrnd kmin, kmax, ktableNum ---- -- csound doc: http://www.csounds.com/manual/html/cuserrnd.html -- -- the tab should be done with tabDist, randDist or rangeDist cuserrnd :: SigOrD a => a -> a -> Tab -> SE a -- | duserrnd — Discrete USER-defined-distribution RaNDom generator. -- -- Discrete USER-defined-distribution RaNDom generator. -- --
-- aout duserrnd ktableNum -- iout duserrnd itableNum -- kout duserrnd ktableNum ---- -- csound doc: http://www.csounds.com/manual/html/duserrnd.html -- -- the tab should be done with tabDist, randDist or rangeDist duserrnd :: SigOrD a => Tab -> SE a instance GHC.Classes.Eq Csound.Tab.PadsynthSpec instance GHC.Show.Show Csound.Tab.PadsynthSpec instance GHC.Enum.Enum Csound.Tab.PadsynthShape instance GHC.Classes.Ord Csound.Tab.PadsynthShape instance GHC.Classes.Eq Csound.Tab.PadsynthShape instance GHC.Show.Show Csound.Tab.PadsynthShape 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 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)] } -- scaleUI = (1, 1) --data Options :: * Options :: Flags -> Maybe Int -> Maybe Int -> Maybe Double -> Maybe TabFi -> Maybe (Double, Double) -> Maybe Jacko -> 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 -- | Scale factors for UI-window [csdScaleUI] :: Options -> Maybe (Double, Double) [csdJacko] :: Options -> Maybe Jacko -- | 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 setAlsa :: Options setCoreAudio :: Options setMme :: 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 setMessageLevel :: Int -> Options noTrace :: Options setCabbage :: 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 AlsaSeq :: 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 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 ()) -- | 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. It contains control signals (k-rate) and constants for -- numbers (i-rates). newCtrlRef :: Tuple a => a -> SE (Ref a) -- | Allocates a new global mutable value and initializes it with value. A -- reference can contain a tuple of variables. It contains control -- signals (k-rate) and constants for numbers (i-rates). newGlobalCtrlRef :: Tuple a => a -> SE (Ref a) -- | Allocates a new clearable global mutable value and initializes it with -- value. A reference can contain a tuple of variables. The variable is -- set to zero at the end of every iteration. It's useful for -- accumulation of audio values from several instruments. newClearableGlobalRef :: Tuple a => a -> SE (Ref a) -- | 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 :: Int -> SE Tab whileRef :: Tuple st => st -> (st -> SE BoolSig) -> (st -> SE st) -> SE () whileRef :: Tuple st => st -> (st -> SE BoolSig) -> (st -> SE st) -> SE () -- | 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 () whenElse :: BoolSig -> SE () -> SE () -> SE () -- | Invokes the given procedure if the boolean signal is true. whenD1 :: BoolD -> 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. whenDs :: [(BoolD, SE ())] -> SE () -> SE () whileDo :: BoolSig -> SE () -> SE () untilDo :: BoolSig -> SE () -> SE () whileDoD :: BoolD -> SE () -> SE () untilDoD :: BoolD -> SE () -> SE () whenElseD :: BoolD -> SE () -> SE () -> SE () -- | Performs tree search f the first argument lies within the interval it -- performs the corresponding procedure. compareWhenD :: D -> [(D, SE ())] -> SE () equalsTo :: EqB a => a -> a -> BooleanOf a infix 4 `equalsTo` notEqualsTo :: EqB a => a -> a -> BooleanOf a infix 4 `notEqualsTo` lessThan :: OrdB a => a -> a -> BooleanOf a infix 4 `lessThan` greaterThan :: OrdB a => a -> a -> BooleanOf a infix 4 `greaterThan` lessThanEquals :: OrdB a => a -> a -> BooleanOf a infix 4 `lessThanEquals` greaterThanEquals :: OrdB a => a -> a -> BooleanOf a infix 4 `greaterThanEquals` 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 -- | Input argument for monophonic synthesizer. It includes signals for -- amplitude, frequency (Cycles Per second), gate, trigger. The gate -- equals to 1 when any note is pressed or zero when nothing is pressed. -- The trigger equals to 1 at the moment when new note is pressed -- otherwise it's 0. data MonoArg :: * MonoArg :: Sig -> Sig -> Sig -> Sig -> MonoArg [monoAmp] :: MonoArg -> Sig [monoCps] :: MonoArg -> Sig [monoGate] :: MonoArg -> Sig [monoTrig] :: MonoArg -> Sig -- | ADSR that's used in monophonic instruments. type MonoAdsr = Sig -> Sig -> Sig -> Sig -> Sig -- | Turns the function that expects ADSR-function and amplitude and -- frequency to the function on monophonic argument. adsrMonoSynt :: (MonoAdsr -> (Sig, Sig) -> a) -> MonoArg -> a monoAdsr :: MonoArg -> MonoAdsr -- | The tuples of signals. class (Tuple a, Num a, Fractional a, SigSpace a, BindSig a) => Sigs a -- | Arrays. The array data type is parametrized with type of the index and -- the type of the value. Note that the data tpyes for indices and values -- can be tuples. data Arr ix a :: * -> * -> * -- | Creates an array that is local to the body of Csound instrument where -- it's defined. The array contains audio signals. -- --
-- newLocalArr sizes --newLocalArr :: (Tuple a, Tuple ix) => [D] -> SE (Arr ix a) -- | Creates a global array. The array contains audio signals. -- --
-- newGlobalArr sizes --newGlobalArr :: (Tuple a, Tuple ix) => [D] -> SE (Arr ix a) -- | Creates an array that is local to the body of Csound instrument where -- it's defined. The array contains control signals. -- --
-- newLocalCtrlArr sizes --newLocalCtrlArr :: (Tuple a, Tuple ix) => [D] -> SE (Arr ix a) -- | Creates a global array. The array contains control signals. -- --
-- newGlobalCtrlArr sizes --newGlobalCtrlArr :: (Tuple a, Tuple ix) => [D] -> SE (Arr ix a) -- | Writes data to the array. writeArr :: (Tuple ix, Tuple a) => Arr ix a -> ix -> a -> SE () -- | Reads data from the array. readArr :: (Tuple a, Tuple ix) => Arr ix a -> ix -> SE a -- | Updates the value of the array with pure function. modifyArr :: (Tuple a, Tuple ix) => Arr ix a -> ix -> (a -> a) -> SE () mixArr :: (Tuple ix, Tuple a, Num a) => Arr ix a -> ix -> a -> SE () -- | An array with single signal index. type Arr1 a = Arr Sig a -- | An array with single constant index. type DArr1 a = Arr D a -- | A matrix (2D array) with signal index. type Arr2 a = Arr (Sig, Sig) a -- | A matrix (2D array) with constant index. type DArr2 a = Arr (D, D) a -- | A 3D array with signal index. type Arr3 a = Arr (Sig, Sig, Sig) a -- | A 3D array with constant index. type DArr3 a = Arr (D, D, D) a -- | Function to help the type inference. arr1 :: SE (Arr Sig a) -> SE (Arr Sig a) -- | Function to help the type inference. darr1 :: SE (Arr D a) -> SE (Arr D a) -- | Function to help the type inference. arr2 :: SE (Arr (Sig, Sig) a) -> SE (Arr (Sig, Sig) a) -- | Function to help the type inference. darr2 :: SE (Arr (D, D) a) -> SE (Arr (D, D) a) -- | Function to help the type inference. arr3 :: SE (Arr (Sig, Sig, Sig) a) -> SE (Arr (Sig, Sig, Sig) a) -- | Function to help the type inference. darr3 :: SE (Arr (D, D, D) a) -> SE (Arr (D, D, D) a) -- | Traverses all elements of the array array and applies a procedure to -- each element. The procedure takes in a pair of index and the current -- value at the given index. foreachArr :: (Tuple ix, Tuple a) => Arr ix a -> ((ix, a) -> SE ()) -> SE () -- | Traverses all elements of the array at the **init rate** and applies a -- procedure to each element. The procedure takes in a pair of index and -- the current value at the given index. foreachArrD :: (Tuple ix, Tuple a) => Arr ix a -> ((ix, a) -> SE ()) -> SE () -- | Traverses all elements in the given row of 2D array at the signal rate -- and applies a procedure to all elements. forRowArr :: Tuple a => Sig -> Arr Sig2 a -> ((Sig, a) -> SE ()) -> SE () -- | Traverses all elements in the given column of 2D array at the signal -- rate and applies a procedure to all elements. forColumnArr :: Tuple a => Sig -> Arr Sig2 a -> ((Sig, a) -> SE ()) -> SE () -- | Traverses all elements in the given row of 2D array at the init rate -- and applies a procedure to all elements. forRowArrD :: Tuple a => D -> Arr D2 a -> ((D, a) -> SE ()) -> SE () -- | Traverses all elements in the given column of 2D array at the init -- rate and applies a procedure to all elements. forColumnArrD :: Tuple a => D -> Arr D2 a -> ((D, a) -> SE ()) -> SE () -- | Traverses an array and accumulates a value. We invoke the function -- with accumulator function, initial value and the array. foldArr :: (Tuple ix, Tuple a, Tuple b) => ((ix, a) -> b -> SE b) -> b -> Arr ix a -> SE b -- | Traverses a row in the array and accumulates a value. We invoke the -- function with accumulator function, initial value and the array with -- signal of the row number. -- --
-- foldRowArr accum initValue rowId array --foldRowArr :: (Tuple a, Tuple b) => ((Sig, a) -> b -> SE b) -> b -> Sig -> Arr Sig2 a -> SE b -- | Traverses a column in the array and accumulates a value. We invoke the -- function with accumulator function, initial value and the array with -- signal of the row number. -- --
-- foldColumnArr accum initValue columnId array --foldColumnArr :: (Tuple a, Tuple b) => ((Sig, a) -> b -> SE b) -> b -> Sig -> Arr Sig2 a -> SE b -- | Traverses a row at the **init rate** in the array and accumulates a -- value. We invoke the function with accumulator function, initial value -- and the array with signal of the row number. -- --
-- foldRowArr accum initValue rowId array --foldRowsArrD :: (Tuple a, Tuple b) => ((D, a) -> b -> SE b) -> b -> D -> Arr D2 a -> SE b -- | Traverses a column at the **init rate** in the array and accumulates a -- value. We invoke the function with accumulator function, initial value -- and the array with signal of the row number. -- --
-- foldColumnArr accum initValue columnId array --foldColumnsArrD :: (Tuple a, Tuple b) => ((D, a) -> b -> SE b) -> b -> D -> Arr D2 a -> SE b -- | Creates an array that is local to the body of Csound instrument where -- it's defined. The array contains audio signals. It fills the array -- from the list of values (the last argument). -- --
-- fillLocalArr sizes initValues = ... --fillLocalArr :: (Tuple a, Tuple ix) => [Int] -> [a] -> SE (Arr ix a) -- | Creates a global array. The array contains audio signals. It fills the -- array from the list of values (the last argument). -- --
-- fillGlobalArr sizes initValues = ... --fillGlobalArr :: (Tuple a, Tuple ix) => [Int] -> [a] -> SE (Arr ix a) -- | Creates an array that is local to the body of Csound instrument where -- it's defined. The array contains control signals. It fills the array -- from the list of values (the last argument). -- --
-- fillLocalCtrlArr sizes initValues = ... --fillLocalCtrlArr :: (Tuple a, Tuple ix) => [Int] -> [a] -> SE (Arr ix a) -- | Creates a global array. The array contains control signals. It fills -- the array from the list of values (the last argument). -- --
-- fillGlobalCtrlArr sizes initValues = ... --fillGlobalCtrlArr :: (Tuple a, Tuple ix) => [Int] -> [a] -> SE (Arr ix a) -- | Mapps all values in the array with the function. -- -- Csound docs: http://csound.github.io/docs/manual/maparray.html maparrayNew :: Arr a b -> Str -> SE (Arr a b) lenarray :: SigOrD c => Arr a b -> c -- | Copies table to array. copyf2array :: Arr Sig Sig -> Tab -> SE () -- | Copies array to table. copya2ftab :: Arr Sig Sig -> Tab -> SE () -- | Finds a minimum value of the array. minarray :: (Tuple b, Num b) => Arr a b -> SE b -- | Finds a maximum value of the array. maxarray :: (Tuple b, Num b) => Arr a b -> SE b -- | Summs all elements in the array. sumarray :: (Tuple b, Num b) => Arr a b -> SE b -- | Scales all elements in the array. scalearray :: (Tuple b, Num b) => Arr a b -> (b, b) -> SE () -- | Creates a copy of some part of the given array slicearrayNew :: Arr D a -> (D, D) -> SE (Arr D a) -- | Transforms the dta of the array and copies it to the second array. maparrayCopy :: Arr a b -> Str -> Arr a b -> SE () -- | Copies a part of array to another array. slicearrayCopy :: Arr D a -> (D, D) -> Arr D a -> SE () -- | Spectral array. type SpecArr = Arr Sig Sig -- | Complex-to-complex Fast Fourier Transform. -- -- csound docs: http://csound.github.io/docs/manual/fft.html fftNew :: SpecArr -> SE SpecArr -- | Complex-to-complex Inverse Fast Fourier Transform. -- -- csound docs: http://csound.github.io/docs/manual/fftinv.html fftinvNew :: SpecArr -> SE SpecArr -- | Fast Fourier Transform of a real-value array. -- -- csound docs: http://csound.github.io/docs/manual/rfft.html rfftNew :: SpecArr -> SE SpecArr -- | Complex-to-real Inverse Fast Fourier Transform. -- -- csound docs: http://csound.github.io/docs/manual/rifft.html rifftNew :: SpecArr -> SE SpecArr -- | Copies spectral data to k-rate arrays (or t-variables). Also known as -- pvs2array. -- -- csound docs: http://csound.github.io/docs/manual/pvs2tab.html pvs2tab :: SpecArr -> Spec -> SE Sig -- | Copies spectral data from k-rate arrays (or t-variables.). Also known -- as pvsfromarray. -- -- csound docs: http://csound.github.io/docs/manual/tab2pvs.html tab2pvs :: SpecArr -> SE Spec -- | Complex product of two arrays. -- --
-- kout[] cmplxprod kin1[], kin2[] ---- -- csound docs: http://csound.github.io/docs/manual/cmplxprod.html cmplxprodNew :: SpecArr -> SpecArr -> SE SpecArr -- | Rectangular to polar format conversion. -- --
-- kout[] rect2pol kin[] ---- -- csound docs: http://csound.github.io/docs/manual/rect2pol.html rect2polNew :: SpecArr -> SE SpecArr -- | Polar to rectangular format conversion. -- --
-- kout[] pol2rect kin[] ---- -- csound docs: http://csound.github.io/docs/manual/pol2rect.html pol2rectNew :: SpecArr -> SE SpecArr -- | Polar to rectangular format conversion. -- --
-- kout[] pol2rect kmags[], kphs[] ---- -- csound docs: http://csound.github.io/docs/manual/pol2rect.html pol2rect2New :: SpecArr -> SpecArr -> SE SpecArr -- | Applies a window to an array. -- --
-- kout[] window kin[][, koff, itype] ---- -- csound docs: http://csound.github.io/docs/manual/window.html windowArrayNew :: SpecArr -> SE SpecArr -- | Real to complex format conversion. -- --
-- kout[] r2c kin[] ---- -- csound docs: http://csound.github.io/docs/manual/r2c.html r2cNew :: SpecArr -> SE SpecArr -- | Complex to real format conversion. -- --
-- kout[] c2r kin[] ---- -- csound docs: http://csound.github.io/docs/manual/c2r.html c2rNew :: SpecArr -> SE SpecArr -- | Obtains the magnitudes of a complex-number array -- --
-- kout[] mags kin[] ---- -- csound docs: http://csound.github.io/docs/manual/mags.html magsArrayNew :: SpecArr -> SE SpecArr -- | Obtains the phases of a complex-number array -- -- kout[] phs kin[] -- --
-- csound docs: <http://csound.github.io/docs/manual/phs.html> --phsArrayNew :: SpecArr -> SE SpecArr -- | Complex-to-complex Fast Fourier Transform. -- -- csound docs: http://csound.github.io/docs/manual/fft.html fftCopy :: SpecArr -> SpecArr -> SE () -- | Complex-to-complex Inverse Fast Fourier Transform. -- -- csound docs: http://csound.github.io/docs/manual/fftinv.html fftinvCopy :: SpecArr -> SpecArr -> SE () -- | Fast Fourier Transform of a real-value array. -- -- csound docs: http://csound.github.io/docs/manual/rfft.html rfftCopy :: SpecArr -> SpecArr -> SE () -- | Complex-to-real Inverse Fast Fourier Transform. -- -- csound docs: http://csound.github.io/docs/manual/rifft.html rifftCopy :: SpecArr -> SpecArr -> SE () -- | Complex product of two arrays. -- --
-- kout[] cmplxprod kin1[], kin2[] ---- -- csound docs: http://csound.github.io/docs/manual/cmplxprod.html cmplxprodCopy :: SpecArr -> SpecArr -> SpecArr -> SE () -- | Rectangular to polar format conversion. -- --
-- kout[] rect2pol kin[] ---- -- csound docs: http://csound.github.io/docs/manual/rect2pol.html rect2polCopy :: SpecArr -> SpecArr -> SE () -- | Polar to rectangular format conversion. -- --
-- kout[] pol2rect kin[] ---- -- csound docs: http://csound.github.io/docs/manual/pol2rect.html pol2rectCopy :: SpecArr -> SpecArr -> SE () -- | Polar to rectangular format conversion. -- --
-- kout[] pol2rect kmags[], kphs[] ---- -- csound docs: http://csound.github.io/docs/manual/pol2rect.html pol2rect2Copy :: SpecArr -> SpecArr -> SpecArr -> SE () -- | Applies a window to an array. -- --
-- kout[] window kin[][, koff, itype] ---- -- csound docs: http://csound.github.io/docs/manual/window.html windowArrayCopy :: SpecArr -> SpecArr -> SE () -- | Real to complex format conversion. -- --
-- kout[] r2c kin[] ---- -- csound docs: http://csound.github.io/docs/manual/r2c.html r2cCopy :: SpecArr -> SpecArr -> SE () -- | Complex to real format conversion. -- --
-- kout[] c2r kin[] ---- -- csound docs: http://csound.github.io/docs/manual/c2r.html c2rCopy :: SpecArr -> SpecArr -> SE () -- | Obtains the magnitudes of a complex-number array -- --
-- kout[] mags kin[] ---- -- csound docs: http://csound.github.io/docs/manual/mags.html magsArrayCopy :: SpecArr -> SpecArr -> SE () -- | Obtains the phases of a complex-number array -- -- kout[] phs kin[] -- --
-- csound docs: <http://csound.github.io/docs/manual/phs.html> --phsArrayCopy :: SpecArr -> SpecArr -> SE () 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 -- | Scaling the sound with effectful signal. mul' :: BindSig a => SE Sig -> a -> SE 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 AtOut 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. class (SigSpace b, At a b c) => MixAt a b c mixAt :: MixAt a b c => Sig -> (a -> b) -> c -> AtOut a b 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 -- | It applies an effect and balances the processed signal by original -- one. Also it applies an effect and mixes the processed balanced signal -- with original one. bmixAt :: MixAt Sig a b => Sig -> (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 -- | A class for easy way to process the outputs of the instruments. class SigSpace2 a mapSig2 :: SigSpace2 a => (Sig2 -> Sig2) -> a -> a -- | A class for easy way to process the outputs of the instruments. class SigSpace2 a => BindSig2 a bindSig2 :: BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a -- | Scaling the sound with a pair. mul2 :: SigSpace2 a => Sig2 -> a -> a -- | Scaling the sound with effectful pair of signals. mul2' :: BindSig2 a => SE Sig2 -> a -> SE a module Csound.Tuning -- | Data structure for musical temperament. The value can be created with -- constructors genTemp and genTempCent. It can be -- passed as an argument to the instrument (it can be a part of the -- note). newtype Temp Temp :: Tab -> Temp [unTemp] :: Temp -> Tab -- | Creates a temperament. Arguments are -- --
-- genTemp interval baseHz baseMidiPitch cents ---- -- For example: -- --
-- genTemp 2 261.63 60 [0, 100, 200 .. more cents .. , 1200] ---- -- Cent list should include the first note from the next octave(interval -- of temperament repetition). genTemp :: Double -> Double -> Double -> [Double] -> Temp -- | Creates a temperament. Arguments are -- --
-- genTempCent interval baseHz baseMidiPitch ratios ---- -- For example: -- --
-- genTempRatio 2 261.63 60 [1, .. more ratios .. , 2] ---- -- Cent list should include the first note from the next octave(interval -- of temperament repetition). genTempRatio :: Double -> Double -> Double -> [Double] -> Temp -- | Temperament with base note at note C (261.63 Hz) and an octave as -- interval (2). The argument is the list of cents. tempC :: [Double] -> Temp -- | Temperament with base note at note C (261.63 Hz) and an octave as -- interval (2). The argument is the list of ratios. tempRatioC :: [Double] -> Temp -- | Temperament with 9th note tuned to 440 Hz (Concert A). The argument is -- the list of cents. stdTemp :: [Double] -> Temp -- | Temperament with 9th note tuned to 440 Hz (Concert A). The argument is -- the list of ratios. stdTempRatio :: [Double] -> Temp -- | Baroque Temperament with 9th note tuned to 415 Hz (Concert A). The -- argument is the list of cents. barTemp :: [Double] -> Temp -- | Baroque Temperament with 9th note tuned to 415 Hz (Concert A). The -- argument is the list of ratios. barTempRatio :: [Double] -> Temp -- | Temperament with 9th note tuned to 440 Hz (Concert A). The argument is -- the list of cents. concertA :: Double -> [Double] -> Temp -- | Temperament with 9th note tuned to 440 Hz (Concert A). The argument is -- the list of ratios. ratioConcertA :: Double -> [Double] -> Temp -- | Equal temperament equal1 :: Temp -- | Just intonation just1 :: Temp -- | Meantone temperament meantone :: Temp -- | Pythagorean tuning pythagor :: Temp -- | Werckmeister III temperament. Probably it was temperament of the Bach -- musical era. werckmeister :: Temp -- | Tomas Young temperament young1 :: Temp -- | Tomas Young temperament 1 (aligned with ET by C and A) young2 :: Temp -- | Tomas Young temperament 2 (aligned with ET by C and A) young3 :: Temp equalCents1 :: [Double] justCents1 :: [Double] meantoneCents :: [Double] pythagorCents :: [Double] werckmeisterCents :: [Double] youngCents1 :: [Double] youngCents2 :: [Double] youngCents3 :: [Double] -- | List of temperaments (or more precisely f-table of temperaments). It -- can be passed as an argument to the instrument (it can be a part of -- the note). newtype TempList TempList :: TabList -> TempList [unTempList] :: TempList -> TabList -- | Creates a list of temperaments. tempList :: [Temp] -> TempList -- | Selects one of the temperaments by index. fromTempList :: TempList -> Sig -> Temp -- | Selects one of the temperaments by index. Works at the time of -- instrument initialization (remains constant). fromTempListD :: TempList -> D -> Temp -- | Converts cents to ratios. cent2ratio :: Floating a => a -> a -- | Converts ratios to cents. ratio2cent :: Floating a => a -> a instance Data.Default.Class.Default Csound.Tuning.Temp instance Csound.Typed.Types.Tuple.Tuple Csound.Tuning.Temp instance Csound.Typed.Types.Tuple.Arg Csound.Tuning.Temp instance Csound.Typed.Types.Tuple.Tuple Csound.Tuning.TempList instance Csound.Typed.Types.Tuple.Arg Csound.Tuning.TempList -- | Open Sound Control. module Csound.Control.Osc -- | The hostname of the computer. An empty string is for local machine. type OscHost = String -- | Port to listen OSC-messages. type OscPort = Int -- | Path-like string ("foobar/baz") type OscAddress = String -- | The string 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. type OscType = String -- | Initializes host client. The process starts to run in the background. initOsc :: OscPort -> OscRef -- | Listens for the OSC-messages. The first argument is OSC-reference. We -- can create it with the function initOsc. 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 type ListenOsc a = OscAddress -> a -> SE a class Tuple a => OscVal a -- | Listens for tuples of continuous signals read from OSC-channel. -- --
-- listenOscVal ref address initValue --listenOscVal :: (Tuple a, OscVal a) => OscRef -> String -> a -> SE a -- | Listens for continuous signal from OSC-channel -- --
-- listenOscSig host address initValue --listenOscSig :: OscRef -> OscAddress -> Sig -> SE Sig -- | Listens for pair of continuous signals from OSC-channel -- --
-- listenOscSig2 host address initValue --listenOscSig2 :: OscRef -> OscAddress -> Sig2 -> SE Sig2 -- | 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 () -- | Properties that specify the appearance of the GUI elements. The -- specification is inspired by CSS. All properties are set in the -- cascade manner. For example, if you want to change the font type for -- all elements you should set this property only for the top-most GUI -- element. If the property is set on the lower level it wins versus -- property that is set on the higher level. module Csound.Control.Gui.Props -- | Sets the properties for a GUI element. props :: [Prop] -> Gui -> Gui -- | Sets the properties for a GUI element on all levels. forceProps :: [Prop] -> Gui -> Gui -- | Properties of the widgets. data Prop :: * SetLabel :: String -> Prop SetMaterial :: Material -> Prop SetBoxType :: BoxType -> Prop SetColor1 :: Color -> Prop SetColor2 :: Color -> Prop SetTextColor :: Color -> Prop SetFontSize :: Int -> Prop SetFontType :: FontType -> Prop SetEmphasis :: Emphasis -> Prop SetSliderType :: SliderType -> Prop SetTextType :: TextType -> Prop SetButtonType :: ButtonType -> Prop SetOrient :: Orient -> Prop SetKnobType :: KnobType -> Prop SetLabelType :: LabelType -> Prop data BorderType :: * NoBorder :: BorderType DownBoxBorder :: BorderType UpBoxBorder :: BorderType EngravedBorder :: BorderType EmbossedBorder :: BorderType BlackLine :: BorderType ThinDown :: BorderType ThinUp :: BorderType -- | The Csound colours. type Color = Colour Double -- | A rectangle. data Rect :: * Rect :: Int -> Int -> Int -> Int -> Rect [px] :: Rect -> Int [py] :: Rect -> Int [width] :: Rect -> Int [height] :: Rect -> Int data FontType :: * Helvetica :: FontType Courier :: FontType Times :: FontType Symbol :: FontType Screen :: FontType Dingbats :: FontType data Emphasis :: * NoEmphasis :: Emphasis Italic :: Emphasis Bold :: Emphasis BoldItalic :: Emphasis -- | The type of the material of the element. It affects sliders and -- buttons. data Material :: * NoPlastic :: Material Plastic :: Material -- | The orientation of the widget (slider, roller). This property is never -- needs to be set in practice. If this property is not set then default -- orientation is calculated from the bounding box of the widget. If the -- width is greater than the height then we need to use a horizontal -- widget otherwise it should be a vertical one. data Orient :: * Hor :: Orient Ver :: Orient setBorder :: BorderType -> Gui -> Gui setLabel :: String -> Gui -> Gui setMaterial :: Material -> Gui -> Gui setColor1 :: Color -> Gui -> Gui setColor2 :: Color -> Gui -> Gui setColors :: Color -> Color -> Gui -> Gui setTextColor :: Color -> Gui -> Gui setFontSize :: Int -> Gui -> Gui setFontType :: FontType -> Gui -> Gui setEmphasis :: Emphasis -> Gui -> Gui setOrient :: Orient -> Gui -> Gui -- | The functions from this module specify the geometry of the -- GUI-elements. They tell where to render the elements. -- -- Every element is rectangular. To know where to place the element is to -- know the parameters of the bounding rectangle. All rectangles are -- relative and automatically aligned. -- -- We have two functions for grouping. They construct horizontal and -- vertical groups of the elements. Within the group we can change the -- relative size of the rectangles (by scaling one side of the -- rectangle). In place of rectangle we can put an empty space. module Csound.Control.Gui.Layout -- | Horizontal groupping of the elements. All elements are placed in the -- stright horizontal line and aligned by Y-coordinate and height. hor :: [Gui] -> Gui -- | Vertical groupping of the elements. All elements are placed in the -- stright vertical line and aligned by X-coordinate and width. ver :: [Gui] -> Gui -- | An empty space. space :: Gui -- | Scales an element within the group. It depends on the type of the -- alignment (horizontal or vertical) which side of the bounding box is -- scaled. If it's a horizontal group then the width is scaled and height -- is scaled otherwise. -- -- Every element in the group has a scaling factor. By default it equals -- to one. During rendering all scaling factors are summed and divided on -- the sum of all factors. So that factors become weights or proportions. -- This process is called normalization. Scaling one element affects not -- only this element but all other elements in the group! -- -- An example: -- -- One element is twice as large as the other two: -- --
-- hor [a, b, sca 2 c] ---- -- Why is it so? Let's look at the hidden scaling factors: -- --
-- hor [sca 1 a, sca 1 b, sca 2 c] ---- -- During rendering we scale all the scaling fators so that total sum -- equals to one: -- --
-- hor [sca 0.25 a, sca 0.25 b, sca 0.5 c] --sca :: Double -> Gui -> Gui -- | Weighted horizontal grouping. It takes a list of scaling factors and -- elements. horSca :: [(Double, Gui)] -> Gui -- | Weighted vertical grouping. It takes a list of scaling factors and -- elements. verSca :: [(Double, Gui)] -> Gui -- | Layouts the widgets in grid. The first argument is the number of -- widgets in the row. -- --
-- grid rowLength widgets --grid :: Int -> [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 type ScaleFactor = (Double, Double) -- | Rescales the default sizes for the UI elements. resizeGui :: ScaleFactor -> Gui -> Gui 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 -- | Converts an event stream to boolean signal. It's True when something -- happens and False otherwise. evtToBool :: Evt a -> BoolSig -- | Creates a trigger signal out of event stream. It equals to 1 when -- something happens and 0 otherwise. evtToTrig :: Evt a -> Sig -- | Triggers an event when signal equals to 1. sigToEvt :: Sig -> Evt Unit -- | Converts event stream to signal. The first argument is initial value. -- It holds the value while nothing happens. If the event happens it -- overwrites the current value of the output signal. 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 readSnap :: (Tuple (Snap a), Tuple a) => a -> Snap a -- | 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 = [(Sig, 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 :: Sig -> Evt a -> Evt a -- | Skips elements at random. -- --
-- randSkip probFun ---- -- It behaves just like randSkip, but probability depends on the -- value. randSkipBy :: (a -> Sig) -> 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 -- | 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: -- --
-- resizeSource (0.75, 0.5) uiSource --resizeSource :: (Double, Double) -> Source a -> Source a -- | Renders the GUI elements on the window. Rectangle is calculated -- automatically (window doesn't listens for keyboard events). panel :: Gui -> SE () -- | Creates a window with the given name, size and content -- --
-- 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 -- | Groups a list of Source-widgets. The visuals are put on the grid. The -- first argument is numer of elements i each row. gridLifts :: Int -> ([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 -- | Creates a list of sources with mapping a function and stacks them -- horizontally. hmapM :: (a -> Source b) -> [a] -> Source [b] -- | Creates a list of sources with mapping a function and stacks them -- vertically. 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 -- | It's like hmapM but we can supply the list of relative sizes. hmapM' :: [Double] -> (a -> Source b) -> [a] -> Source [b] -- | It's like hvapM but we can supply the list of relative sizes. vmapM' :: [Double] -> (a -> Source b) -> [a] -> Source [b] -- | Creates a list of sources with mapping a function and puts them on the -- grid. The first argument is the number of items in the row. gridMapM :: Int -> (a -> Source b) -> [a] -> Source [b] instance Csound.Typed.Types.SigSpace.SigSpace a => Csound.Typed.Types.SigSpace.SigSpace (Csound.Typed.Gui.Widget.Source a) instance Csound.Typed.Types.SigSpace.At Csound.Typed.Types.Prim.Sig (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig) a => Csound.Typed.Types.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.Typed.Types.SigSpace.At Csound.Typed.Types.Prim.Sig2 Csound.Typed.Types.Prim.Sig2 a => Csound.Typed.Types.SigSpace.At Csound.Typed.Types.Prim.Sig2 Csound.Typed.Types.Prim.Sig2 (Csound.Typed.Gui.Widget.Source a) instance Csound.Typed.Types.SigSpace.At Csound.Typed.Types.Prim.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig2) a => Csound.Typed.Types.SigSpace.At Csound.Typed.Types.Prim.Sig2 (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig2) (Csound.Typed.Gui.Widget.Source a) -- | 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 () -- | Saves the user options in the current directory. -- -- If it's saved in the User's home directory it becomes global options. saveUserOptions :: Options -> IO () -- | Runs the csound files with cabbage engine. It invokes the Cabbage -- command line utility and setts all default cabbage flags. runCabbage :: (RenderCsd a) => a -> IO () -- | Runs the csound files with cabbage engine with user defined options. -- It invokes the Cabbage command line utility and setts all default -- cabbage flags. runCabbageBy :: (RenderCsd a) => Options -> a -> IO () -- | Alias to process inputs of single input audio-card. onCard1 :: (Sig -> a) -> (Sig -> a) -- | Alias to process inputs of stereo input audio-card. onCard2 :: (Sig2 -> a) -> (Sig2 -> a) -- | Alias to process inputs of audio-card with 4 inputs. onCard4 :: (Sig4 -> a) -> (Sig4 -> a) -- | Alias to process inputs of audio-card with 6 inputs. onCard6 :: (Sig6 -> a) -> (Sig6 -> a) -- | Alias to process inputs of audio-card with 8 inputs. onCard8 :: (Sig8 -> a) -> (Sig8 -> a) readMacrosString :: String -> String -> Str readMacrosDouble :: String -> Double -> D readMacrosInt :: String -> Int -> D instance Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE ()) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd a instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (Csound.Typed.GlobalState.SE.SE a) instance (Csound.Typed.Types.Tuple.Sigs a, Csound.Typed.Types.Tuple.Sigs b) => Csound.IO.RenderCsd (a -> b) 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.Typed.Types.Tuple.Sigs a, Csound.Typed.Types.Tuple.Sigs b) => Csound.IO.RenderCsd (a -> Csound.Typed.Gui.Widget.Source b) instance (Csound.Typed.Types.Tuple.Sigs a, Csound.Typed.Types.Tuple.Sigs b) => Csound.IO.RenderCsd (a -> Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE b)) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (a -> Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE Csound.Typed.Types.Prim.Sig2)) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source a) instance Csound.Typed.Types.Tuple.Sigs a => Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE a)) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source ()) instance Csound.IO.RenderCsd (Csound.Typed.Gui.Widget.Source (Csound.Typed.GlobalState.SE.SE ())) -- | 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 ---- --
-- res = monoSco instrument scores --monoSco :: Sigs a => (MonoArg -> SE a) -> Sco (D, D) -> Sco (Mix a) -- | Mixes the scores and plays them in the loop. mixLoop :: (Sigs a) => Sco (Mix a) -> a -- | Invokes a procedure for the given bunch of events. sco_ :: Arg a => (a -> SE ()) -> Sco a -> Sco (Mix Unit) -- | Converts a bunch of procedures scheduled with scores to a single -- procedure. mix_ :: Sco (Mix Unit) -> SE () -- | Mixes the procedures and plays them in the loop. mixLoop_ :: Sco (Mix Unit) -> SE () -- | Imitates a closure for a bunch of notes to be played within another -- instrument. mixBy :: (Arg a, Sigs b) => (a -> Sco (Mix b)) -> a -> b infiniteDur :: Num a => a sched :: (Arg a, Sigs b) => (a -> SE b) -> Evt (Sco a) -> b retrig :: (Arg a, Sigs b) => (a -> SE b) -> Evt a -> b -- | An instrument is triggered with event stream and delay time is set to -- zero (event fires immediately) and duration is set to inifinite time. -- The note is held while the instrument is producing something. If the -- instrument is silent for some seconds (specified in the first -- argument) then it's turned off. schedHarp :: (Arg a, Sigs b) => D -> (a -> SE b) -> Evt [a] -> b -- | Invokes an instrument with first event stream and holds the note until -- the second event stream is active. schedUntil :: (Arg a, Sigs b) => (a -> SE b) -> Evt a -> Evt c -> b -- | Invokes an instrument with toggle event stream (1 stands for on and 0 -- stands for off). schedToggle :: (Sigs b) => SE b -> Evt D -> b -- | Triggers a procedure on the event stream. sched_ :: Arg a => (a -> SE ()) -> Evt (Sco a) -> SE () -- | Invokes an instrument with first event stream and holds the note until -- the second event stream is active. schedUntil_ :: (Arg a) => (a -> SE ()) -> Evt a -> Evt c -> SE () -- | A closure to trigger an instrument inside the body of another -- instrument. schedBy :: (Arg a, Sigs b, Arg c) => (a -> SE b) -> (c -> Evt (Sco a)) -> c -> b -- | A closure to trigger an instrument inside the body of another -- instrument. schedHarpBy :: (Arg a, Sigs b, Arg c) => D -> (a -> SE b) -> (c -> Evt [a]) -> c -> b -- | Sets the same duration for all events. It's useful with the functions -- sched, schedBy, sched_. withDur :: D -> Evt a -> Evt (Sco a) -- | Turns monoSched :: Evt (Sco (D, D)) -> SE MonoArg -- | Creates an instrument that can be triggered by name with Csound API. -- The arguments are determined from the structure of the input for the -- instrument. If we have a tuple of arguments: (D, D, Tab) The -- would be rendered to instrument arguments that strts from p4. -- p1 is the name of teh instrument, p2 is the start -- time of the note, p3 is the duration of the note. Then -- p4 and p5 are going to be doubles and p6 is -- an integer that denotes a functional table. trigByName :: (Arg a, Sigs b) => String -> (a -> SE b) -> SE b -- | Creates an instrument that can be triggered by name with Csound API. -- The arguments are determined from the structure of the input for the -- instrument. -- -- With Csound API we can send messages -- --
-- i "name" time duration arg1 arg2 arg3 --trigByName_ :: Arg a => String -> (a -> SE ()) -> SE () -- | Creates an instrument that can be triggered by name with Csound API. -- -- It's intended to be used like a midi instrument. It simulates a -- simplified midi protocol. We can trigger notes: -- --
-- i "givenName" delay duration 1 pitchKey volumeKey auxParams -- note on -- i "givenName" delay duration 0 pitchKey volumeKey auxParams -- note off ---- -- The arguments are -- --
-- trigByNameMidi name instrument ---- -- The instrument takes a triplet of (pitchKey, volumeKey, -- auxilliaryTuple). The order does matter. Please don't pass the -- volumeKey as the first argument. The instrument expects the -- pitch key to be a first argument. trigByNameMidi :: (Arg a, Sigs b) => String -> ((D, D, a) -> SE b) -> SE b -- | It behaves just like the function trigByNameMidi. Only it -- doesn't produce an audio signal. It performs some procedure on note on -- and stops doing the precedure on note off. trigByNameMidi_ :: Arg a => String -> ((D, D, a) -> SE ()) -> SE () -- | Turns off named instruments. -- --
-- turnoffNamedInstr name kmode krelease ---- -- name of the instrument (should be defined with trigByName or -- smth like that). -- -- kmode -- sum of the following values: -- -- 0, 1, or 2: turn off all instances (0), oldest only (1), or newest -- only (2) -- -- 4: only turn off notes with exactly matching (fractional) instrument -- number, rather than ignoring fractional part -- -- 8: only turn off notes with indefinite duration (p3 < 0 or MIDI) -- -- krelease -- if non-zero, the turned off instances are allowed to -- release, otherwise are deactivated immediately (possibly resulting in -- clicks) turnoffByName :: String -> Sig -> Sig -> SE () -- | Executes some procedure for the whole lifespan of the program, alwaysOn :: SE () -> SE () -- | Transforms an instrument from always on to conditional one. The -- routput instrument plays only when condition is true otherwise it -- produces silence. playWhen :: forall a b. Sigs a => BoolSig -> (b -> SE a) -> (b -> SE a) class Sigs (SigOuts a) => Outs a where type SigOuts a :: * where { type family SigOuts a :: *; } toOuts :: Outs a => a -> SE (SigOuts a) onArg :: Outs b => (a -> b) -> (a -> SE (SigOuts b)) -- | Constructs a drum-like instrument. Drum like instrument has a single -- argument that signifies an amplitude. class AmpInstr a where type AmpInstrOut a :: * where { type family AmpInstrOut a :: *; } onAmp :: AmpInstr a => a -> D -> SE (AmpInstrOut a) -- | Constructs a simple instrument that takes in a tuple of two arguments. -- They are amplitude and the frequency (in Hz or cycles per second). class CpsInstr a where type CpsInstrOut a :: * where { type family CpsInstrOut a :: *; } onCps :: CpsInstr a => a -> (D, D) -> SE (CpsInstrOut a) -- | Instrument reference. we can invoke or stop the instrument by the -- identifier. data InstrRef a :: * -> * -- | Creates a new instrument and generates a unique identifier. newInstr :: Arg a => (a -> SE ()) -> SE (InstrRef a) -- | Schedules an event for the instrument. -- --
-- scheduleEvent instrRef delay duration args ---- -- The arguments for time values are set in seconds. scheduleEvent :: Arg a => InstrRef a -> D -> D -> a -> SE () -- | Turns off the note played on the given instrument. Use fractional -- instrument reference to turn off specific instance. -- --
-- turnoff2 instrRef mode releaseTime ---- -- The mode is sum of the following values: -- --
-- 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) -- | Creates a named instrument that can be triggered with Csound API. This -- way we can create a csd file that can be used inside another -- program/language. -- -- It simulates the input for monophonic midi-like instrument. Notes are -- encoded with messages: -- --
-- i "givenName" 1 pitchKey volumeKey -- note on -- i "givenName" 0 pitchKey volumeKey -- note off ---- -- The output is a pair of signals (midiVolume, midiPitch). trigNamedMono :: String -> SE MonoArg -- | Produces an argument for monophonic midi-synth. The signal fades out -- when nothing is pressed. It can be used in mono-synths. -- --
-- genMonoMsg channel --genMonoMsg :: MidiChn -> SE MonoArg smoothMonoArg :: D -> MonoArg -> MonoArg genFilteredMonoMsg :: MidiChn -> (D -> BoolD) -> SE MonoArg -- | Just like mono genMonoMsg but also we can alter the -- temperament. The temperament spec goes first. -- --
-- genMonoMsgTemp temperament channel --genFilteredMonoMsgTemp :: Temp -> MidiChn -> (D -> BoolD) -> SE MonoArg -- | Produces midi amplitude and frequency as a signal. The signal fades -- out when nothing is pressed. It can be used in mono-synths. Arguments -- are custom temperament, midi channel, portamento time and release -- time. A portamento time is time it takes for transition from one note -- to another. -- --
-- monoMsgTemp temperament channel portamentoTime releaseTime --monoMsgTemp :: Temp -> 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 --holdMsgTemp :: Temp -> MidiChn -> D -> SE (Sig, Sig) -- | Just like mono genMonoMsg but also we can alter the -- temperament. The temperament spec goes first. -- --
-- genMonoMsgTemp temperament channel --genMonoMsgTemp :: Temp -> MidiChn -> SE MonoArg -- | 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 -- | Converts midi velocity number to amplitude. The first argument is -- dynamic range in decibels. -- --
-- ampmidinn (volMinDb, volMaxDb) volumeKey = amplitude --ampmidinn :: (D, D) -> D -> D -- | Midi message convertion with custom temperament. ampCps' :: Temp -> Msg -> (D, D) -- | Midi message convertion to Hz with custom temperament. cpsmidi' :: Temp -> Msg -> D -- | Midi pitch key convertion to Hz with custom temperament. It works on -- constants. cpsmidi'D :: Temp -> D -> D -- | Midi pitch key convertion to Hz with custom temperament. It works on -- signals. cpsmidi'Sig :: Temp -> Sig -> 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) -- | Invokes ooverloaded instruments with midi and custom temperament. -- Example: -- --
-- dac $ tryMidi' youngTemp2 (mul (fades 0.01 0.1) . tri) --tryMidi' :: (MidiInstrTemp a, Sigs (MidiInstrOut a)) => Temp -> a -> SE (MidiInstrOut a) -- | Converts a value to the midi-instrument. It's used with the functions -- midi, midin. class MidiInstr a where type MidiInstrOut a :: * where { type family MidiInstrOut a :: *; } onMsg :: MidiInstr a => a -> Msg -> SE (MidiInstrOut a) -- | Converts a value to the midi-instrument with custom temperament. It's -- used with the functions midi, midin. class MidiInstr a => MidiInstrTemp a onMsg' :: MidiInstrTemp a => Temp -> a -> Msg -> SE (MidiInstrOut a) instance GHC.Classes.Eq Csound.Control.Midi.MidiChn instance GHC.Show.Show Csound.Control.Midi.MidiChn -- | 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. 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. sfTemp :: Temp -> 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) -- | Creates a midi instrument from sf2 sound font file. The second -- argument is sustain in seconds. Reads samples with linear -- interpolation. sfMsgTemp :: Temp -> 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. sfMsgTemp3 :: Temp -> 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. sfMsgTempm :: Temp -> 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. sfMsgTemp3m :: Temp -> Sf -> D -> Msg -> SE Sig -- | Midi looper of the sf2 samples. The first arguments are: start, end, -- crossfade of the loop. sfMsgLooperTemp :: Sig -> Sig -> Sig -> Temp -> 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) -- | 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 () -- | The module contains the modules that are responsible for converting -- events to signals module Csound.Control -- | The Cab is a monad for Cabbage markup language. The markup description -- can be constructed in the same way as blaze-html markup. -- -- We use monadic sequencing for sequencing of markup elements. -- -- An example: -- --
-- import Csound.Base -- import qualified Csound.Cabbage as C -- -- ui = do -- C.cabbage $ do -- C.form $ do -- C.size 100 100 -- C.pluginid "plugin" -- C.button $ do -- C.bounds 10 10 80 80 -- C.channel "button" -- C.text1 "Click me" -- C.colour0 (C.Rgb 150 30 0) -- C.colour1 (C.Rgb 30 150 12) -- res <- chnCtrlGet "button" -- return res -- -- main = dac $ do -- btn <- ui -- return $ btn * osc 220 ---- -- We can read a complete tutorial on how to create Cabbage plugins at -- the guide: -- https://github.com/spell-music/csound-expression/blob/master/tutorial/chapters/CabbageTutorial.md module Csound.Cabbage type Cab = Cab' () type CabProp = CabProp' () data Col :: * Hash :: String -> Col Rgb :: Int -> Int -> Int -> Col cabbage :: Cab -> SE () button :: CabProp -> Cab filebutton :: CabProp -> Cab infobutton :: CabProp -> Cab checkbox :: CabProp -> Cab combobox :: CabProp -> Cab csoundoutput :: CabProp -> Cab encoder :: CabProp -> Cab gentable :: CabProp -> Cab hrange :: CabProp -> Cab vrange :: CabProp -> Cab form :: CabProp -> Cab groupbox :: CabProp -> Cab image :: CabProp -> Cab keyboard :: CabProp -> Cab label :: CabProp -> Cab hslider :: CabProp -> Cab vslider :: CabProp -> Cab rslider :: CabProp -> Cab soundfiler :: CabProp -> Cab signaldisplay :: CabProp -> Cab textbox :: CabProp -> Cab texteditor :: CabProp -> Cab xypad :: CabProp -> Cab bounds :: Int -> Int -> Int -> Int -> CabProp channel :: String -> CabProp text1 :: String -> CabProp text2 :: String -> String -> CabProp value :: Float -> CabProp colour :: Col -> CabProp colour0 :: Col -> CabProp colour1 :: Col -> CabProp backgroundcolour :: Col -> CabProp textcolour :: Col -> CabProp trackercolour :: Col -> CabProp outlinecolour :: Col -> CabProp fontcolour :: Col -> CabProp fontcolour0 :: Col -> CabProp fontcolour1 :: Col -> CabProp latched :: Bool -> CabProp identchannel :: String -> CabProp rotate :: Float -> Float -> Float -> CabProp alpha :: Float -> CabProp visible :: Bool -> CabProp caption :: String -> CabProp widgetarray :: String -> Int -> CabProp popuptext :: String -> CabProp active :: Bool -> CabProp svgfile :: String -> String -> CabProp populate :: String -> String -> CabProp mode :: String -> CabProp file :: String -> CabProp shape :: String -> CabProp corners :: Float -> CabProp channeltype :: String -> CabProp align :: String -> CabProp sliderincr :: Float -> CabProp max :: Float -> CabProp min :: Float -> CabProp textbox' :: Bool -> CabProp trackerthickness :: Float -> CabProp linethickness :: Float -> CabProp range :: Float -> Float -> (Float, Float) -> CabProp range2 :: Float -> Float -> (Float, Float) -> Maybe Float -> Maybe Float -> CabProp size :: Int -> Int -> CabProp pluginid :: String -> CabProp guirefresh :: Int -> CabProp plant :: String -> CabProp child :: Bool -> CabProp show :: Bool -> CabProp middlec :: Int -> CabProp keywidth :: Int -> CabProp scrollbars :: Bool -> CabProp fontstyle :: String -> CabProp scrubberpos :: Int -> CabProp zoom :: Float -> CabProp displaytype :: String -> CabProp updaterate :: Int -> CabProp wrap :: Bool -> CabProp -- | Basic waveforms that are used most often. A waveform function takes in -- a time varied frequency (in Hz). module Csound.Air.Wave type Wave = Sig -> SE Sig -- | 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 -- | Generic random smoothTypephase oscil rndPhs :: (D -> Sig -> Sig) -> (Sig -> SE Sig) rawTri :: Sig -> Sig rawSaw :: Sig -> Sig rawSqr :: Sig -> Sig rawPw :: Double -> Sig -> Sig rawTri' :: D -> Sig -> Sig rawSaw' :: D -> Sig -> Sig rawSqr' :: D -> Sig -> Sig rawPw' :: Double -> D -> Sig -> Sig rndRawTri :: Sig -> SE Sig rndRawSaw :: Sig -> SE Sig rndRawSqr :: Sig -> SE Sig rndRawPw :: Double -> 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 urawTri :: Sig -> Sig urawSaw :: Sig -> Sig urawSqr :: Sig -> Sig urawPw :: Double -> Sig -> Sig urawTri' :: D -> Sig -> Sig urawSaw' :: D -> Sig -> Sig urawSqr' :: D -> Sig -> Sig urawPw' :: Double -> D -> Sig -> Sig urndRawTri :: Sig -> SE Sig urndRawSaw :: Sig -> SE Sig urndRawSqr :: Sig -> SE Sig urndRawPw :: Double -> 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 -- | Oscillators with hard and soft sync module Csound.Air.Wave.Sync -- | Type of smooth shape to make smooth transitions on retrigger. -- Available types are: -- --
-- sawSync ratio cps --sawSync :: Sig -> Sig -> Sig -- | Integrated sawtooth oscillator with hard-sync. The first argument is a -- ration between slave and master oscillators. -- --
-- isawSync ratio cps --isawSync :: Sig -> Sig -> Sig -- | Pulse oscillator with hard-sync. The first argument is a ration -- between slave and master oscillators. -- --
-- pulseSync ratio cps --pulseSync :: Sig -> Sig -> Sig -- | Square oscillator with hard-sync. The first argument is a ration -- between slave and master oscillators. -- --
-- sqrSync ratio cps --sqrSync :: Sig -> Sig -> Sig -- | Triangle oscillator with hard-sync. The first argument is a ration -- between slave and master oscillators. -- --
-- triSync ratio cps --triSync :: Sig -> Sig -> Sig -- | Band-limited oscillator with hard-sync. The first argument is a ration -- between slave and master oscillators. -- --
-- bloscSync tab ratio cps --bloscSync :: Tab -> Sig -> Sig -> Sig -- | Sawtooth oscillator with hard-sync with phase. The second argument is -- a ration between slave and master oscillators. -- --
-- sawSync' phase ratio cps --sawSync' :: D -> Sig -> Sig -> Sig -- | Integrated sawtooth oscillator with hard-sync with phase. The second -- argument is a ration between slave and master oscillators. -- --
-- isawSync' phase ratio cps --isawSync' :: D -> Sig -> Sig -> Sig -- | Pulse oscillator with hard-sync with phase. The second argument is a -- ration between slave and master oscillators. -- --
-- pulseSync' phase ratio cps --pulseSync' :: D -> Sig -> Sig -> Sig -- | Square oscillator with hard-sync with phase. The second argument is a -- ration between slave and master oscillators. -- --
-- sqrSync' phase ratio cps --sqrSync' :: D -> Sig -> Sig -> Sig -- | Triangle oscillator with hard-sync with phase. The second argument is -- a ration between slave and master oscillators. -- --
-- triSync' phase ratio cps --triSync' :: D -> Sig -> Sig -> Sig -- | Band-limited oscillator with hard-sync with phase. The second argument -- is a ration between slave and master oscillators. -- --
-- bloscSync' phase tab ratio cps --bloscSync' :: Tab -> D -> Sig -> Sig -> Sig -- | Hard sync with saw waveform and randomized phase. rndSawSync :: Sig -> Sig -> SE Sig -- | Hard sync with integral saw waveform and randomized phase. rndIsawSync :: Sig -> Sig -> SE Sig -- | Hard sync with pulse waveform and randomized phase. rndPulseSync :: Sig -> Sig -> SE Sig -- | Hard sync with square waveform and randomized phase. rndSqrSync :: Sig -> Sig -> SE Sig -- | Hard sync with triangle waveform and randomized phase. rndTriSync :: Sig -> Sig -> SE Sig -- | Hard sync with band-limited table waveform waveform and randomized -- phase. rndBloscSync :: Tab -> Sig -> Sig -> SE Sig -- | Sawtooth oscillator with hard-sync. The freq argument is an -- absolute frequency of a slave oscillator. -- --
-- sawSyncAbs freq slaveCps masterCps --sawSyncAbs :: Sig -> Sig -> Sig -- | Integrated sawtooth oscillator with hard-sync. The freq -- argument is an absolute frequency of a slave oscillator. -- --
-- isawSyncAbs freq slaveCps masterCps --isawSyncAbs :: Sig -> Sig -> Sig -- | Pulse oscillator with hard-sync. The freq argument is an -- absolute frequency of a slave oscillator. -- --
-- pulseSyncAbs freq slaveCps masterCps --pulseSyncAbs :: Sig -> Sig -> Sig -- | Square oscillator with hard-sync. The freq argument is an -- absolute frequency of a slave oscillator. -- --
-- sqrSyncAbs freq slaveCps masterCps --sqrSyncAbs :: Sig -> Sig -> Sig -- | Triangle oscillator with hard-sync. The freq argument is an -- absolute frequency of a slave oscillator. -- --
-- triSyncAbs freq slaveCps masterCps --triSyncAbs :: Sig -> Sig -> Sig -- | Bandlimited table oscillator with hard-sync. The freq -- argument is an absolute frequency of a slave oscillator. -- --
-- bloscSyncAbs tab freq slaveCps masterCps --bloscSyncAbs :: Tab -> Sig -> Sig -> Sig -- | Sawtooth oscillator with hard-sync with phase. The freq -- argument is an absolute frequency of a slave oscillator. -- --
-- sawSyncAbs' phase freq slaveCps masterCps --sawSyncAbs' :: D -> Sig -> Sig -> Sig -- | Integrated sawtooth oscillator with hard-sync with phase. The -- freq argument is an absolute frequency of a slave oscillator. -- --
-- isawSyncAbs' phase freq slaveCps masterCps --isawSyncAbs' :: D -> Sig -> Sig -> Sig -- | Pulse oscillator with hard-sync with phase. The freq argument -- is an absolute frequency of a slave oscillator. -- --
-- pulseSyncAbs' phase freq slaveCps masterCps --pulseSyncAbs' :: D -> Sig -> Sig -> Sig -- | Square oscillator with hard-sync with phase. The freq -- argument is an absolute frequency of a slave oscillator. -- --
-- sqrSyncAbs' phase freq slaveCps masterCps --sqrSyncAbs' :: D -> Sig -> Sig -> Sig -- | Triangle oscillator with hard-sync with phase. The freq -- argument is an absolute frequency of a slave oscillator. -- --
-- triSyncAbs' phase freq slaveCps masterCps --triSyncAbs' :: D -> Sig -> Sig -> Sig -- | Bandlimited table oscillator with hard-sync with phase. The -- freq argument is an absolute frequency of a slave oscillator. -- --
-- bloscSyncAbs' phase tab freq slaveCps masterCps --bloscSyncAbs' :: Tab -> D -> Sig -> Sig -> Sig -- | Sawtooth oscillator with hard-sync. We can specify the smoothness -- type. The ratio argument is a ration between slave and master -- oscillators. -- --
-- sawSyncBy spec ratio cps --sawSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Integrated sawtooth oscillator with hard-sync. We can specify the -- smoothness type. The first argument is a ration between slave and -- master oscillators. -- --
-- isawSyncB specy ratio cps --isawSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Pulse oscillator with hard-sync. We can specify the smoothness type. -- The ratio argument is a ration between slave and master -- oscillators. -- --
-- pulseSyncBy spec ratio cps --pulseSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Square oscillator with hard-sync. We can specify the smoothness type. -- The ratio argument is a ration between slave and master -- oscillators. -- --
-- sawSyncBy spec ratio cps --sqrSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Triangle oscillator with hard-sync. We can specify the smoothness -- type. The ratio argument is a ration between slave and master -- oscillators. -- --
-- triSyncBy spec ratio cps --triSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Bandlimited table oscillator with hard-sync. We can specify the -- smoothness type. The ratio argument is a ration between slave -- and master oscillators. -- --
-- bloscSyncBy spec tab ratio cps --bloscSyncBy :: SyncSmooth -> Tab -> Sig -> Sig -> Sig -- | Sawtooth oscillator with hard-sync with phase. We can specify the -- smoothness type. The ratio argument is a ration between slave -- and master oscillators. -- --
-- sawSyncBy' spec phase ratio cps --sawSyncBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Integrated sawtooth oscillator with hard-sync with phase. We can -- specify the smoothness type. The ratio argument is a ration -- between slave and master oscillators. -- --
-- isawSyncBy' spec phase ratio cps --isawSyncBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Pulse oscillator with hard-sync with phase. We can specify the -- smoothness type. The ratio argument is a ration between slave -- and master oscillators. -- --
-- pulseSyncBy' spec phase ratio cps --pulseSyncBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Square oscillator with hard-sync with phase. We can specify the -- smoothness type. The ratio argument is a ration between slave -- and master oscillators. -- --
-- sawSyncBy' spec phase ratio cps --sqrSyncBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Triangle oscillator with hard-sync with phase. We can specify the -- smoothness type. The ratio argument is a ration between slave -- and master oscillators. -- --
-- triSyncBy' spec phase ratio cps --triSyncBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Bandlimited table oscillator with hard-sync with phase. We can specify -- the smoothness type. The ratio argument is a ration between -- slave and master oscillators. -- --
-- bloscSyncBy' spec phase tab ratio cps --bloscSyncBy' :: SyncSmooth -> Tab -> D -> Sig -> Sig -> Sig -- | A hard sync for sawtooth with absolute slave frequency. -- --
-- sawSyncAbs syncType salveCps masterCps --sawSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | A hard sync for integrated sawtooth: 4 * x * (1 - x) with absolute -- slave frequency. -- --
-- isawSyncAbs syncType salveCps masterCps --isawSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | A hard sync for pulse wave with absolute slave frequency. -- --
-- pulseSyncAbs syncType salveCps masterCps --pulseSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | A hard sync for square wave with absolute slave frequency. -- --
-- sqrSyncAbs syncType salveCps masterCps --sqrSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | A hard sync for triangle wave with absolute slave frequency. -- --
-- triSyncAbs syncType salveCps masterCps --triSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | A hard sync for band-limited oscillator with user defined waveform -- (it's stored in the table) woth absolute frequency. -- --
-- bloscSyncAbs syncType ftable salveCps masterCps --bloscSyncAbsBy :: SyncSmooth -> Tab -> Sig -> Sig -> Sig -- | A sawtooth. sawSyncAbsBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Integrated sawtooth: 4 * x * (1 - x). isawSyncAbsBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | Pulse (not normalized). pulseSyncAbsBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | A square wave. sqrSyncAbsBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | A triangle wave. triSyncAbsBy' :: SyncSmooth -> D -> Sig -> Sig -> Sig -- | A band-limited oscillator with user defined waveform (it's stored in -- the table). bloscSyncAbsBy' :: SyncSmooth -> Tab -> D -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited triangle wave. rawTriSync :: Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited square wave. rawSqrSync :: Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited sawtooth wave. rawSawSync :: Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited pulse-width wave. rawPwSync :: Double -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited triangle wave. rawTriSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited square wave. rawSqrSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited sawtooth wave. rawSawSyncBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited pulse-width wave. rawPwSyncBy :: Double -> SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited triangle wave. rawTriSyncAbs :: Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited square wave. rawSqrSyncAbs :: Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited sawtooth wave. rawSawSyncAbs :: Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited pulse-width wave. rawPwSyncAbs :: Double -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited triangle wave. rawTriSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited square wave. rawSqrSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited sawtooth wave. rawSawSyncAbsBy :: SyncSmooth -> Sig -> Sig -> Sig -- | Hard-sync with non-bandlimited pulse-width wave. rawPwSyncAbsBy :: Double -> SyncSmooth -> Sig -> Sig -> Sig -- | Soft sync with given waveform (with band-limited square wave for -- switch). The soft sync amount is controlled with ratio between master -- and slave frequencies. -- --
-- softSync slaveWave ratio masterWave --softSync :: SigSpace a => (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with raw square wave for switch). It's -- faster than softSync The soft sync amount is controlled with -- ratio between master and slave frequencies. -- --
-- rawSoftSync slaveWave ratio masterWave --rawSoftSync :: SigSpace a => (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with band-limited square wave for -- switch). The soft sync amount is controlled with ratio between master -- and slave frequencies. With first argument we can specify the -- smoothness algorithm. -- --
-- softSyncBy spec slaveWave ratio masterWave --softSyncBy :: SigSpace a => SyncSmooth -> (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with raw square wave for switch). It's -- faster than softSyncBy The soft sync amount is controlled with -- ratio between master and slave frequencies. With first argument we can -- specify the smoothness algorithm. -- --
-- rawSoftSyncBy spec slaveWave ratio masterWave --rawSoftSyncBy :: SigSpace a => SyncSmooth -> (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with band-limited square wave for -- switch). The soft sync amount is controlled with absolute frequency of -- the slave oscillator. -- --
-- softSyncAbs slaveWave ratio masterWave --softSyncAbs :: SigSpace a => (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with raw square wave for switch). It's -- faster than softSyncAbs The soft sync amount is controlled with -- absolute frequency of the slave oscillator. -- --
-- rawSoftSyncAbs slaveWave ratio masterWave --rawSoftSyncAbs :: SigSpace a => (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with band-limited square wave for -- switch). The soft sync amount is controlled with absolute frequency of -- the slave oscillator. With first argument we can specify the -- smoothness algorithm. -- --
-- softSyncAbsBy spec slaveWave ratio masterWave --softSyncAbsBy :: SigSpace a => SyncSmooth -> (Sig -> a) -> Sig -> (Sig -> a) -- | Soft sync with given waveform (with raw square wave for switch). It's -- faster than softSyncAbsBy The soft sync amount is controlled -- with absolute frequency of the slave oscillator. With first argument -- we can specify the smoothness algorithm. -- --
-- rawSoftSyncBy spec slaveWave ratio masterWave --rawSoftSyncAbsBy :: SigSpace a => SyncSmooth -> (Sig -> a) -> Sig -> (Sig -> a) -- | 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 -- | temposcal — Phase-locked vocoder processing with onset -- detection/processing, 'tempo-scaling'. -- -- temposcal implements phase-locked vocoder processing using function -- tables containing sampled-sound sources, with GEN01, and temposcal -- will accept deferred allocation tables. -- -- This opcode allows for time and frequency-independent scaling. Time is -- advanced internally, but controlled by a tempo scaling parameter; when -- an onset is detected, timescaling is momentarily stopped to avoid -- smearing of attacks. The quality of the effect is generally improved -- with phase locking switched on. -- -- temposcal will also scale pitch, independently of frequency, using a -- transposition factor (k-rate). -- --
-- asig temposcal ktimescal, kamp, kpitch, ktab, klock [,ifftsize, idecim, ithresh] ---- -- csound doc: http://www.csounds.com/manual/html/temposcal.html temposcal :: 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 (it's based on mincer -- opcode). 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 -- | ScaleWav function with fidelity set for drum-loops. scaleDrum :: TempoSig -> PitchSig -> String -> Sig2 -- | ScaleWav function with fidelity set for hormonical-loops. scaleHarm :: TempoSig -> PitchSig -> String -> Sig2 -- | ScaleWav1 function with fidelity set for drum-loops. scaleDrum1 :: TempoSig -> PitchSig -> String -> Sig -- | ScaleWav1 function with fidelity set for hormonical-loops. scaleHarm1 :: TempoSig -> PitchSig -> String -> Sig -- | Scaling mono audio files (accepts both midi and wav). It's based on -- temposcal Csound opcode. scaleWav1 :: Fidelity -> TempoSig -> PitchSig -> String -> Sig -- | Scaling stereo audio files (accepts both midi and wav). It's based on -- temposcal Csound opcode. scaleWav :: Fidelity -> TempoSig -> PitchSig -> String -> Sig2 -- | 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 () -- | Dumps signals to file and sends the audio through. Useful to monitor -- the signals. dumpWav :: String -> (Sig, Sig) -> SE (Sig, Sig) -- | Dumps mono signal to file and sends the audio through. Useful to -- monitor the signals. dumpWav1 :: String -> Sig -> SE Sig -- | 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.Typed.Types.SigSpace.SigSpace a => Csound.Typed.Types.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) -- | Effects module Csound.Air.Pan -- | Optional arguments for opcode hrtfmove. -- -- phase is 0 or 1 -- -- fade is 1 to 24. -- -- See csound docs for hrtfmove for details. data HeadPanSpec :: * HeadPanSpec :: D -> D -> HeadPanSpec [headPanPhase] :: HeadPanSpec -> D [hradPanFade] :: HeadPanSpec -> D -- | Head response based spacialization. It works when you listen in -- headphones. It works only with sample rate of 44100, 48000 or 96000. -- --
-- 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 -- | Hyper vectorial synthesis module Csound.Air.Hvs -- | Hvs vector type HvsSnapshot = [Double] -- | 1D matrix type HvsMatrix1 = [HvsSnapshot] -- | 2D matrix (grid of vecotrs) type HvsMatrix2 = [HvsMatrix1] -- | 3D matrix (cube of vectors) type HvsMatrix3 = [HvsMatrix2] -- | One dimensional Hyper vectorial synthesis. We can provide a list of -- vectors (of lists but the same length for all items is assumed) and a -- signal that ranges from 0 to 1. It interpolates between vectors in the -- list. As a result we get a n interpolated vector. It's a list but the -- actual length equals to the length of input vectors. -- -- An example. We can set the center frequency and resonance of the -- filter with the single parameter: -- --
-- 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 () -- | 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 -- | 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 -- | Makes fake resonant filter from flat filter. The resulting filter just -- ignores the resonance. toReson :: FlatFilter -> ResonFilter -- | Moog's low-pass filter. -- --
-- mlp centerFrequency qResonance signal --mlp :: Sig -> Sig -> Sig -> Sig -- | Another implementation of moog low pass filter (it's moogladder 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 -- | Analog-like low-pass filter -- --
-- alpf1 centerFrequency resonance asig --alp1 :: Sig -> Sig -> Sig -> Sig -- | Analog-like low-pass filter -- --
-- alpf2 centerFrequency resonance asig --alp2 :: Sig -> Sig -> Sig -> Sig -- | Analog-like low-pass filter -- --
-- alpf3 centerFrequency resonance asig --alp3 :: Sig -> Sig -> Sig -> Sig -- | Analog-like low-pass filter -- --
-- alpf4 centerFrequency resonance asig --alp4 :: Sig -> Sig -> Sig -> Sig -- | Analog-like high-pass filter -- --
-- ahp centerFrequency asig --ahp :: Sig -> Sig -> Sig -- | Moog ladder lowpass filter. -- -- Moogladder is an new digital implementation of the Moog ladder filter -- based on the work of Antti Huovilainen, described in the paper -- "Non-Linear Digital Implementation of the Moog Ladder Filter" -- (Proceedings of DaFX04, Univ of Napoli). This implementation is -- probably a more accurate digital representation of the original -- analogue filter. -- --
-- asig moogladder ain, kcf, kres[, istor] ---- -- csound doc: http://www.csounds.com/manual/html/moogladder.html -- -- Emulator of analog high pass filter. -- --
-- mvchpf asig xfreq --mvchpf :: Sig -> Sig -> Sig -- | Emulators of analog filters (requires Csound >= 6.07). -- --
-- mvclpf1 asig xfreq xresonance --mvclpf1 :: Sig -> Sig -> Sig -> Sig -- | Emulators of analog filters. -- --
-- mvclpf2 asig xfreq xresonance --mvclpf2 :: Sig -> Sig -> Sig -> Sig -- | Emulators of analog filters. -- --
-- mvclpf3 asig xfreq xresonance --mvclpf3 :: Sig -> Sig -> Sig -> Sig -- | Emulators of analog filters. -- --
-- mvclpf4 asig xfreq xresonance --mvclpf4 :: Sig -> Sig -> Sig -> Sig zdf1 :: Sig -> Sig -> (Sig, Sig) zlp1 :: Sig -> Sig -> Sig zhp1 :: Sig -> Sig -> Sig zap1 :: Sig -> Sig -> Sig zdf2 :: Sig -> Sig -> Sig -> (Sig, Sig, Sig) zlp :: Sig -> Sig -> Sig -> Sig zbp :: Sig -> Sig -> Sig -> Sig zhp :: Sig -> Sig -> Sig -> Sig zdf2_notch :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig) zbr :: Sig -> Sig -> Sig -> Sig zladder :: Sig -> Sig -> Sig -> Sig zdf4 :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig) zlp4 :: Sig -> Sig -> Sig -> Sig zbp4 :: Sig -> Sig -> Sig -> Sig zhp4 :: Sig -> Sig -> Sig -> Sig peakEq :: Sig -> Sig -> Sig -> Sig -> Sig highShelf :: Sig -> Sig -> Sig -> Sig lowShelf :: Sig -> Sig -> Sig -> Sig -- | Chebyshev type I low pass filter (with 2 poles). lpCheb1 :: Sig -> Sig -> Sig -- | Chebyshev type I low pass filter (with given number of poles, first -- argument). lpCheb1' :: D -> Sig -> Sig -> Sig -- | Chebyshev type II low pass filter (with 2 poles). lpCheb2 :: Sig -> Sig -> Sig -- | Chebyshev type II low pass filter (with given number of poles, first -- argument). lpCheb2' :: D -> Sig -> Sig -> Sig -- | Butterworth lowpass filter based on clfilt opcode (with 2 poles). clp :: Sig -> Sig -> Sig -- | Butterworth lowpass filter based on clfilt opcode (with given number -- of poles, first argument). clp' :: D -> Sig -> Sig -> Sig -- | Chebyshev type I high pass filter (with 2 poles). hpCheb1 :: Sig -> Sig -> Sig -- | Chebyshev type I high pass filter (with given number of poles, first -- argument). hpCheb1' :: D -> Sig -> Sig -> Sig -- | Chebyshev type II high pass filter (with 2 poles). hpCheb2 :: Sig -> Sig -> Sig -- | Chebyshev type II high pass filter (with given number of poles, first -- argument). hpCheb2' :: D -> Sig -> Sig -> Sig -- | Butterworth high pass filter based on clfilt opcode (with 2 poles). chp :: Sig -> Sig -> Sig -- | Butterworth high pass filter based on clfilt opcode (with given number -- of poles, first argument). chp' :: D -> Sig -> Sig -> Sig plastic :: Sig -> Sig -> Sig -> Sig wobble :: Sig -> Sig -> Sig -> Sig trumpy :: Sig -> Sig -> Sig -> Sig harsh :: Sig -> Sig -> Sig -> Sig -- | Fixed version of tbfcv filter the first argument is distortion (range -- [0, 1]) tbf :: Sig -> Sig -> Sig -> Sig -> Sig -- | Non-Linear normalized diode ladder filter. -- --
-- diode saturation centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. -- -- saturation ranges from 1 and higher (typical value: 4) diode :: Sig -> Sig -> Sig -> Sig -> Sig -- | Linear diode ladder filter. -- --
-- linDiode centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. linDiode :: Sig -> Sig -> Sig -> Sig -- | Non-Linear not normalized diode ladder filter. -- --
-- noNormDiode saturation centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. -- -- saturation ranges from 1 and higher (typical value: 4) noNormDiode :: Sig -> Sig -> Sig -> Sig -> Sig -- | Linear korg 35 low pass filter (12 dB). -- --
-- linDiode centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. linKorg_lp :: Sig -> Sig -> Sig -> Sig -- | Linear korg 35 high pass filter (6 dB). -- --
-- linDiode centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. linKorg_hp :: Sig -> Sig -> Sig -> Sig -- | Korg 35 low pass filter (12 dB). -- --
-- diode saturation centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. -- -- saturation ranges from 1 and higher (typical value: 4) korg_lp :: Sig -> Sig -> Sig -> Sig -> Sig -- | Korg 35 high pass filter (6 dB). -- --
-- diode saturation centerFrequency resonance asig ---- -- resonance ranges in the interval [0, 1] and higher. self-resonance -- occurs at 1. -- -- saturation ranges from 1 and higher (typical value: 4) korg_hp :: Sig -> Sig -> Sig -> Sig -> Sig slp :: Sig -> Sig -> Sig -> Sig shp :: Sig -> Sig -> Sig -> Sig sbp :: Sig -> Sig -> Sig -> Sig sbr :: Sig -> Sig -> Sig -> Sig multiStatevar :: (Sig, Sig, Sig) -> Sig -> Sig -> Sig -> Sig multiSvfilter :: (Sig, Sig, Sig) -> Sig -> Sig -> Sig -> Sig -- | 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 -- | An alias for -- --
-- let room dryWet asig = mixAt dryWet smallRoom2 asig --room :: MixAt Sig2 Sig2 a => Sig -> a -> AtOut Sig2 Sig2 a -- | An alias for -- --
-- let room dryWet asig = mixAt dryWet smallHall2 asig --chamber :: MixAt Sig2 Sig2 a => Sig -> a -> AtOut Sig2 Sig2 a -- | An alias for -- --
-- let room dryWet asig = mixAt dryWet largeHall2 asig --hall :: MixAt Sig2 Sig2 a => Sig -> a -> AtOut Sig2 Sig2 a -- | An alias for -- --
-- let room dryWet asig = mixAt dryWet magicCave2 asig --cave :: MixAt Sig2 Sig2 a => Sig -> a -> AtOut Sig2 Sig2 a -- | Fast zero delay convolution with impulse response that is contained in -- mono-audio file. -- --
-- monoIR irFile ain --monoIR :: FilePath -> Sig -> Sig -- | Fast zero delay convolution with impulse response that is contained in -- stereo-audio file. -- --
-- stereoIR irFile ain --stereoIR :: FilePath -> Sig2 -> Sig2 -- | If IR is encoded in a couple of mono files. stereoIR2 :: (FilePath, FilePath) -> Sig2 -> Sig2 -- | Precise mono IR with pconvolve (requires a lot of CPU). pmonoIR :: FilePath -> Sig -> Sig -- | Precise stereo IR with pconvolve (requires a lot of CPU). pstereoIR :: FilePath -> Sig2 -> Sig2 pstereoIR2 :: (FilePath, FilePath) -> Sig2 -> Sig2 -- | Fast zero delay convolution with impulse response that is contained in -- mono-audio file. We can specify aux parameters for convolution -- algorithm (see zconv'). -- --
-- monoIR' spec irFile ain --monoIR' :: ZConvSpec -> FilePath -> Sig -> Sig -- | Fast zero delay convolution with impulse response that is contained in -- stereo-audio file. We can specify aux parameters for convolution -- algorithm (see zconv'). -- --
-- stereoIR' spec irFile ain --stereoIR' :: ZConvSpec -> FilePath -> Sig2 -> Sig2 -- | If IR is encoded in a couple of mono files. stereoIR2' :: ZConvSpec -> (FilePath, FilePath) -> Sig2 -> Sig2 -- | Zero convolution specification data ZConvSpec :: * ZConvSpec :: D -> D -> D -> ZConvSpec -- | first partition size in samples [zconvPartSize] :: ZConvSpec -> D -- | partition growth ratio [zconvRatio] :: ZConvSpec -> D -- | total number of partition sizes [zconvNp] :: ZConvSpec -> D -- | Zero delay convolution with default parameters. -- --
-- zconv tabIR ain = ... --zconv :: Tab -> Sig -> Sig -- | zero delay convolution. -- --
-- zconv' (ZConvSpec ipart irat inp) ifn ain ---- -- Original UDO code by Victor Lazzarini. -- -- /************************************************** asig ZConv -- ain,ipart,irat,inp,ifn ain - input signal ipart - first partition size -- in samples irat - partition growth ratio inp - total number of -- partition sizes ifn - function table number containing the IR -- **************************************************/ zconv' :: ZConvSpec -> Tab -> Sig -> Sig -- | 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 -> Sig -- | Delay with feedback. -- --
-- fdelay maxDelayLength delayLength feedback balance --fvdelay :: MaxDelayTime -> DelayTime -> Feedback -> Sig -> 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 -- | Aux parameters for ping pong delay. They are maximum delay time, low -- pass filter center frequency and Pan width. The defaults are (5 -- sec, 3500, 0.3). data PingPongSpec PingPongSpec :: MaxDelayTime -> Sig -> Sig -> PingPongSpec [pingPongMaxTime] :: PingPongSpec -> MaxDelayTime [pingPongDamp] :: PingPongSpec -> Sig [pingPongWidth] :: PingPongSpec -> Sig -- | Ping-pong delay. -- --
-- pingPong delayTime feedback mixLevel --pingPong :: DelayTime -> Feedback -> Balance -> Sig2 -> Sig2 -- | Ping-pong delay with miscellaneous arguments. -- --
-- pingPong' spec delayTime feedback mixLevel --pingPong' :: PingPongSpec -> DelayTime -> Feedback -> Balance -> Sig2 -> Sig2 -- | Ping-pong delay defined in csound style. All arguments are present -- (nothing is hidden). -- --
-- csdPingPong maxTime delTime damp feedback width mixLevel (ainL, ainR) --csdPingPong :: MaxDelayTime -> DelayTime -> Sig -> Feedback -> Sig -> Balance -> Sig2 -> Sig2 -- | 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 type DriveSig = Sig type SensitivitySig = Sig type BaseCps = Sig type Resonance = Sig type TimeSig = Sig type BitsReductionSig = Sig type FoldoverSig = Sig type TremWaveSig = Sig type RatioSig = Sig type FftSize = D -- | Distortion -- --
-- fxDistort level drive tone sigIn --fxDistort :: Feedback -> Sig -> ToneSig -> Sig -> Sig -- | Stereo chorus. -- --
-- stChorus2 mix rate depth width sigIn --stChorus2 :: Balance -> RateSig -> DepthSig -> WidthSig -> Sig2 -> Sig2 -- | Phaser -- -- An phase shifting effect that mimics the design of a so called 'stomp -- box' -- --
-- fxPhaser rate depth freq fback ain ---- -- Arguments: -- --
-- fxFlanger rate depth delayTime feedback ain = ---- -- Arguments -- --
-- analogDelay mix feedback time tone sigIn --analogDelay :: Balance -> Feedback -> DelayTime -> ToneSig -> Sig -> Sig -- | Simplified delay -- --
-- fxEcho maxDelayLength delTime feedback sigIn --fxEcho :: D -> Sig -> Sig -> Sig -> Sig -- | Filter effect (a pair of butterworth low and high pass filters). -- --
-- fxFilter lowPassfFreq highPassFreq gain --fxFilter :: Sig -> Sig -> Sig -> Sig -> Sig -- | Adds filtered white noize to the signal -- --
-- fxWhite lfoFreq depth sigIn --fxWhite :: Sig -> Sig -> Sig -> SE Sig -- | Adds filtered pink noize to the signal -- --
-- fxWhite lfoFreq depth sigIn --fxPink :: Sig -> Sig -> Sig -> SE Sig -- | Equalizer -- --
-- equalizer gainsAndFrequencies gain sigIn --equalizer :: [(Sig, Sig)] -> Sig -> Sig -> Sig -- | Equalizer with frequencies: 100, 400, 1600, 6400 eq4 :: [Sig] -> Sig -> Sig -> Sig -- | Equalizer with frequencies: 100, 200, 400, 800, 1600, 3200, 6400 eq7 :: [Sig] -> Sig -> Sig -> Sig -- | Gain -- --
-- fxGain gain sigIn --fxGain :: SigSpace a => Sig -> a -> a -- | Delay line with low-pass filter in the feedback chain. The filter adds -- natural decay to the echoes. -- --
-- fxAnalogDelay mixRatio delayTime feedback toneRatio ain ---- -- Note that the center frequency of the filter is measured in normalized -- units (form 0 to 1). fxAnalogDelay :: Balance -> DelayTime -> Feedback -> ToneSig -> Sig -> Sig -- | Distortion unit with low-pass filter. -- --
-- fxDistortion driveLevel toneRatio ain ---- -- Note that the center frequency of the filter is measured in normalized -- units (form 0 to 1). fxDistortion :: DriveSig -> ToneSig -> Sig -> Sig -- | Envelope follower. -- --
-- fxFollower sensitivity baseFrequencyRatio resonance ain ---- -- Arguments: -- --
-- fxReverse time ---- -- time -- the size of the chunck in seconds. fxReverse :: TimeSig -> Sig -> Sig -- | LoFi -- -- 'Low Fidelity' distorting effects of bit reduction and downsampling -- (foldover) -- --
-- fxLoFi bits fold ain = ... ---- -- Arguments -- --
-- fxChorus2 rate depth width (ainLeft, ainRight) ---- -- Arguments -- --
-- fxAutoPan wave rate depth ain ---- -- ; Arguments: -- --
-- fxTrem wave rate depth ain ---- -- ; Arguments: -- --
-- fxPitchShifter fftSize mixRatio transposeRatio feedback ain ---- -- Arguments -- --
-- fxCompress thresh (loknee, hiknee) ratio (att, rel) gain ain --fxCompress :: Sig -> (Sig, Sig) -> Sig -> (Sig, Sig) -> Sig -> Sig -> Sig -- | opcode audaciouseq, a, kkkkkkkkkka -- -- inputs: kgain1, kgain2, kgain3, kgain4, kgain5, kgain6, kgain7, -- kgain8, kgain9, kgain10 ain -- -- 10-band EQ Input: kgain1, kgain2, ... kgain10, asig Output: aout -- -- 10 kgain arguments maps to each band Bands are: 31.25, 52.6, 125, 500, -- 1000, 2000, 4000, 8000, 16000 audaciousEq :: Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -- | 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 -- | PitchShifterDelay -- -- A pitch shifter effect that employs delay lines -- --
-- pitchShifterDelay maxDelayTime delayTime (feedback1, feedback2) transposeRatio ain ---- -- Arguments -- --
-- 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 -- | Wonderful echoes from morpheus. Granular synthesis for morphing -- between waveforms. It's a simplification of partikkel opcode for the -- case of morphing. module Csound.Air.Granular.Morpheus type WaveAmp = Sig type WaveKey = Sig type MorphWave = (Tab, WaveAmp, WaveKey, Pointer) -- | Specification of morphing synth. It has the default instance and the -- values in its records has default instances too data MorphSpec MorphSpec :: GrainDensity -> GrainEnv -> MorphSpec [morphGrainDensity] :: MorphSpec -> GrainDensity [morphGrainEnv] :: MorphSpec -> GrainEnv -- | Density of the grain stream. -- --
-- morpheus spec waves frequencyScale ---- --
-- morpheusOsc spec (baseFrequency, table) cps ---- -- baseFrequency is the frequency of the sample contained in the -- table. With oscillator we can read the table on different frequencies. morpheusOsc :: MorphSpec -> (D, Tab) -> Sig -> SE Sig2 -- | Morpheus oscillator. We control the four tables with pair of control -- signals (see the function pairToSquare). -- --
-- morpheusOsc2 spec baseFrequency waves (x, y) cps = ... --morpheusOsc2 :: MorphSpec -> D -> [(Sig, Tab)] -> (Sig, Sig) -> Sig -> SE Sig2 instance Data.Default.Class.Default Csound.Air.Granular.Morpheus.GrainDensity instance Data.Default.Class.Default Csound.Air.Granular.Morpheus.GrainEnv instance Data.Default.Class.Default Csound.Air.Granular.Morpheus.MorphSpec -- | Padsynth algorithm. See the details at: -- -- csound docs: -- http://csound.github.io/docs/manual/GENpadsynth.html -- -- original description: -- http://www.paulnasca.com/algorithms-created-by-me -- -- more detailed description: -- http://zynaddsubfx.sourceforge.net/doc/PADsynth/PADsynth.htm -- -- An example: -- --
-- harms = [ -- 1, 0.7600046992, 0.6199994683, 0.9399998784, 0.4400023818, 0.0600003302, -- 0.8499968648, 0.0899999291, 0.8199964762, 0.3199984133, -- 0.9400014281, 0.3000001907, 0.120003365, 0.1799997687, 0.5200006366] -- -- spec = defPadsynthSpec 42.2 harms -- -- main = dac $ mul 0.4 $ mixAt 0.35 largeHall2 $ mixAt 0.45 (echo 0.25 0.75) $ -- midi $ onMsg $ mul (fades 0.5 0.7) . padsynthOsc2 spec --module Csound.Air.Padsynth -- | Padsynth oscillator. -- -- padsynthOsc spec frequency -- -- It makes it easy to create padsynth sound waves (see Tab.padsynth). It -- creates a padsynth table and reads it with poscil at the right speed. padsynthOsc :: PadsynthSpec -> Sig -> SE Sig -- | Stereo padsynth oscillatro. It creates two padsynth ftables for left -- and right channels. padsynthOsc2 :: PadsynthSpec -> Sig -> SE Sig2 -- | Creates padsynth oscillator with given harmonics. -- --
-- bwOscBy harmonics bandwidth frequency --bwOscBy :: [Double] -> Double -> Sig -> SE Sig -- | Creates padsynth oscillator with given odd harmonics. -- --
-- bwOddOscBy harmonics bandwidth frequency --bwOddOscBy :: [Double] -> Double -> Sig -> SE Sig -- | Stereo version of bwOscBy. bwOscBy2 :: [Double] -> Double -> Sig -> SE Sig2 -- | Stereo version of bwOddOscBy. bwOddOscBy2 :: [Double] -> Double -> Sig -> SE Sig2 -- | Pure sine wave with padsynth wave table: -- --
-- bwOsc bandwidth frequency --bwOsc :: Double -> Sig -> SE Sig -- | Triangle wave with padsynth wave table: -- --
-- bwTri bandwidth frequency --bwTri :: Double -> Sig -> SE Sig -- | Square wave with padsynth wave table: -- --
-- bwSqr bandwidth frequency --bwSqr :: Double -> Sig -> SE Sig -- | Saw-tooth wave with padsynth wave table: -- --
-- bwSaw bandwidth frequency --bwSaw :: Double -> Sig -> SE Sig -- | Stereo version of bwOsc. bwOsc2 :: Double -> Sig -> SE Sig2 -- | Stereo version of bwTri. bwTri2 :: Double -> Sig -> SE Sig2 -- | Stereo version of bwSqr. bwSqr2 :: Double -> Sig -> SE Sig2 -- | Stereo version of bwSaw. bwSaw2 :: Double -> Sig -> SE Sig2 -- | It uses several padsynth tables. Each table is responsible for -- specific interval of frequencies. The list of pairs specifies the -- threshhold value and padsynth specification. The padsynth table is -- active for all frequencies that lie below the given threshold. -- --
-- padsynthOscMultiCps thresholdSpecPairs frequency = ... --padsynthOscMultiCps :: [(Double, PadsynthSpec)] -> D -> SE Sig -- | Stereo version of padsynthOscMultiCps. padsynthOscMultiCps2 :: [(Double, PadsynthSpec)] -> D -> SE Sig2 -- | It behaves just like padsynthOscMultiCps but it spreads the -- padsynth tables among amplitude values. So the last input argument is -- a pair of amplitude and frequency: -- --
-- padsynthOscMultiVol thresholdSpecPairs (amplitude, frequency) = ... --padsynthOscMultiVol :: [(Double, PadsynthSpec)] -> (D, Sig) -> SE Sig -- | Stereo version of padsynthOscMultiVol. padsynthOscMultiVol2 :: [(Double, PadsynthSpec)] -> (D, Sig) -> SE Sig2 -- | TODO (undefined function) -- -- With this function we can create square zones in the domain of -- (amplitude, frequency). We can assign a separate padsynth -- table for each zone. The list of pairs contains a pair of two -- threshold values (amplitude, frequency) and dedicated -- padsynth specification. -- --
-- padsynthOscMultiVolCps thresholdSpecPairs (amplitude, frequency) = ... --padsynthOscMultiVolCps :: [((Double, Double), PadsynthSpec)] -> (D, D) -> SE Sig -- | TODO (undefined function) -- -- Stereo version of padsynthOscMultiVolCps. padsynthOscMultiVolCps2 :: [((Double, Double), PadsynthSpec)] -> (D, D) -> SE Sig2 -- | Combines morpheus oscillators with padsynth algorithm. It uses single -- table for granular synthesis. morphsynthOscMultiCps :: MorphSpec -> [(Double, PadsynthSpec)] -> D -> SE Sig2 -- | Combines morpheus oscillators with padsynth algorithm. It uses up to -- four tables for granular synthesis. quadMorphsynthOscMultiCps :: MorphSpec -> [[(Double, PadsynthSpec)]] -> (Sig, Sig) -> D -> SE Sig2 -- | 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 -- | Data type for monophonic instruments. type MonoInstr a = MonoArg -> SE a -- | An effect processes the input signal. type Fx a = a -> SE a -- | Mono effect. type Fx1 = Fx Sig -- | Stereo effect. type Fx2 = Fx Sig2 -- | Fx specification. It;s a pair of dryWet ratio and a transformation -- function. data FxSpec a FxSpec :: DryWetRatio -> Fx a -> FxSpec a [fxMix] :: FxSpec a -> DryWetRatio [fxFun] :: FxSpec a -> Fx a type DryWetRatio = Sig -- | Mono-output patch. type Patch1 = Patch Sig -- | Stereo-output patch. type Patch2 = Patch Sig2 -- | The patch can be: -- --
-- fxSpec dryWetRatio fxFun --fxSpec :: Sig -> Fx a -> GenFxSpec a -- | Constructor for polyphonic synthesizer with flexible choice of the -- low-pass filter. If we use the filter from the first argument user -- lately can change it to some another filter. It defaults to mlp. polySyntFilter :: (ResonFilter -> Instr D a) -> Patch a -- | Constructor for monophonic synthesizer with flexible filter choice. monoSyntFilter :: (ResonFilter -> MonoInstr a) -> Patch a -- | Constructor for FX-specification with flexible filter choice. -- --
-- fxSpec dryWetRatio fxFun --fxSpecFilter :: Sig -> (ResonFilter -> Fx a) -> GenFxSpec a mapPatchInstr :: (Instr D a -> Instr D a) -> Patch a -> Patch a mapMonoPolyInstr :: (MonoInstr a -> MonoInstr a) -> (Instr D a -> Instr D a) -> Patch a -> Patch a -- | Transpose the patch by a given ratio. We can use the functions -- semitone, cent to calculate the ratio. transPatch :: D -> Patch a -> Patch a -- | Removes all effects from the patch. dryPatch :: Patch a -> Patch a -- | Renders the effect chain to a single function. getPatchFx :: (SigSpace a, Sigs a) => Maybe SyntSkin -> [GenFxSpec a] -> Fx a -- | Sets the dryWet ratio of the effects wwithin the patch. setFxMix :: Sig -> Patch a -> Patch a -- | Sets the dryWet ratios for the chain of the effects wwithin the patch. setFxMixes :: [Sig] -> Patch a -> Patch a -- | Sets the midi channel for all instruments in the patch. setMidiChn :: MidiChn -> Patch a -> Patch a -- | Plays a patch with midi. atMidi :: (SigSpace a, Sigs a) => Patch a -> SE a -- | Plays a patch with event stream. atSched :: (SigSpace a, Sigs a) => Patch a -> Evt (Sco (CsdNote D)) -> SE a -- | Plays a patch with event stream with stop-note event stream. atSchedUntil :: (SigSpace a, Sigs a) => Patch a -> Evt (CsdNote D) -> Evt b -> SE a -- | Plays notes indefinetely (it's more useful for monophonic -- synthesizers). atSchedHarp :: (SigSpace a, Sigs a) => Patch a -> Evt (CsdNote D) -> SE a -- | Plays a patch with scores. atSco :: forall a. (SigSpace a, Sigs a) => Patch a -> Sco (CsdNote D) -> Sco (Mix a) -- | Plays a patch with a single infinite note. atNote :: (SigSpace a, Sigs a) => Patch a -> CsdNote D -> SE a -- | Adds an effect to the patch's instrument. addInstrFx :: Fx a -> Patch a -> Patch a -- | Appends an effect before patch's effect. addPreFx :: DryWetRatio -> Fx a -> Patch a -> Patch a -- | Appends an effect after patch's effect. addPostFx :: DryWetRatio -> Fx a -> Patch a -> Patch a -- | Make an effect out of a pure function. fxSig :: SigSpace a => (Sig -> Sig) -> GenFxSpec a -- | Make an effect out of a pure function and specify dry/wet ratio. fxSigMix :: SigSpace a => Sig -> (Sig -> Sig) -> GenFxSpec a -- | Make an effect out of a stereo pure function. fxSig2 :: (Sig2 -> Sig2) -> GenFxSpec Sig2 -- | Make an effect out of a stereo pure function and specify dry/wet -- ratio. fxSigMix2 :: Sig -> (Sig2 -> Sig2) -> GenFxSpec Sig2 -- | Adds post fx with pure signal function. mapFx :: SigSpace a => (Sig -> Sig) -> Patch a -> Patch a -- | Adds post fx with pure signal function and specifies dry/wet ratio. mapFx' :: SigSpace a => Sig -> (Sig -> Sig) -> Patch a -> Patch a -- | Adds post fx with effectful signal function. bindFx :: BindSig a => (Sig -> SE Sig) -> Patch a -> Patch a -- | Adds post fx with effectful signal function and specifies dry/wet -- ratio. bindFx' :: BindSig a => Sig -> (Sig -> SE Sig) -> Patch a -> Patch a -- | Adds pre fx with pure signal function. mapPreFx :: SigSpace a => (Sig -> Sig) -> Patch a -> Patch a -- | Adds pre fx with pure signal function and specifies dry/wet ratio. mapPreFx' :: SigSpace a => Sig -> (Sig -> Sig) -> Patch a -> Patch a -- | Adds pre fx with effectful signal function. bindPreFx :: BindSig a => (Sig -> SE Sig) -> Patch a -> Patch a -- | Adds pre fx with effectful signal function and specifies dry/wet -- ratio. bindPreFx' :: BindSig a => Sig -> (Sig -> SE Sig) -> Patch a -> Patch a -- | Harmnoic series of patches. harmonPatch :: (SigSpace b, Sigs b) => [Sig] -> [D] -> Patch b -> Patch b -- | Adds an octave below note for a given patch to make the sound deeper. deepPad :: (SigSpace b, Sigs b) => Patch b -> Patch b -- | Plays a patch when the condition signal is satisfied. Can be useful -- for switches. patchWhen :: (Sigs a) => BoolSig -> Patch a -> Patch a -- | Mix two patches together. mixInstr :: (SigSpace b, Num b) => Sig -> Patch b -> Patch b -> Patch 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 -- | Sound font patch. sfPatch :: Sf -> Patch2 -- | Sound font patch with a bit of reverb. sfPatchHall :: Sf -> Patch2 -- | Transform the spec for monophonic patch. onMonoSyntSpec :: (MonoSyntSpec -> MonoSyntSpec) -> Patch a -> Patch a -- | Sets the slide time for pitch and amplitude of monophomic -- synthesizers. setMonoSlide :: D -> Patch a -> Patch a -- | Sets the monophonic to sharp transition and quick release. setMonoSharp :: Patch a -> Patch a -- | Triggers patch with Csound API. It creates a named instruement with -- given name (first argument). -- -- It simulates the midi-like instrument. Notes are encoded with -- messages: -- --
-- i "givenName" 1 pitchKey volumeKey -- note on -- i "givenName" 0 pitchKey volumeKey -- note off --patchByNameMidi :: (SigSpace a, Sigs a) => String -> Patch a -> SE a -- | Plays a patch with midi with given temperament (see -- Csound.Tuning). atMidiTemp :: (SigSpace a, Sigs a) => Temp -> Patch a -> SE a -- | Triggers patch with Csound API. It creates a named instruement with -- given name (second argument). It behaves like the function -- patchByNameMidi but we can specify custom temperament. patchByNameMidiTemp :: (SigSpace a, Sigs a) => Temp -> String -> Patch a -> SE a instance Data.Default.Class.Default Csound.Air.Patch.MonoSyntSpec instance Data.Default.Class.Default Csound.Air.Patch.PolySyntSpec instance Csound.Typed.Types.SigSpace.SigSpace a => Csound.Typed.Types.SigSpace.SigSpace (Csound.Air.Patch.Patch a) instance Csound.IO.RenderCsd Csound.Air.Patch.Patch1 instance Csound.IO.RenderCsd Csound.Air.Patch.Patch2 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. -- --
-- 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 -- | Gated, Re-triggerable ADSR modeled after the Doepfer A-140 opcode -- adsr140, a, aakkkk -- -- inputs: agate, aretrig, kattack, kdecay, ksustain, krelease adsr140 :: Sig -> Sig -> Sig -> Sig -> Sig -> Sig -> Sig -- | Triggers the table based envelope when the trigger signal equals to 1 -- and plays for dur seconds: -- --
-- trigTab table dur trigger --trigTab :: Tab -> Sig -> Sig -> Sig -- | Makes time intervals relative to the note's duration. So that: -- --
-- onIdur [a, t1, b, t2, c] ---- -- becomes: -- --
-- [a, t1 * idur, b, t2 * idur, c] --onIdur :: [D] -> [D] -- | The opcode linseg with time intervals relative to the total -- duration of the note. lindur :: [D] -> Sig -- | The opcode expseg with time intervals relative to the total -- duration of the note. expdur :: [D] -> Sig -- | The opcode linen with time intervals relative to the total -- duration of the note. Total time is set to the value of idur. -- --
-- linendur asig rise decay --linendur :: Sig -> D -> D -> Sig -- | Makes time intervals relative to the note's duration. So that: -- --
-- onDur dt [a, t1, b, t2, c] ---- -- becomes: -- --
-- [a, t1 * dt, b, t2 * dt, c] --onDur :: D -> [D] -> [D] -- | The opcode linseg with time intervals relative to the total -- duration of the note given by the user. lindurBy :: D -> [D] -> Sig -- | The opcode expseg with time intervals relative to the total -- duration of the note given by the user. expdurBy :: D -> [D] -> Sig -- | The opcode linen with time intervals relative to the total -- duration of the note. Total time is set to the value of the first -- argument. -- --
-- linendurBy dt asig rise decay --linendurBy :: D -> Sig -> D -> D -> Sig -- | 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 -- | Slope envelope. It stays at zero for a given time then it raises to 1 -- for thre given time. The function is usefull to delay the LFO. -- --
-- slope zeroTime rizeTime --slope :: D -> D -> Sig -- | Exponential slope (See the function slope). expSlope :: 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 HumanizeValueOut 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 HumanizeTimeOut 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 HumanizeValueTimeOut 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) -- | 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 -- | Delay a control signal by single sample. delay1k :: Sig -> Sig -- | Wave shaper. The signal should be bipolar. 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 1. 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 :: (Sigs a) => [(String, SE a)] -> Source a -- | Widget that represents a mixer with horizontal grouping of elements. hmixer :: (Sigs a) => [(String, SE a)] -> Source a -- | Transforms the mono signal to the stereo input for the mixer widget. mixMono :: String -> Sig -> (String, SE Sig2) -- | 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 :: 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 ---- --
-- fxGrid columnsSize fxs ---- -- first argument is a number of columns in each row. fxGrid :: Int -> [Source (Fx a)] -> Source (Fx a) -- | Scales the gui for signal processing widgets. fxSca :: Double -> Source (Fx a) -> Source (Fx a) -- | Applies a function to a signal processing function. fxMap :: Fx a -> Source (Fx a) -> Source (Fx a) -- | Applies FX with UI to the input argument. fxApply :: Source (a -> SE b) -> a -> Source b -- | Applies FX to the Patch. atFx :: Source (Fx a) -> Patch a -> Source (Patch a) -- | fxHor for chain that starts with mono effects and proceeds -- with stereo effects. The second argument can contain The transition -- widget (mono to stereo effect) or it can be empty. If it's empty -- automatic conversion will be inserted. fxHorMS :: [Source Fx1] -> Maybe (Source (Sig -> SE Sig2)) -> [Source Fx2] -> Source (Sig -> SE Sig2) -- | fxVer for chain that starts with mono effects and proceeds -- with stereo effects. The second argument can contain The transition -- widget (mono to stereo effect) or it can be empty. If it's empty -- automatic conversion will be inserted. fxVerMS :: [Source Fx1] -> Maybe (Source (Sig -> SE Sig2)) -> [Source Fx2] -> Source (Sig -> SE Sig2) -- | Creates a matrix of fx-boxes. Stacks a list of mono and stereo FXs. -- --
-- fxGrid columnsSize monoFxs maybeBridge stereoFxs ---- -- first argument is a number of columns in each row. fxGridMS :: Int -> [Source Fx1] -> Maybe (Source (Sig -> SE Sig2)) -> [Source Fx2] -> Source (Sig -> SE Sig2) fromMonoFx :: Sigs a => (Sig -> Sig) -> Fx a -- | Chooses an instrument among several alternatives. It uses the -- hradio for GUI groupping. hinstrChooser :: (Sigs b) => [(String, a -> SE b)] -> Int -> Source (a -> SE b) -- | Chooses an instrument among several alternatives. It uses the -- vradio for GUI groupping. vinstrChooser :: (Sigs b) => [(String, a -> SE b)] -> Int -> Source (a -> SE b) -- | Chooses a midi instrument among several alternatives. It uses the -- hradio for GUI groupping. hmidiChooser :: Sigs a => [(String, Msg -> SE a)] -> Int -> Source a -- | Chooses a midi instrument among several alternatives. It uses the -- vradio for GUI groupping. vmidiChooser :: Sigs a => [(String, Msg -> SE a)] -> Int -> Source a -- | The distortion widget. The arguments are -- --
-- uiDistort isOn levelOfDistortion drive tone --uiDistort :: Sigs a => Bool -> Double -> Double -> Double -> Source (Fx a) -- | The chorus widget. The arguments are -- --
-- uiChorus isOn mix rate depth width --uiChorus :: Bool -> Double -> Double -> Double -> Double -> Source Fx2 -- | The flanger widget. The arguments are -- --
-- uiFlanger isOn rate depth delay feedback --uiFlanger :: Sigs a => Bool -> Double -> Double -> Double -> Double -> Source (Fx a) -- | The phaser widget. The arguments are -- --
-- uiPhaser isOn mix feedback rate depth frequency --uiPhaser :: Sigs a => Bool -> Double -> Double -> Double -> Double -> Source (Fx a) -- | The delay widget. The arguments are -- --
-- uiDelay isOn mix feedback delayTime tone --uiDelay :: Sigs a => Bool -> Double -> Double -> Double -> Double -> Source (Fx a) -- | The simplified delay widget. The arguments are -- --
-- uiEcho isOn maxDelayTime delayTime feedback --uiEcho :: Sigs a => Bool -> D -> Double -> Double -> Source (Fx a) -- | The pair of low and high pass filters -- --
-- uiFilter isOn lowPassfrequency highPassFrequency gain --uiFilter :: Sigs a => Bool -> Double -> Double -> Double -> Source (Fx a) -- | The reverb widget. The arguments are: -- --
-- uiReverb mix depth --uiReverb :: Bool -> Double -> Double -> Source Fx2 -- | The gain widget, it's set to on by default. The arguments are -- --
-- uiGain amountOfGain --uiGain :: Sigs a => Double -> Source (Fx a) -- | Compressor -- --
-- uiCompress thresh loknee hiknee ratio att rel gain --uiCompress :: Sigs a => Double -> Double -> Double -> Double -> Double -> Double -> Double -> Source (Fx a) -- | The filtered white noize widget. The arguments are -- --
-- uiWhite isOn centerFreqOfFilter amountOfNoize --uiWhite :: Sigs a => Bool -> Double -> Double -> Source (Fx a) -- | The filtered pink noize widget. The arguments are -- --
-- uiPink isOn centerFreqOfFilter amountOfNoize --uiPink :: Sigs a => Bool -> Double -> Double -> Source (Fx a) -- | The constructor for signal processing functions with no arguments -- (controlls). uiFx :: Sigs a => String -> Fx a -> Bool -> Source (Fx a) uiDry :: (Sigs a) => Source (Fx a) -- | the widget for mixing in a signal to the signal. uiSig :: (Sigs a) => String -> Bool -> Source a -> Source (Fx a) -- | A mixer widget represented as an effect. The effect sums the signals -- with given wieghts. uiMix :: (Sigs a) => Bool -> [(String, SE a)] -> Source (Fx a) -- | Midi chooser implemented as FX-box. uiMidi :: (Sigs a) => [(String, Msg -> SE a)] -> Int -> Source (Fx a) 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 -- | A friendly family of effects. These functions are kindly provided by -- Iain McCurdy (designed in Csound). module Csound.Air.Fx.FxBox -- | Analog Delay line with low-pass filter in the feedback chain. The -- filter adds natural decay to the echoes. -- --
-- adele mixRatio delayTime feedback toneRatio ain ---- -- Note that the center frequency of the filter is measured in normalized -- units (form 0 to 1). adele :: Sigs a => Balance -> DelayTime -> Feedback -> ToneSig -> a -> a -- | Ping-pong delay -- --
-- pongy kmix delayTime feedback tone ain --pongy :: Sig2s a => Balance -> DelayTime -> Feedback -> ToneSig -> WidthSig -> a -> a -- | Distortion unit with low-pass filter. -- --
-- tort driveLevel toneRatio ain ---- -- Note that the center frequency of the filter is measured in normalized -- units (form 0 to 1). tort :: Sigs a => DriveSig -> ToneSig -> a -> a -- | Envelope follower. -- --
-- fowler sensitivity baseFrequencyRatio resonance ain ---- -- Arguments: -- --
-- revsy time ---- -- time -- the size of the chunck in seconds. revsy :: Sigs a => TimeSig -> a -> a -- | A flanger effect following the typical design of a so called 'stomp -- box' -- --
-- flan rate depth delayTime feedback ain = ---- -- Arguments -- --
-- phasy rate depth freq fback ain ---- -- Arguments: -- --
-- crusher bits fold ain = ... ---- -- Arguments -- --
-- chory rate depth width (ainLeft, ainRight) ---- -- Arguments -- --
-- pany wave rate depth ain ---- -- ; Arguments: -- --
-- oscPany = pany 0 --oscPany :: DepthSig -> RateSig -> Sig2 -> Sig2 -- | Triangle auto pan -- --
-- triPany = pany 1 --triPany :: DepthSig -> RateSig -> Sig2 -> Sig2 -- | Square auto pan -- --
-- sqrPany = pany 2 --sqrPany :: DepthSig -> RateSig -> Sig2 -> Sig2 -- | Tremolo -- -- tremolo effect -- --
-- tremy wave rate depth ain ---- -- ; Arguments: -- --
-- oscTremy = tremy 0 --oscTremy :: Sigs a => DepthSig -> RateSig -> a -> a -- | Triangle tremolo -- --
-- triTremy = tremy 1 --triTremy :: Sigs a => DepthSig -> RateSig -> a -> a -- | Square tremolo -- --
-- sqrTremy = tremy 2 --sqrTremy :: Sigs a => DepthSig -> RateSig -> a -> a -- | RingModulator -- -- An ring modulating effect with an envelope follower -- --
-- ringo balance rate envelopeMod ain ---- --
-- 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: -- --