diff --git a/Solkattu/Dsl/Bol.hs b/Solkattu/Dsl/Bol.hs index e25e03f6f..60c9626d8 100644 --- a/Solkattu/Dsl/Bol.hs +++ b/Solkattu/Dsl/Bol.hs @@ -225,32 +225,31 @@ _tablaStrokes naKinar = map (second (mconcatMap Realize.strokeToSequence)) $ , ("kitetaka", [ka, tet, te, ka]) -- , ("takaterekita", [te, ka, tet, te, ka, tet, te, ka]) , ("taka", [te, ka]) -- TODO works for taka terekita and terekita taka - , ("dhen", [ge & tun]) - , ("ghen", [ge]) - , ("ten", [tun]) , ("dhennegene", [ge & tun, nhe, ge, ne]) , ("tennekene", [tun, nhe, ka, ne]) , ("dhenne", [ge & tun, ne]) , ("taran ne", [tun, daya Tabla.Ran, ne]) -- play on rim when followed by ne , ("taran", [daya Tabla.Tu3, tun]) -- otherwise play in middle , (dhaS, [ge & tin]) - , ("dhet", [ge & tette]) - , ("dhin", [ge & tin]) - , ("dhi", [ge & tun]) - , ("kre", [ka &+ tet]) - , ("kran", [ka &+ na]) ] ++ case naKinar of Kinar -> [(bol, [stroke]) | (bol, stroke, _) <- onKinarSur] Sur -> [(bol, [stroke]) | (bol, _, stroke) <- onKinarSur] ++ map (second (:[])) -- direct bol -> stroke correspondence [ ("di", tun) + , ("dhen", ge & tun) + , ("dhet", ge & tette) + , ("dhi", ge & tun) + , ("dhin", ge & tin) , ("din", tin) , ("ga", ge) , ("ge", ge) + , ("ghen", ge) , ("ka", ka) , ("kat", ka) , ("ke", ka) , ("ki", ka) + , ("kran", ka &+ na) + , ("kre", ka &+ tet) , ("na", na) , ("ne", ne) , ("ran", daya Tabla.Ran) @@ -259,6 +258,7 @@ _tablaStrokes naKinar = map (second (mconcatMap Realize.strokeToSequence)) $ , ("ta", tet) , ("tak", daya Tabla.Tak) , ("te", te) + , ("ten", tun) , ("tet", tet) , ("the", the) , ("ti", daya Tabla.Ti) @@ -270,8 +270,8 @@ _tablaStrokes naKinar = map (second (mconcatMap Realize.strokeToSequence)) $ ] where onKinarSur = - [ ("dha", ge & na, ge & tin) - , ("taa", na, tin) -- kali of dha + [ ("dha", ge & na, ge & tin) + , ("taa", na, tin) -- kali of dha ] -- Even though I do define (&) for Sequence, I use single strokes here, -- it should wind up the same but is simpler types. diff --git a/Solkattu/Dsl/Misc.hs b/Solkattu/Dsl/Misc.hs index a7a6badf5..5ef274ad1 100644 --- a/Solkattu/Dsl/Misc.hs +++ b/Solkattu/Dsl/Misc.hs @@ -3,7 +3,7 @@ -- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt -- | Miscellaneous general purpose functions. -module Solkattu.Dsl.Misc where +module Solkattu.Dsl.Misc (replaceAt) where import qualified Util.Lists as Lists diff --git a/Solkattu/Dsl/Notation.hs b/Solkattu/Dsl/Notation.hs index 62923b9b9..49b594494 100644 --- a/Solkattu/Dsl/Notation.hs +++ b/Solkattu/Dsl/Notation.hs @@ -2,6 +2,7 @@ -- This program is distributed under the terms of the GNU General Public -- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt +{-# LANGUAGE CPP #-} -- TODO otherwise ghc >=8.4.1 complains about extra Semigroup -- Remove when I can drop 8.0.2 compatibility. {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -12,7 +13,69 @@ This is meant to have just Sequence manipulation, without instrument-specific functions. -} -module Solkattu.Dsl.Notation where +module Solkattu.Dsl.Notation ( + SequenceT + , __, __2, __3, __4, __5, __6, __7, __8, __9 + , __n, __D, __M + , sarvaM, sarvaD, sarvaM_, sarvaD_ + , dropM, dropM_ + , takeM + , splitM, splitM_ + , rdropM, rdropM_ + , rtakeM + , spaceM + -- * by Duration + , restD, spaceD + , dropD, rdropD, takeD, rtakeD + -- * structures + , sandi + , tri, tri_, tri_nomid, tri123 + , trin, tri2, tri2g + , tsep + -- * sequences + , repeat, r2, r3, r4, r5, r6, r7, r8 + , join + , inter + , spread + , cmap + , for + , prefixes, suffixes + , circum, suffix, prefix + , accumulate + -- * reduction, expansion + , reduce3, reduceBy + , reduceTo, reduceToL, reduceToR + , expand + , replaceStart, replaceEnd + , (<==), (==>) + -- * measurement + , matrasOf + , matrasOfI + -- * generic notation + , speed, su, sd, su2, sd2 + , nadai + , stride + -- * groups + , group, g + , pattern + , reduction + , named, namedT + , checkD + -- * tags + , (^), mid + -- * align + , __sam + , __a + , sarvaSam, sarvaA, sarvaA_ + -- * complex transformation + , in3 + , appendEach + -- * merge + , merge +#ifdef TESTING + , splitM_either +#endif +) where import Prelude hiding ((^), repeat) import qualified Data.List as List import GHC.Stack (HasCallStack) @@ -296,9 +359,6 @@ cmap = mconcatMap for :: [a] -> (a -> b) -> [b] for = flip map -cfor :: Monoid b => [a] -> (a -> b) -> b -cfor xs f = mconcatMap f xs - -- | Multiple prefixes on a single suffix. prefixes :: (Semigroup a, Monoid a) => [a] -> a -> a prefixes prefs suffix = mconcatMap (<>suffix) prefs @@ -391,10 +451,6 @@ matrasOfI seq (matras, frac) = properFraction fmatras fmatras = matrasOf seq --- | I think defaultTempo is ok because these functions are used on fragments. -matraDuration :: S.Duration -matraDuration = S.matraDuration S.defaultTempo - dToM :: Duration -> FMatra dToM d = realToFrac $ d / S.matraDuration S.defaultTempo