-
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,
-- lua: strings mostly gets converted to pattern
d1(s"bd")
d2(note"0 .. 7":s"piano")
-- modal: no quotes needed!
d1 $ s bd
d2 $ note [0 .. 7] |> s piano
-- () is just like lisp lists
> (fast 2 bd)
-- [(,) (|)] is fastcat / timecat / stack / randcat
> [bd sd]
> [bd sd, ~ cp]
> [bd|sd|cp]
-- <(|)> is slowcat / arrange
> <bd sd>
> <bd|sd|cp>
-- {(,)}%x is polymeter
> {bd sd cp, hh}%5
-- should be able to combine these dynamically
> [bd <sd cp>]
> [(fast 2 bd) sd] -- not that useful?
-- these work outside structures
> bd*2
> bd/2
> bd?0.7
> bd(3,8)
> bd:2 -- parser works but params funcs not yet
-- these work inside all structures
> [bd!3 sd]
> <bd@3 sd>
> <0 .. 3> -- eq to <0 1 2 3> actually more sensible than tidal/strudel?
- dot method?
> lpf sine.range(200, 2000)
- literal lists that translates to lua table
> layer '((fast 2) rev) $ s [bd sd]
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