1--- 2title: Pattern-Effekte 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-Effekte 11 12Bis jetzt sind die meisten Funktionen, die wir kennengelernt haben, ähnlich wie Funktionen in anderen Musik Programmen: Sequencing von Sounds, Noten und Effekten. 13 14In diesem Kapitel beschäftigen wir uns mit Funktionen die weniger herkömmlich oder auch einzigartig sind. 15 16**rev = rückwärts abspielen** 17 18<MiniRepl client:visible tune={`n("0 1 [4 3] 2").sound("jazz").rev()`} /> 19 20**jux = einen stereo kanal modifizieren** 21 22<MiniRepl client:visible tune={`n("0 1 [4 3] 2").sound("jazz").jux(rev)`} /> 23 24So würde man das ohne `jux` schreiben: 25 26<MiniRepl 27 client:visible 28 tune={`stack( 29 n("0 1 [4 3] 2").sound("jazz").pan(0), 30 n("0 1 [4 3] 2").sound("jazz").pan(1).rev() 31)`} 32/> 33 34Lass uns visualisieren, was hier passiert: 35 36<MiniRepl 37 client:visible 38 tune={`stack( 39 n("0 1 [4 3] 2").sound("jazz").pan(0).color("cyan"), 40 n("0 1 [4 3] 2").sound("jazz").pan(1).color("magenta").rev() 41)`} 42 punchcard 43/> 44 45<Box> 46 47Schreibe `//` vor eine der beiden Zeilen im `stack`! 48 49</Box> 50 51**mehrere tempos** 52 53<MiniRepl client:visible tune={`note("c2, eb3 g3 [bb3 c4]").sound("piano").slow("1,2,3")`} /> 54 55Das hat den gleichen Effekt, wie: 56 57<MiniRepl 58 client:visible 59 tune={`stack( 60 note("c2, eb3 g3 [bb3 c4]").s("piano").slow(1).color('cyan'), 61 note("c2, eb3 g3 [bb3 c4]").s("piano").slow(2).color('magenta'), 62 note("c2, eb3 g3 [bb3 c4]").s("piano").slow(3).color('yellow') 63)`} 64 punchcard 65/> 66 67<Box> 68 69Schreibe wieder `//` vor eine oder mehrere Zeilen im `stack`. 70 71</Box> 72 73**add = addieren** 74 75<MiniRepl 76 client:visible 77 tune={`note("c2 [eb3,g3]".add("<0 <1 -1>>")) 78.color("<cyan <magenta yellow>>").adsr("[.1 0]:.2:[1 0]") 79.sound("gm_acoustic_bass").room(.5)`} 80 punchcard 81/> 82 83<Box> 84 85Addiert man eine Zahl zu einer Note, verhält sich diese wie eine Zahl. 86 87z.B. c4 = 60, also ist c4 + 2 = 62 88 89</Box> 90 91Man kann auch mehrmals addieren: 92 93<MiniRepl 94 client:visible 95 tune={`note("c2 [eb3,g3]".add("<0 <1 -1>>").add("0,7")) 96.color("<cyan <magenta yellow>>").adsr("[.1 0]:.2:[1 0]") 97.sound("gm_acoustic_bass").room(.5)`} 98 punchcard 99/> 100 101**add + scale** 102 103<MiniRepl 104 client:visible 105 tune={`n("<0 [2 4] <3 5> [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) 106.scale("C5:minor").release(.5) 107.sound("gm_xylophone").room(.5)`} 108 punchcard 109/> 110 111**Alles zusammen** 112 113<MiniRepl 114 client:visible 115 tune={`stack( 116 n("<0 [2 4] <3 5> [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) 117 .scale("C5:minor") 118 .sound("gm_xylophone") 119 .room(.4).delay(.125), 120 note("c2 [eb3,g3]".add("<0 <1 -1>>")) 121 .adsr("[.1 0]:.2:[1 0]") 122 .sound("gm_acoustic_bass") 123 .room(.5), 124 n("0 1 [2 3] 2").sound("jazz").jux(rev).slow(2) 125)`} 126/> 127 128**ply** 129 130<MiniRepl client:visible tune={`sound("hh, bd rim").bank("RolandTR707").ply(2)`} punchcard /> 131 132das ist wie: 133 134<MiniRepl client:visible tune={`sound("hh*2, bd*2 rim*2").bank("RolandTR707")`} punchcard /> 135 136<Box> 137 138Probier `ply` mit einem pattern zu automatisieren, z.b. `"<1 2 1 3>"` 139 140</Box> 141 142**off** 143 144<MiniRepl 145 client:visible 146 tune={`n("<0 [4 <3 2>] <2 3> [~ 1]>" 147 .off(1/8, x=>x.add(4)) 148 //.off(1/4, x=>x.add(7)) 149).scale("<C5:minor Db5:mixolydian>/4") 150.s("triangle").room(.5).dec(.1).delay(.5)`} 151 punchcard 152/> 153 154<Box> 155 156In der Notation `x=>x.`, ist `x` das Pattern, das wir bearbeiten. 157 158</Box> 159 160`off` ist auch nützlich für Sounds: 161 162<MiniRepl 163 client:visible 164 tune={`s("bd sd,[~ hh]*2").bank("CasioRZ1") 165 .off(1/8, x=>x.speed(1.5).gain(.25))`} 166/> 167 168| Name | Beschreibung | Beispiel | 169| ---- | --------------------------------- | ----------------------------------------------------------------------------------- | 170| rev | rückwärts | <MiniRepl client:visible tune={`n("0 2 4 6").scale("C:minor").rev()`} /> | 171| jux | einen Stereo-Kanal modifizieren | <MiniRepl client:visible tune={`n("0 2 4 6").scale("C:minor").jux(rev)`} /> | 172| add | addiert Zahlen oder Noten | <MiniRepl client:visible tune={`n("0 2 4 6".add("<0 1 2 1>")).scale("C:minor")`} /> | 173| ply | multipliziert jedes Element x mal | <MiniRepl client:visible tune={`s("bd sd").ply("<1 2 3>")`} /> | 174| off | verzögert eine modifizierte Kopie | <MiniRepl client:visible tune={`s("bd sd, hh*4").off(1/8, x=>x.speed(2))`} /> |