1--- 2title: Pattern Effects 3layout: ../../layouts/MainLayout.astro 4--- 5 6import { MiniRepl } from '@src/docs/MiniRepl'; 7import Box from '@components/Box.astro'; 8import QA from '@components/QA'; 9 10# Pattern Effects 11 12Up until now, most of the functions we've seen are what other music programs are typically capable of: sequencing sounds, playing notes, controlling effects. 13 14In this chapter, we are going to look at functions that are more unique to tidal. 15 16**reverse patterns with rev** 17 18<MiniRepl client:visible tune={`n("0 1 [4 3] 2 0 2 [~ 3] 4").sound("jazz").rev()`} /> 19 20**play pattern left and modify it right with jux** 21 22<MiniRepl client:visible tune={`n("0 1 [4 3] 2 0 2 [~ 3] 4").sound("jazz").jux(rev)`} /> 23 24This is the same as: 25 26<MiniRepl 27 client:visible 28 tune={`$: n("0 1 [4 3] 2 0 2 [~ 3] 4").sound("jazz").pan(0) 29$: n("0 1 [4 3] 2 0 2 [~ 3] 4").sound("jazz").pan(1).rev()`} 30/> 31 32Let's visualize what happens here: 33 34<MiniRepl 35 client:visible 36 tune={`$: n("0 1 [4 3] 2 0 2 [~ 3] 4").sound("jazz").pan(0).color("cyan") 37$: n("0 1 [4 3] 2 0 2 [~ 3] 4").sound("jazz").pan(1).color("magenta").rev()`} 38 punchcard 39/> 40 41<Box> 42 43Try commenting out one of the two by adding `//` before a line 44 45</Box> 46 47**multiple tempos** 48 49<MiniRepl client:visible tune={`note("c2, eb3 g3 [bb3 c4]").sound("piano").slow("0.5,1,1.5")`} /> 50 51This is like doing 52 53<MiniRepl 54 client:visible 55 tune={`$: note("c2, eb3 g3 [bb3 c4]").s("piano").slow(0.5).color('cyan') 56$: note("c2, eb3 g3 [bb3 c4]").s("piano").slow(1).color('magenta') 57$: note("c2, eb3 g3 [bb3 c4]").s("piano").slow(1.5).color('yellow')`} 58 punchcard 59/> 60 61<Box> 62 63Try commenting out one or more by adding `//` before a line 64 65</Box> 66 67**add** 68 69<MiniRepl 70 client:visible 71 tune={`setcpm(60) 72note("c2 [eb3,g3] ".add("<0 <1 -1>>")) 73.color("<cyan <magenta yellow>>").adsr("[.1 0]:.2:[1 0]") 74.sound("gm_acoustic_bass").room(.5)`} 75 punchcard 76/> 77 78<Box> 79 80If you add a number to a note, the note will be treated as if it was a number 81 82</Box> 83 84We can add as often as we like: 85 86<MiniRepl 87 client:visible 88 tune={`setcpm(60) 89note("c2 [eb3,g3]".add("<0 <1 -1>>").add("0,7")) 90.color("<cyan <magenta yellow>>").adsr("[.1 0]:.2:[1 0]") 91.sound("gm_acoustic_bass").room(.5)`} 92 punchcard 93/> 94 95**add with scale** 96 97<MiniRepl 98 client:visible 99 tune={`n("0 [2 4] <3 5> [~ <4 1>]".add("<0 [0,2,4]>")) 100.scale("C5:minor").release(.5) 101.sound("gm_xylophone").room(.5)`} 102 punchcard 103/> 104 105**time to stack** 106 107<MiniRepl 108 client:visible 109 tune={`$: n("0 [2 4] <3 5> [~ <4 1>]".add("<0 [0,2,4]>")) 110 .scale("C5:minor") 111 .sound("gm_xylophone") 112 .room(.4).delay(.125) 113$: note("c2 [eb3,g3]".add("<0 <1 -1>>")) 114 .adsr("[.1 0]:.2:[1 0]") 115 .sound("gm_acoustic_bass") 116 .room(.5) 117$: n("0 1 [2 3] 2").sound("jazz").jux(rev)`} 118/> 119 120**ply** 121 122<MiniRepl client:visible tune={`sound("hh hh, bd rim [~ cp] rim").bank("RolandTR707").ply(2)`} punchcard /> 123 124this is like writing: 125 126<MiniRepl client:visible tune={`sound("hh*2 hh*2, bd*2 rim*2 [~ cp*2] rim*2").bank("RolandTR707")`} punchcard /> 127 128<Box> 129 130Try patterning the `ply` function, for example using `"<1 2 1 3>"` 131 132</Box> 133 134**off** 135 136<MiniRepl 137 client:visible 138 tune={`n("0 [4 <3 2>] <2 3> [~ 1]" 139 .off(1/16, x=>x.add(4)) 140 //.off(1/8, x=>x.add(7)) 141).scale("<C5:minor Db5:mixolydian>/2") 142.s("triangle").room(.5).dec(.1)`} 143 punchcard 144/> 145 146<Box> 147 148In the notation `.off(1/16, x=>x.add(4))`, says: 149 150- take the original pattern named as `x` 151- modify `x` with `.add(4)`, and 152- play it offset to the original pattern by `1/16` of a cycle. 153 154</Box> 155 156off is also useful for modifying other sounds, and can even be nested: 157 158<MiniRepl 159 client:visible 160 tune={`s("bd sd [rim bd] sd,[~ hh]*4").bank("CasioRZ1") 161 .off(2/16, x=>x.speed(1.5).gain(.25) 162 .off(3/16, y=>y.vowel("<a e i o>*8")))`} 163/> 164 165| name | description | example | 166| ---- | ------------------------------ | ------------------------------------------------------------------------------------------- | 167| rev | reverse | <MiniRepl client:visible tune={`n("0 2 4 6 ~ 7 9 5").scale("C:minor").rev()`} /> | 168| jux | split left/right, modify right | <MiniRepl client:visible tune={`n("0 2 4 6 ~ 7 9 5").scale("C:minor").jux(rev)`} /> | 169| add | add numbers / notes | <MiniRepl client:visible tune={`n("0 2 4 6 ~ 7 9 5".add("<0 1 2 1>")).scale("C:minor")`} /> | 170| ply | speed up each event n times | <MiniRepl client:visible tune={`s("bd sd [~ bd] sd").ply("<1 2 3>")`} /> | 171| off | copy, shift time & modify | <MiniRepl client:visible tune={`s("bd sd [~ bd] sd, hh*8").off(1/16, x=>x.speed(2))`} /> |