csound-expression 3.1.1 → 3.2.1
raw patch · 6 files changed
+107/−82 lines, 6 filesdep ~csound-expression-typed
Dependency ranges changed: csound-expression-typed
Files
- csound-expression.cabal +8/−3
- src/Csound/Air.hs +55/−2
- src/Csound/Control/Instr.hs +1/−1
- src/Csound/Control/Overload.hs +2/−2
- src/Csound/Control/Overload/Instr.hs +0/−74
- src/Csound/Control/Overload/Outs.hs +41/−0
csound-expression.cabal view
@@ -1,5 +1,5 @@ Name: csound-expression-Version: 3.1.1+Version: 3.2.1 Cabal-Version: >= 1.6 License: BSD3 License-file: LICENSE@@ -65,6 +65,11 @@ . * ideas: Conal Elliott, Oleg Kiselyov, Paul Hudak, Gabriel Gonzalez, Rich Hickey and Csound's community. .+ WARNING: the library works best within ghci. The real-time sound rendering function dac spawns+ a child process in the background which may continue to execute after you stop the main process that runs the programm.+ It's not so in vim but it happens in the Sublime Editor and when you invoke runhaskell. So the best+ is to write you program in the separate file and then load it in the ghci and invoke the function main (which+ runs the sound rendering with the function dac). Extra-Source-Files : examples/README.txt@@ -102,7 +107,7 @@ Ghc-Options: -Wall Build-Depends: base >= 4, base < 5, process, data-default, Boolean >= 0.1.0,- csound-expression-typed >= 0.0.2, csound-expression-opcodes+ csound-expression-typed >= 0.0.3, csound-expression-opcodes Hs-Source-Dirs: src/ Exposed-Modules: Csound.Base@@ -128,7 +133,7 @@ -- Csound.LowLevel Other-Modules: Csound.Control.Overload- Csound.Control.Overload.Instr+ Csound.Control.Overload.Outs Csound.Control.Overload.MidiInstr Csound.Control.Overload.SpecInstr
src/Csound/Air.hs view
@@ -47,8 +47,10 @@ classicWaves, masterVolume, masterVolumeKnob, - -- * Other- reverbsc1+ -- * Reverbs+ reverbsc1, rever1, rever2, reverTime,+ smallRoom, smallHall, largeHall, magicCave,+ smallRoom2, smallHall2, largeHall2, magicCave2 ) where @@ -526,3 +528,54 @@ masterVolumeKnob :: Source Sig masterVolumeKnob = knob "master" uspan 0.5 +---------------------------------------------------------------------------+-- Reverbs++-- | Reverb with given time.+reverTime :: Sig -> Sig -> Sig+reverTime dt a = nreverb a dt 0.3 ++-- | Mono reverb (based on reverbsc)+--+-- > rever1 feedback asig+rever1 :: Sig -> Sig -> (Sig, Sig)+rever1 fbk a = reverbsc a a fbk 12000++-- | Mono reverb (based on reverbsc)+--+-- > rever2 feedback asigLeft asigRight+rever2 :: Sig -> Sig -> Sig -> (Sig, Sig)+rever2 fbk a1 a2 = (a1 + wa1, a2 + wa2)+ where (wa1, wa2) = reverbsc a1 a2 fbk 12000++-- | Mono reverb for small room.+smallRoom :: Sig -> (Sig, Sig)+smallRoom = rever1 0.6++-- | Mono reverb for small hall.+smallHall :: Sig -> (Sig, Sig)+smallHall = rever1 0.8++-- | Mono reverb for large hall.+largeHall :: Sig -> (Sig, Sig)+largeHall = rever1 0.9++-- | The magic cave reverb (mono).+magicCave :: Sig -> (Sig, Sig)+magicCave = rever1 0.99++-- | Stereo reverb for small room.+smallRoom2 :: Sig -> Sig -> (Sig, Sig)+smallRoom2 = rever2 0.6++-- | Stereo reverb for small hall.+smallHall2 :: Sig -> Sig -> (Sig, Sig)+smallHall2 = rever2 0.8++-- | Stereo reverb for large hall.+largeHall2 :: Sig -> Sig -> (Sig, Sig)+largeHall2 = rever2 0.9++-- | The magic cave reverb (stereo).+magicCave2 :: Sig -> Sig -> (Sig, Sig)+magicCave2 = rever2 0.99
src/Csound/Control/Instr.hs view
@@ -90,7 +90,7 @@ -- * Overload -- | Converters to make it easier a construction of the instruments.- Instr(..), MidiInstr(..), AmpInstr(..), CpsInstr(..)+ Outs(..), onArg, MidiInstr(..), AmpInstr(..), CpsInstr(..) ) where import Csound.Typed
src/Csound/Control/Overload.hs view
@@ -1,8 +1,8 @@ module Csound.Control.Overload(- Instr(..), MidiInstr(..), AmpInstr(..), CpsInstr(..) + Outs(..), onArg, MidiInstr(..), AmpInstr(..), CpsInstr(..) ) where -import Csound.Control.Overload.Instr+import Csound.Control.Overload.Outs import Csound.Control.Overload.MidiInstr import Csound.Control.Overload.SpecInstr
− src/Csound/Control/Overload/Instr.hs
@@ -1,74 +0,0 @@-{-# Language TypeFamilies, FlexibleInstances, FlexibleContexts #-}-module Csound.Control.Overload.Instr(- Instr(..)-) where--import Csound.Typed---- | Converts a value to the instrument that is used with the functions 'Csound.Base.sco' or 'Csound.Base.eff'.-class Instr a where- type InstrIn a :: *- type InstrOut a :: *-- onArg :: a -> InstrIn a -> SE (InstrOut a)--instance Instr (a -> Sig) where- type InstrIn (a -> Sig) = a- type InstrOut (a -> Sig) = Sig-- onArg f = return . f--instance Instr (a -> (Sig, Sig)) where- type InstrIn (a -> (Sig, Sig)) = a- type InstrOut (a -> (Sig, Sig)) = (Sig, Sig)-- onArg f = return . f--instance Instr (a -> (Sig, Sig, Sig)) where- type InstrIn (a -> (Sig, Sig, Sig)) = a- type InstrOut (a -> (Sig, Sig, Sig)) = (Sig, Sig, Sig)-- onArg f = return . f--instance Instr (a -> (Sig, Sig, Sig, Sig)) where- type InstrIn (a -> (Sig, Sig, Sig, Sig)) = a- type InstrOut (a -> (Sig, Sig, Sig, Sig)) = (Sig, Sig, Sig, Sig)-- onArg f = return . f--instance Instr (a -> (Sig, Sig, Sig, Sig, Sig)) where- type InstrIn (a -> (Sig, Sig, Sig, Sig, Sig)) = a- type InstrOut (a -> (Sig, Sig, Sig, Sig, Sig)) = (Sig, Sig, Sig, Sig, Sig)-- onArg f = return . f--instance Instr (a -> SE Sig) where- type InstrIn (a -> SE Sig) = a- type InstrOut (a -> SE Sig) = Sig-- onArg f = f--instance Instr (a -> SE (Sig, Sig)) where- type InstrIn (a -> SE (Sig, Sig)) = a- type InstrOut (a -> SE (Sig, Sig)) = (Sig, Sig)-- onArg f = f--instance Instr (a -> SE (Sig, Sig, Sig)) where- type InstrIn (a -> SE (Sig, Sig, Sig)) = a- type InstrOut (a -> SE (Sig, Sig, Sig)) = (Sig, Sig, Sig)-- onArg f = f--instance Instr (a -> SE (Sig, Sig, Sig, Sig)) where- type InstrIn (a -> SE (Sig, Sig, Sig, Sig)) = a- type InstrOut (a -> SE (Sig, Sig, Sig, Sig)) = (Sig, Sig, Sig, Sig)-- onArg f = f--instance Instr (a -> SE (Sig, Sig, Sig, Sig, Sig)) where- type InstrIn (a -> SE (Sig, Sig, Sig, Sig, Sig)) = a- type InstrOut (a -> SE (Sig, Sig, Sig, Sig, Sig)) = (Sig, Sig, Sig, Sig, Sig)-- onArg f = f-
+ src/Csound/Control/Overload/Outs.hs view
@@ -0,0 +1,41 @@+{-# Language + TypeFamilies, + FlexibleInstances, + FlexibleContexts #-}+module Csound.Control.Overload.Outs(+ Outs(..), onArg +) where++import Csound.Typed++onArg :: Outs b => (a -> b) -> (a -> SE (SigOuts b))+onArg f = toOuts . f++class Sigs (SigOuts a) => Outs a where+ type SigOuts a :: *+ toOuts :: a -> SE (SigOuts a)++instance Outs Sig where+ type SigOuts Sig = Sig+ toOuts = return ++instance Outs (Sig, Sig) where+ type SigOuts (Sig, Sig) = (Sig, Sig)+ toOuts = return++instance Outs (Sig, Sig, Sig, Sig) where+ type SigOuts (Sig, Sig, Sig, Sig) = (Sig, Sig, Sig, Sig)+ toOuts = return++instance Outs (SE Sig) where+ type SigOuts (SE Sig) = Sig+ toOuts = id ++instance Outs (SE (Sig, Sig)) where+ type SigOuts (SE (Sig, Sig)) = (Sig, Sig)+ toOuts = id++instance Outs (SE (Sig, Sig, Sig, Sig)) where+ type SigOuts (SE (Sig, Sig, Sig, Sig)) = (Sig, Sig, Sig, Sig)+ toOuts = id+