packages feed

csound-sampler 0.0.10.1 → 0.0.10.2

raw patch · 2 files changed

+33/−29 lines, 2 filesdep +textdep ~csound-expressionPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: text

Dependency ranges changed: csound-expression

API changes (from Hackage documentation)

- Csound.Sam.Ui: freeSim :: [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: freeSim :: [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: freeSimWith :: [(String, Sam, Bool)] -> Source Sam
+ Csound.Sam.Ui: freeSimWith :: [(Text, Sam, Bool)] -> Source Sam
- Csound.Sam.Ui: freeTog :: [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: freeTog :: [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: hfreeSim :: [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: hfreeSim :: [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: hfreeSimWith :: [(String, Sam, Bool)] -> Source Sam
+ Csound.Sam.Ui: hfreeSimWith :: [(Text, Sam, Bool)] -> Source Sam
- Csound.Sam.Ui: hfreeTog :: [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: hfreeTog :: [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: hsim :: Int -> [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: hsim :: Int -> [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: hsimWith :: Int -> [(String, Sam, Bool)] -> Source Sam
+ Csound.Sam.Ui: hsimWith :: Int -> [(Text, Sam, Bool)] -> Source Sam
- Csound.Sam.Ui: htog :: Int -> [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: htog :: Int -> [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: live :: Int -> [String] -> [Sam] -> Source Sam
+ Csound.Sam.Ui: live :: Int -> [Text] -> [Sam] -> Source Sam
- Csound.Sam.Ui: liveEf :: Int -> [String] -> [Sam] -> (Double, Fx2) -> [(Double, Fx2)] -> Source Sam
+ Csound.Sam.Ui: liveEf :: Int -> [Text] -> [Sam] -> (Double, Fx2) -> [(Double, Fx2)] -> Source Sam
- Csound.Sam.Ui: mixSam :: String -> Bpm -> Sam -> (String, SE Sig2)
+ Csound.Sam.Ui: mixSam :: Text -> Bpm -> Sam -> (Text, SE Sig2)
- Csound.Sam.Ui: sim :: Int -> [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: sim :: Int -> [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: simWith :: Int -> [(String, Sam, Bool)] -> Source Sam
+ Csound.Sam.Ui: simWith :: Int -> [(Text, Sam, Bool)] -> Source Sam
- Csound.Sam.Ui: tog :: Int -> [(String, Sam)] -> Source Sam
+ Csound.Sam.Ui: tog :: Int -> [(Text, Sam)] -> Source Sam
- Csound.Sam.Ui: uiSam :: String -> Bool -> Sig -> Source Sam -> Source Fx2
+ Csound.Sam.Ui: uiSam :: Text -> Bool -> Sig -> Source Sam -> Source Fx2

Files

csound-sampler.cabal view
@@ -1,5 +1,5 @@ name:                csound-sampler-version:             0.0.10.1+version:             0.0.10.2 license:             BSD3 license-file:        LICENSE author:              Anton Kholomiov@@ -8,7 +8,7 @@ stability:           Experimental category:            Music build-type:          Simple-cabal-version:       >=1.22+cabal-version:       1.12 synopsis:            A musical sampler based on Csound description:         A simple sampler based on the library csound-expression. We can define loops                      and patterns of samples. An intricate pattern of sound is just few strokes away.@@ -25,8 +25,10 @@ library   Ghc-Options:    -Wall   Hs-Source-Dirs:      src/-  build-depends:       base >= 4, base < 5, transformers >= 0.3, csound-expression >= 5.4.0+  build-depends:       base >= 4.10, base < 5, transformers >= 0.3, csound-expression >= 5.4.3.1, text   Default-language: Haskell2010+  default-extensions:+    OverloadedStrings   exposed-modules:     Csound.Sam     Csound.Sam.Core
src/Csound/Sam/Ui.hs view
@@ -10,6 +10,8 @@ ) where  import Data.List(transpose)+import Data.String (fromString)+import Data.Text (Text) import Control.Monad import Control.Monad.Trans.Reader @@ -22,29 +24,29 @@  -- | A widget for playing several samples at the same time (aka `sim`ultaneously). -- The prefix `free` means no syncronization. the samples start to play when the button is pressed.-freeSim :: [(String, Sam)] -> Source Sam+freeSim :: [(Text, Sam)] -> Source Sam freeSim = genFreeSim ver  -- | It's just like the function @freeSim@ but the visual representation is horizontal. -- That's why there is a prefix @h@.-hfreeSim :: [(String, Sam)] -> Source Sam+hfreeSim :: [(Text, Sam)] -> Source Sam hfreeSim = genFreeSim hor  -- | It's just like the function `freeSim` but the user can -- activate some samples right in the code. If the third -- element is @True@ the sample is played.-freeSimWith :: [(String, Sam, Bool)] -> Source Sam+freeSimWith :: [(Text, Sam, Bool)] -> Source Sam freeSimWith = genFreeSimInits ver  -- | It's just like the function `freeSimWith` but the visual representation is horizontal. -- That's why there is a prefix @h@.-hfreeSimWith :: [(String, Sam, Bool)] -> Source Sam+hfreeSimWith :: [(Text, Sam, Bool)] -> Source Sam hfreeSimWith = genFreeSimInits hor -genFreeSim :: ([Gui] -> Gui) -> [(String, Sam)] -> Source Sam+genFreeSim :: ([Gui] -> Gui) -> [(Text, Sam)] -> Source Sam genFreeSim gcat as = genFreeSimInits gcat $ fmap (\(a, b) -> (a, b, False)) as -genFreeSimInits :: ([Gui] -> Gui) -> [(String, Sam, Bool)] -> Source Sam+genFreeSimInits :: ([Gui] -> Gui) -> [(Text, Sam, Bool)] -> Source Sam genFreeSimInits gcat as = source $ do   (guis, ts) <- fmap unzip $ zipWithM (\a b -> toggle a b) names initVals   let res = groupToggles mean sams ts@@ -54,14 +56,14 @@  -- | The widget to toggle between several samples (aka `tog`gle). -- The prefix `free` means no syncronization. the samples start to play when the button is pressed.-freeTog :: [(String, Sam)] -> Source Sam+freeTog :: [(Text, Sam)] -> Source Sam freeTog = genFreeTog ver  -- | It's just like the function @freeTog@ but the visual representation is horizontal.-hfreeTog :: [(String, Sam)] -> Source Sam+hfreeTog :: [(Text, Sam)] -> Source Sam hfreeTog = genFreeTog hor -genFreeTog :: ([Gui] -> Gui) -> [(String, Sam)] -> Source Sam+genFreeTog :: ([Gui] -> Gui) -> [(Text, Sam)] -> Source Sam genFreeTog gcat as = source $ do   (guis, writeProcs, readProcs) <- fmap unzip3 $ mapM (flip setToggleSig False) names   curRef <- newGlobalRef (0 :: Sig)@@ -81,10 +83,10 @@     ids = fmap (sig . int) [1 .. length as]  -genSim :: ([Gui] -> Gui) -> Int -> [(String, Sam)] -> Source Sam+genSim :: ([Gui] -> Gui) -> Int -> [(Text, Sam)] -> Source Sam genSim gcat numBeats as = genSimInits gcat numBeats $ fmap (\(a, b) -> (a, b, False)) as -genSimInits :: ([Gui] -> Gui) -> Int -> [(String, Sam, Bool)] -> Source Sam+genSimInits :: ([Gui] -> Gui) -> Int -> [(Text, Sam, Bool)] -> Source Sam genSimInits gcat numBeats as = source $ do   (guis, writeProcs, readProcs) <- fmap unzip3 $ zipWithM (\a b -> setToggleSig a b) names initVals   curRefs <- mapM (const $ newGlobalRef (0 :: Sig)) ids@@ -106,31 +108,31 @@ -- -- The samples are started only on every n'th beat. -- The tempo is specified with rendering the sample (see the function @runSam@).-sim :: Int -> [(String, Sam)] -> Source Sam+sim :: Int -> [(Text, Sam)] -> Source Sam sim = genSim ver  -- | It's just like the function @sim@ but the visual representation is horizontal. -- That's why there is a prefix @h@.-hsim :: Int -> [(String, Sam)] -> Source Sam+hsim :: Int -> [(Text, Sam)] -> Source Sam hsim = genSim hor   -- | It's just like the function `sim` but the user can -- activate some samples right in the code. If the third -- element is @True@ the sample is played.-simWith :: Int -> [(String, Sam, Bool)] -> Source Sam+simWith :: Int -> [(Text, Sam, Bool)] -> Source Sam simWith = genSimInits ver  -- | It's just like the function `hsimWith` but the visual representation is horizontal. -- That's why there is a prefix @h@.-hsimWith :: Int -> [(String, Sam, Bool)] -> Source Sam+hsimWith :: Int -> [(Text, Sam, Bool)] -> Source Sam hsimWith = genSimInits hor  -genTog :: ([Gui] -> Gui) -> Int -> [(String, Sam)] -> Source Sam+genTog :: ([Gui] -> Gui) -> Int -> [(Text, Sam)] -> Source Sam genTog gcat numBeats as = fmap (\(g, x) -> (g, fst x)) $ genTogWithRef gcat numBeats as -genTogWithRef :: ([Gui] -> Gui) -> Int -> [(String, Sam)] -> Source (Sam, Ref Sig)+genTogWithRef :: ([Gui] -> Gui) -> Int -> [(Text, Sam)] -> Source (Sam, Ref Sig) genTogWithRef gcat numBeats as = source $ do   (guis, writeProcs, readProcs) <- fmap unzip3 $ mapM (flip setToggleSig False) names   curRef <- newGlobalRef (0 :: Sig)@@ -152,12 +154,12 @@ -- | A widget to toggle playing of several samples. The switch -- of the playing is synchronized with each n'th beat where -- n is the first argument of the function.-tog :: Int -> [(String, Sam)] -> Source Sam+tog :: Int -> [(Text, Sam)] -> Source Sam tog = genTog ver  -- | It's just like the function @tog@ but the visual representation is horizontal. -- That's why there is a prefix @h@.-htog :: Int -> [(String, Sam)] -> Source Sam+htog :: Int -> [(Text, Sam)] -> Source Sam htog = genTog hor  -- | The widget resembles the Ableton Live session view.@@ -172,7 +174,7 @@ -- the column represents samples that belong to the same group. -- The third argument is a list of samples. It represents the matrix of samples -- in row-wise fashion.-live :: Int -> [String] -> [Sam] -> Source Sam+live :: Int -> [Text] -> [Sam] -> Source Sam live numBeats names sams = source $ do   (gVols, vols) <- fmap unzip $  mapM  defSlider $ replicate n "vol"   (gs, xs) <- fmap unzip $ zipWithM (\a b -> mkLiveRow numBeats a b) (zip names gVols) rows@@ -185,7 +187,7 @@     ids = fmap (sig . int) [1 .. length (head rows)]     n = length names -mkLiveRow :: Int -> (String, Gui) -> [Sam] -> Source (Sam, Ref Sig)+mkLiveRow :: Int -> (Text, Gui) -> [Sam] -> Source (Sam, Ref Sig) mkLiveRow numBeats (name, gVol) as = genTogWithRef (\xs -> ver $ xs ++ [gVol]) numBeats (zip (name : repeat "") as)  mkLiveSceneRow :: Int -> Gui -> [Sig] -> [Ref Sig] -> SE (Gui, Sig -> SE ())@@ -205,7 +207,7 @@    return (ver $ guis ++ [gMaster], mkReaders)   where-    names = take len $ fmap show [(1::Int) ..]+    names = take len $ fmap (fromString . show) [(1::Int) ..]     len = length ids  splitRows :: Int -> [a] -> [[a]]@@ -213,13 +215,13 @@   | length as < n = []   | otherwise     = take n as : splitRows n (drop n as) -defSlider :: String -> Source Sig+defSlider :: Text -> Source Sig defSlider tag = slider tag (linSpan 0 1) 0.5  -- | It's just like the function @live@ but we can provide the list -- of effects for each column. The double value specifies the mix -- between dry and wet signals.-liveEf :: Int -> [String] -> [Sam] -> (Double, Fx2) -> [(Double, Fx2)] -> Source Sam+liveEf :: Int -> [Text] -> [Sam] -> (Double, Fx2) -> [(Double, Fx2)] -> Source Sam liveEf numBeats names sams masterEff effs = source $ do   (gVols, vols) <- fmap unzip $  mapM defSlider $ replicate n "vol"   (gEffs, effCtrls) <- fmap unzip $@@ -244,13 +246,13 @@  -- | It's useful to convert samples to signals an insert -- them in the widget @mixer@.-mixSam :: String -> Bpm -> Sam -> (String, SE Sig2)+mixSam :: Text -> Bpm -> Sam -> (Text, SE Sig2) mixSam name bpm sam = (name, runSam bpm sam)  -- | Creates fx-unit from sampler widget. -- -- > uisam name isOn bpm samWidget-uiSam :: String -> Bool -> Sig -> Source Sam -> Source Fx2+uiSam :: Text -> Bool -> Sig -> Source Sam -> Source Fx2 uiSam name onOff bpm sam = uiSig name onOff (joinSource $ mapSource (runSam bpm) sam)  -- | Adds gain slider on top of the widget.