forked from frantic0/tidal-workshop
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path#advanced.tidal#
503 lines (347 loc) · 12.7 KB
/
#advanced.tidal#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
d1 $ sound "bd sn"
# cps "<2 1 4>"
{- _ _ _ _ _ _
__ _ __| |_ ____ _ _ __ ___ ___ __| | | |_(_) __| | __ _| |
/ _` |/ _` \ \ / / _` | '_ \ / __/ _ \/ _` | | __| |/ _` |/ _` | |
| (_| | (_| |\ V / (_| | | | | (_| __/ (_| | | |_| | (_| | (_| | |
\__,_|\__,_| \_/ \__,_|_| |_|\___\___|\__,_| \__|_|\__,_|\__,_|_|
Upgrade English Tokyo
13:00 - 15:00 - part 1
15:20 - 18:00 - part 2
17th Nov 2018
-}
hello konichiwa!
-- Some extra samples I might use:
-- http://slab.org/tmp/extra-samples.zip
-- You can put them in the Dirt-Samples folder
-- (in Supercollider, File -> Open user support directory >
-- downloaded-quarks > Dirt-Samples)
{-
Topics:
1. Userbase wiki [x]
2. Understanding syntax and type signatures
(Heavy topic)
3. Some under-documented tidal features and functions
Lets go through the examples below
4. Composing with ur
5. Orbits
For multichannel sound, taming global effects (e.g. reverb), routing patterns
to different DAW channels
6. Upcoming features in tidal 1.0.0 !!
Please refer to the userbase docs:
https://userbase.tidalcycles.org/index.php/Main_Page#TidalCycles_version_1.0.0.2B
- 6a controlling patterns with external MIDI controllers
- 6b flexible structural control
-}
-- cps is now a control!
d1 $ (chop 16 $ sound "drum:2 drum")
# cps (slow 8 $ sine + 1)
d1 $ sound "bd sn" # speed "1 2 3"
-- # is an alias for |>
d1 $ sound "bd sn" |> speed "1 2 3"
-- |> means structure comes from the left
d1 $ sound "bd sn" |> speed "1 2 3"
-- >| means structure comes from the right
d1 $ sound "bd sn" >| speed "1 2 3"
-- The '>' points to where the values come from
-- this gives speed of "3 4 5"
d1 $ speed "1 2" >| speed "3 4 5" # sound "bd sn"
-- structure from left, values from right
d1 $ speed "1 2" |> speed "3 4 5" # sound "bd sn"
-- structure from right, values from left
d1 $ speed "1 2" <| speed "3 4 5" # sound "bd sn"
-- We can also take structure from both sides
d1 $ speed "2 3" |+| speed "4 5 6" # sound "bd sn"
-- This is the same
d1 $ speed "2 3" + speed "4 5 6" # sound "bd sn"
d1 $ speed ("2 3" + "4 5 6") # sound "bd sn"
"2 3" + "4 5 6" = "6 [7 8] 9"
d1 $ n ("2 3" + "4 5 6") + s "bd sn"
d1 $ sound "bd [sn clap]" |>| speed "2 3 <2 3>"
|+| speed "1 2 0.5*3" |* speed (slow 8 sine)
-- remove the d1 $ to print out
-- the events:
n ("2 3" + "4 5 6") + s "bd sn"
(0>⅓)|n: 6.0f, s: "bd"
(⅓>½)|n: 7.0f, s: "bd"
(½>⅔)|n: 8.0f, s: "sn"
(⅔>1)|n: 9.0f, s: "sn"
--
{-
- 6c flexible tempo control (cps patterns)
- 6d innards of the refactor - https://github.com/tidalcycles/Tidal/projects/2
7. Collaboration, e.g. through the multi-user troop editor
Please use version 0.7.5 for this:
https://github.com/Qirky/Troop/releases/tag/v0.7.5
8. Controlling MIDI synths
Requires pure-data 'vanilla'
https://puredata.info/downloads
Running this patch:
https://raw.githubusercontent.com/tidalcycles/Tidal/master/pd/midi-osc-bridge.pd
9. Feedforward
Might be tricky to get working !
https://github.com/yaxu/feedforward
10. Performing with tidal
- snippets - https://flight-manual.atom.io/using-atom/sections/snippets/
11. Something else?
-}
-- ** Some (maybe) underappreciated functions **
-- * (almost) everything is a pattern
d1 $ fast ("1 [2 4]") $ sound "bd*8" # speed 2
d1 $ fast (iter 4 "1 [2 4]") $ sound "bd*8" # speed 2
d1 $ fast (iter "<4 3>" "1 [2 4]") $ sound "bd*8" # speed 2
d1 $ every "[3 4]" (fast 2) $ sound "bd*8"
d1 $ sound "<bd clap> sn:2" # speed "<1 2 3>"
:t fast
fast :: Pattern Time -> Pattern a -> Pattern a
d1 $ fast "<1 0.5>" $ sound "cp sn:2"
# speed 1.5 # crush 3
-- * Compress different patterns into different parts of cycle
-- compress into the first half - from the start (0) to halfway (1/2):
d1 $ compress (0,1/3) $ sound "bd*4"
d2 $ compress (1/3,1) $ sound "clap*4" # speed (sine + 1)
-- compress into the last quarter
d2 $ compress (0.75,1) $ sound "bd*8"
d2 $ slow 2 $ stack [compress (0,1/3) $ iter 4 $ n "0 .. 3" # sound "sn:3" # legato 1 # speed 1,
compress (1/3,1) $ fast "<1 0.5>" $ sound "cp:4(3,8) cp:2*2"
# speed 1.5 # crush 3
]
xfade "1" $ fast 2 $ sound "snare(3,8,5)"
d2 $ sound "cp(3,8)"
-- * Repeat random values
d4 $ struct "x*8?" $ sound "kicklinn"
d4 $ repeatCycles 4 $ struct "x*8?" $ sound "arpy" +| note (irand 16)
d4 $ loopFirst $ struct "x*8?" $ sound "kicklinn" # speed 2 # room 0.1 # sz 0.5
-- * wchoose
wchoose :: [(a, Double)] -> Pattern a
-- chooses equally between the given numbers
d1 $ sound "supermandolin*8" # n (
choose [0,5,7,12]
) # gain 1.2 # legato 2
-- you can give weights with 'wchoose'
d1 $ sound "supermandolin*8" # n (
wchoose [(0,0.1),(5,0.1),(7,0.1),(12,0.7)]
) # gain 1.2 # legato 2
-- be careful with random streams - they have no structure so are played at
-- calculation rate
d1 $ sound (choose ["bd","snare"]) # gain 1.2 # legato 2
-- samples the pattern at the given rate
d1 $ sound (discretise 8 $ choose ["bd","snare"]) # gain 1.2 # legato 2
-- struct gives structure (the value 'x' isn't used, but its structure is)
d1 $ sound (struct "okonomiyaki(3,8) sushi*2" $ choose ["bd","snare"]) # gain 1.2 # legato 2
-- * scan
d1 $ n (scan 8) # sound "drum" # speed 2
d1 $ n (scan 8) # sound "drum" # speed 2
d1 $ jux (rev . (4.25 <~)) $ n (scan 8) # sound "sn" # speed 2
-- run is kind of similar, run just counts up every cycle though (boring)
d1 $ n (run 8) # sound "drum"
-- the same as run:
d1 $ n ("0 .. 7") # sound "drum"
1: 0
2: 0 1
3: 0 1 2
4: 0 1 2 3
-- * fit
-- fit has three parameters
-- a number - how far to move through the list per cycle
-- a list of values
-- a pattern of numbers
d1 $ n (fit 3 [0,1,2,3,4,5] "0 [1 3]") # sound "drum"
d2 $ n (fit 3 [0,3,4,5,6] "0 ~ 2 3") # sound "arpy"
-- More complex examples of fit
d1 $ slow 2 $ n (fit 2 [0,1,2,3] "0 1 0 1") # s "alphabet"
d1 $ slow 2 $ n (fit 2 [0,1,2,3,4] "0 1 0 [1 4]") # s "arpy"
d2 $ off 0.125 (|+ n 12)
$ off 0.25 (|+ n 7) $ jux rev
$ n (fit 3 [0,5,7,24] "0(3,8) 2*2 [~ 4] 3 ") # sound "supermandolin"
# lpf (slow 4 $ scale 1000 2000 sine)
# lpq 0.2 # legato 4 # room 0.3 # sz 0.3 # gain 1.2
d1 $ n (fit 3 [0,2,7,24] "0 [1 0] [~ 3] 1" )
# s "supermandolin" # legato 2 |-| n 12
# lpf (sine * 5000 + 800)
# lpq 0.2
d1 $ jux ((|+| n 12) . rev) $ off 0.25 ((# s "superpiano") . arpg . struct "x(3,8)")
$ n (off (1/16) (+12) $ off 0.125 (+7) $ fit 3 [0,5,7,24] "0 [1 0] [~ 3] 1" )
# s "supermandolin" # legato 1 |-| n 12
d1 $ off 0.25 ((|+ n 24) .(# (s "supermandolin" # gain 0.9 # legato 0.5))) $ jux rev $ n (off 0.125 (+12) $ off 0.25 (+7) $ palindrome $ fit 3 [0,2,7,12] "0 [~ 1] 1 [~ 3]") # s "supermandolin"
# lpf (sine * 3000 + 3000)
# lpq 0.2
# legato 2
|*| speed 1.5
d1 $ n (off "<0.25 0.5>" (+12)
$ off 0.125 (+7) "<c(3,8) e(3,8,2) f(3,8,4) g*2>")
# sound "superpiano"
d1 $ sound "drum(<3 5>,8,<0 2>)"
do d1 $ sound "bd sn"
d2 $ sound "clap"
-- how to define aliases (functions) as you go
let scratch p = jux (rev . hurry "<1 2 8>" . chop 8) p
faster = fast 2
higher = speed 2
in
d1 $ scratch $ faster $ sound "bd sd(3,8)" # higher
-- * slice
-- Give it a pattern of slice numbers, an the number of slices (I will
-- probably reverse these parameters in 1.0.0!)
d1 $ loopAt 2 $ slice ("[0 1?] <2*3 3*2> <4*2> 7") 8 $ sound "arc"
# legato 1
d3 $ jux rev $ loopAt 2 $ slice "0 <3 4*4> 2 4*8 5 2*4 4 7*2" 8 $ sound "arc" # gain 1.3
# legato 1
-- linger
d1 $ every 4 (linger (1/2)) $ iter 4 $ n "0 .. 7" # sound "sn"
# legato 1
# speed 1
-- off
-- * ply
-- ply repeats each event
d1 $ ply 2 $ sound "bd ~ sn:2" # speed 2
d1 $ ply "<2 3 4>" $ sound "bd ~ sn:2" # speed 2
d1 $ every 2 (ply "<2 3 4>") $ sound "bd ~ sn:2" # speed 2
d1 $ every 4 (ply 2) $ slow 2 $ n "0 .. 7" # sound "drum"
# legato 1
# speed 0.5
-- * sew
-- sew takes a pattern of true/false values, and two sound patterns, e.g.:
-- t == take events from the first pattern
-- f == take events from the second pattern
d1 $ sew "t f" (sound "bd*8") (sound "cp*8")
d1 $ sew "t f" (sound "bd*8") (sound "cp*8" # speed (slow 4 $ sine + 1))
d1 $ sew (slow 2 "[t f] f")
(sound "bd*8")
(sound "cp*8" # speed (slow 4 $ sine + 1))
d1 $ iter 4 $ sew (iter 4 "[t f] <f [t f]>")
(sound "bd:4*8")
(sound "snare:4(3,8)" # speed 1.5)
-- * spaceOut
d1 $ spaceOut [1,2,0.5] $ sound "bd*2 hc:3"
-- * stripe
d1 $ stripe 2 $ sound "bd mt lt ~" # speed 2
:t stripe
-- * superimpose
d1 $ someCycles (jux rev . (# speed 2))
$ every 2 (superimpose (hurry 4 . rev)) $ sound "bd [sn:2 cp:4]"
-- * within
-- within applies a function within part of each cycle
d1 $ within (0,0.5) (# crush 4) $ sound "bd*4"
d1 $ within (0,0.5) (hurry 2) $ sound "bd sd:2 cp sn:3"
d1 $ within (0,0.5) (# crush 4) $ someCycles (jux rev . (# speed 2))
$ every 2 (superimpose (hurry 4 . rev)) $ sound "bd [sn:2 cp:4]"
-- * stut
d1 $ stut 32 0.5 0.25 $ sound "bd cp:4 bd(3,8) cp:4"
# legato 1
d1 $ stut 4 0.5 (toRational <$> sine * 0.4 + 0.04) $ sound "bd cp:4 bd(3,8) cp:4"
:t palindrome
d1 $ jux rev $ iter 4 $ stut 16 0.5 (toRational <$> sine * 0.4 + 0.04) $ sound "bd cp:4 bd(3,8) cp:4"
# legato 1
-- * Composing with ur
-- `ur` is for composing patterns of patterns. you tell it the number
-- of cycles the pattern will be, then give a pattern of pattern names
-- (that's stretched out over the given number of cycles, but
-- _without_ stretching out the patterns inside it), and then a list
-- of named patterns.. plus a list of named pattern transformations
-- that you can apply with.
hush
let pats =
[
("a", stack [n "c4 c5 g4 f4 f5 g4 e5 g4" # s "superpiano" # gain "0.7",
n "[c3,g4,c4]" # s "superpiano"# gain "0.7"
]
),
("b", stack [n "d4 c5 g4 f4 f5 g4 e5 g4" # s "superpiano" # gain "0.7",
n "[d3,a4,d4]" # s "superpiano"# gain "0.7"
]
),
("c", stack [n "f4 c5 g4 f4 f5 g4 e5 g4" # s "superpiano" # gain "0.7",
n "[f4,c5,f4]" # s "superpiano"# gain "0.7"
]
)
]
fx = [("rev", (# (room 0.8 # sz 0.99 # orbit 1))),
("faster", fast 2)
]
in
d1 $ ur 12 "a b:rev c:faster" pats fx
let pats = [("drums", s "drum clap*2"),
("melody", s "arpy:2 arpy:3 arpy:5"),
("craziness", s "clap:4*8" # speed ( sine + 0.5))
]
fx = [("higher", (# speed 2))]
in
d1 $ ur 8 "[drums, melody] [drums,craziness,melody] melody:higher" pats fx
-- type signatures
d1 $ every 4 (fast 2) $ sound "bd sn"
:t fast
fast :: Pattern Time -> Pattern a -> Pattern a
:t fast 2
fast 2 :: Pattern a -> Pattern a
:t every
every :: Pattern Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
:t (s "bd*8")
(s "bd*8") :: ControlPattern
$ -- joining a function with a single parameter/value
d1 $ sound "bd sn" -- we usually do this
d1 (sound "bd sn") -- this works
d1 sound "bd sn" -- doesn't work!
:t d1
d1 :: ControlPattern -> IO ()
:t ($)
($) :: (a -> b) -> a -> b
# -- joining together/combining patterns
d1 $ (sound "bd snare") # (speed 2)
d1 $ (speed "[2 4 3 2 6 4 3 2, 0.5 0.75]")
# (sound "bd snare clap")
d1 $ speed "1 2 3" |*| speed "2" # s "arpy"
. -- joining together functions
d1 $ every 2 rev $ every 2 (fast 2) $ sound "bd sn:2"
d1 $ every 2 (rev . chop 8 . fast 4) $ sound "bd sn:2"
-- this doesn't work !
-- $ only works with the last parameter
d1 $ every 2 $ rev . chop 8 . fast 4 $ sound "bd sn:2"
d1 $ every 2 (rev . chop 8 . fast 4) $ sound "bd sn:2"
:t fast 4
:t chop 8
:t rev
d1 $ off 0.25 (|* speed 2) $ sound "gabba(3,8)"
once $ (chop 16 $ s "airhorn") # speed sine
:t select
d2 $ select (cF 0 "24")
[sound "snare clap",
jux rev $ chop 8 $ sound "bd snare cp",
jux rev $ chop 8 $ sound "arpy arpy:3" # speed 2
]
d1 $ sound "clap" # speed (cF 2 "33")
d1 $ (fast (cT 1 "22" * 8)) $ sound "bd" # speed (scale 1 2 $ cF 1 "21")
# cps (cF 1 "23" * 2)
d1 $ sound "volcafm"
d2 $ sound "cp"
d1 $ stack [off 0.25 (|+| n 7) $ n "c*2 a f e(3,8)",
discretise 16 $ ccv (slow 4 $ sine * 32)
# ccn "42"
] # sound "volcafm"
-- Orbits
d1 $ sound "bd sn:2"
# orbit 0
d2 $ sound "arpy*8"
# room 0.4 # sz saw
# orbit 1
hush
d1 $ sound "bd sn:2"
d2 $ sound "cp"
d1 $ (n "<0 1 2 3>" # sound "alphabet")
cps (-1)
cps (1.1)
:t juxBy
d1 $ fix ( fast 2 ) (pF "cc64" 1)
$ fix ( # crush 4 ) (pF "cc65" 1)
-- $ fix ( stut' 4 (0.125/4) ( + up "1" )) (pF "cc66" 1)
$ fix ( |*| speed "-1" ) (pF "cc67" 1)
$ fix ( (# delaytime 0.125).(# delay 0.5)) (pF "cc68" 1)
$ fix ( # coarse 12) (pF "cc69" 1)
$ s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
# pF "cc69" (cF 0 "69")
d1 $ sound "bd*8"