-
Notifications
You must be signed in to change notification settings - Fork 0
Syntax
n451 edited this page Jul 22, 2024
·
7 revisions
modal aimed to be both a lua library that follows strudel syntax:
d1(every("<3 4>", "+ 7", note"[0 3 7]")
note"0 7":every(4, "+ 1"):d1()
and the maxi notation, discussed here: https://github.com/tidalcycles/strudel/discussions/96
d1 $ every <3 4> (|+ note 7) note [0 4 7]
-- 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
to be documented ... working on this
note(1):every(2, "+ [3, 7]")
-- TODO: tidal operators, neccessary???
note(1):every(2, "+| [3, 7]")
-- () is just like lisp lists
(fast 2 bd)
-- [(,) (|), (.)] is fastcat / timecat / stack / randcat
[bd sd]
[bd sd, ~ cp]
[bd sd . cp!3]
[bd|sd|cp] -- idea: should be fasted length times to diff with <1|2|3>
-- <(|)> is slowcat / arrange
<bd sd>
<bd|sd|cp> -- equivalent to [bd|sd|cp] ... bit weird
<bd sd . cp!3> -- slowcat { {bd sd} , {cp, cp, cp}}
-- {(,)}%x is polymeter
{bd sd cp, hh}%5
-- should be able to combine these dynamically
[bd <sd cp>]
[(run 8)/8 3 5 2]
[(irand 8)/8 3 5 3]
-- these work outside structures
bd-2
bd/2
bd?0.7
bd(3,8)
bd:2
-- 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?
[bd sd . sd] -- TODO
- dot method?
lpf sine.range(200, 2000)
- literal lists that translates to lua table
layer '((fast 2) rev) $ s [bd sd]
or more tidal likelayer (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
you can also pattern curried functions in higher order functions like every
> every 4 [(+ 1), (fast 2)] 1 -- > compile lua: every(4, stack { function(x) return x + 1 end, function(x) return fast(2, x) end }, 1)
-- 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
-- declare literals
a = 1
['a 2 3]
-- declare patterns
ff = [bd!4]
['ff, ~ sd ~ sd]
-- declare functions
fast2 = (fast 2)
inc1 = (+ 1)
off 0.25 [fast2, inc1] 1 --- not working for now...
-- declare sample names, later should not be necessary with autoswap
bd = 808bd
['bd sd]