Skip to content

Commit

Permalink
solkattu: export list for Solkattu.Dsl.Notation
Browse files Browse the repository at this point in the history
It's silly long, but all the others have one.
  • Loading branch information
Evan Laforge committed Feb 17, 2024
1 parent 5eff29c commit 94325d6
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 19 deletions.
20 changes: 10 additions & 10 deletions Solkattu/Dsl/Bol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Solkattu/Dsl/Misc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
72 changes: 64 additions & 8 deletions Solkattu/Dsl/Notation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 #-}
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 94325d6

Please sign in to comment.