-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the modal! This page documents some design process, syntax difference with tidal/strudel and (maybe) new features.
modal aimed to be both a lua library that looks alot like strudel:
d1(every("<3 4>", "x -> x |+ 7", note"[0 3 7]")
note"0 7":every(4, "|+ note 1"):d1()
and thanks to the amazing and powerful lpeg library, modal also support the maxi notation, discussed here: https://github.com/tidalcycles/strudel/discussions/96
this is under active construction
d1 $ every <3 4> (|+ note 7) note [0 4 7] -- TODO
In lua, most strings that passed into where should be a Pattern are always patternified:
d1(s"bd")
d2(note"0 .. 7":s"piano")
modal supports:
- Tidal style custom operators.
- Mini-notation that need no quotes.
-
Quoting
for strings to embed named pattern into mini-notation
d1 $ s bd
d2 $ note [0 .. 7] |> s piano
a = cp
d3 $ s [bd ^a ^a] // -> [bd cp cp]
In lua, most library functions support both strudel style method calling and tidal style function calling:
euclid(3, 8, 1, s"bd")
s"bd":euclid(3, 8, 1)
In modal, method calling does not make sense, also, currying the method calls make no sense as well.
In both case, the tidal style functions are smartly curried like in haskell, meaning you can do partial application easily like in Tidal
off(0.25, euclid(3,8,1), s"bd")
off 0.25 (euclid 3 8 1) s bd
-- OO-style method chaining
id = function(a)
return a:fast(2):slow(2)
end
-- functional style piping
id = pipe(fast(2), slow(2))
TODO
id = fast 2 . slow 2
declare reusable patterns and sample names is especially easy in this environment
a = 1 -- only with global vars
reify"^a 2 3" --> [1 2 3]
ff = "bd!4"
reify"^ff, ~ sd ~ sd" --> [bd [bd sd] bd [bd sd]]
bd = 808bd
reify"^bd sd"
a = 1
[^a 2 3]
ff = [bd!4]
[^ff, ~ sd ~ sd]
bd = 808bd
[^bd sd]
- pattern of functions(tranformations)
every 4 [(fast 2) rev] $ note 1
this is not possibe for current haskell implementation where every's second param is just a function, but might be possible just by fully patternify???
this might just be like a good syntax arround spread
?
- lib pats && auto sample name swap
// M.fonf = reify("bd sd bd sd") -- libaray patterns
> bd = 808bd
> fonf = 808bd sd 808 bd