1--- 2title: First Effects 3layout: ../../layouts/MainLayout.astro 4--- 5 6import { MiniRepl } from '../../docs/MiniRepl'; 7import QA from '@components/QA'; 8 9# First Effects 10 11import Box from '@components/Box.astro'; 12 13We have sounds, we have notes, now let's look at effects! 14 15## Some basic effects 16 17**low-pass filter** 18 19<MiniRepl 20 client:visible 21 tune={`note("<[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>") 22.sound("sawtooth").lpf(800)`} 23/> 24 25<Box> 26 27lpf = **l**ow **p**ass **f**ilter 28 29- Change lpf to 200. Notice how it gets muffled. Think of it as standing in front of the club with the door closed 🚪. 30- Now let's open the door... change it to 5000. Notice how it gets brighter ✨🪩 31 32</Box> 33 34**pattern the filter** 35 36<MiniRepl 37 client:visible 38 tune={`note("<[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>") 39.sound("sawtooth").lpf("200 1000 200 1000")`} 40/> 41 42<Box> 43 44- Try adding more values 45- Notice how the pattern in lpf does not change the overall rhythm 46 47We will learn how to automate with waves later... 48 49</Box> 50 51**vowel** 52 53<MiniRepl 54 client:visible 55 tune={`note("<[c3,g3,e4] [bb2,f3,d4] [a2,f3,c4] [bb2,g3,eb4]>") 56.sound("sawtooth").vowel("<a e i o>")`} 57/> 58 59**gain** 60 61<MiniRepl 62 client:visible 63 tune={`$: sound("hh*16").gain("[.25 1]*4") 64 65$: sound("bd*4,[~ sd:1]*2")`} 66punchcard 67/> 68 69<Box> 70 71Rhythm is all about dynamics! 72 73- Remove `.gain(...)` and notice how flat it sounds. 74- Bring it back by undoing (ctrl+z) 75 76</Box> 77 78Let's combine all of the above into a little tune: 79 80<MiniRepl 81 client:visible 82 tune={`$: sound("hh*8").gain("[.25 1]*4") 83 84$: sound("bd*4,[~ sd:1]*2") 85 86$: note("<[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>") 87.sound("sawtooth").lpf("200 1000 200 1000") 88 89$: note("<[c3,g3,e4] [bb2,f3,d4] [a2,f3,c4] [bb2,g3,eb4]>") 90.sound("sawtooth").vowel("<a e i o>")`} 91/> 92 93**shape the sound with an adsr envelope** 94 95<MiniRepl 96 client:visible 97 tune={`note("c3 bb2 f3 eb3") 98.sound("sawtooth").lpf(600) 99.attack(.1) 100.decay(.1) 101.sustain(.25) 102.release(.2)`} 103/> 104 105<Box> 106 107Try to find out what the numbers do.. Compare the following 108 109- attack: `.5` vs `0` 110- decay: `.5` vs `0` 111- sustain: `1` vs `.25` vs `0` 112- release: `0` vs `.5` vs `1` 113 114Can you guess what they do? 115 116</Box> 117 118<QA q="Click to see solution" client:visible> 119 120- attack: time it takes to fade in 121- decay: time it takes to fade to sustain 122- sustain: level after decay 123- release: time it takes to fade out after note is finished 124 125 126 127</QA> 128 129**adsr short notation** 130 131<MiniRepl 132 client:visible 133 tune={`note("c3 bb2 f3 eb3") 134.sound("sawtooth").lpf(600) 135.adsr(".1:.1:.5:.2") 136`} 137/> 138 139**delay** 140 141<MiniRepl 142 client:visible 143 tune={`$: note("[~ [<[d3,a3,f4]!2 [d3,bb3,g4]!2> ~]]*2") 144 .sound("gm_electric_guitar_muted").delay(.5) 145 146$: sound("bd rim").bank("RolandTR707").delay(".5")`} 147/> 148 149<Box> 150 151Try some `delay` values between 0 and 1. Btw, `.5` is short for `0.5` 152 153What happens if you use `.delay(".8:.125")` ? Can you guess what the second number does? 154 155What happens if you use `.delay(".8:.06:.8")` ? Can you guess what the third number does? 156 157</Box> 158 159<QA q="Click to see solution" client:visible> 160 161`delay("a:b:c")`: 162 163- a: delay volume 164- b: delay time 165- c: feedback (smaller number = quicker fade) 166 167</QA> 168 169**room aka reverb** 170 171<MiniRepl 172 client:visible 173 tune={`n("<4 [3@3 4] [<2 0> ~@16] ~>") 174.scale("D4:minor").sound("gm_accordion:2") 175.room(2)`} 176/> 177 178<Box> 179 180Try different values! 181 182Add a delay too! 183 184</Box> 185 186**little dub tune** 187 188<MiniRepl 189 client:visible 190 tune={`$: note("[~ [<[d3,a3,f4]!2 [d3,bb3,g4]!2> ~]]*2") 191.sound("gm_electric_guitar_muted").delay(.5) 192 193$: sound("bd rim").bank("RolandTR707").delay(.5) 194 195$: n("<4 [3@3 4] [<2 0> ~@16] ~>") 196.scale("D4:minor").sound("gm_accordion:2") 197.room(2).gain(.5)`} 198/> 199 200Let's add a bass to make this complete: 201 202<MiniRepl 203 client:visible 204 tune={`$: note("[~ [<[d3,a3,f4]!2 [d3,bb3,g4]!2> ~]]*2") 205.sound("gm_electric_guitar_muted").delay(.5) 206 207$: sound("bd rim").bank("RolandTR707").delay(.5) 208 209$: n("<4 [3@3 4] [<2 0> ~@16] ~>") 210.scale("D4:minor").sound("gm_accordion:2") 211.room(2).gain(.4) 212 213$: n("[0 [~ 0] 4 [3 2] [0 ~] [0 ~] <0 2> ~]/2") 214.scale("D2:minor") 215.sound("sawtooth,triangle").lpf(800)`} 216/> 217 218<Box> 219 220Try adding `.hush()` at the end of one of the patterns in the stack... 221 222</Box> 223 224**pan** 225 226<MiniRepl 227 client:visible 228 tune={`sound("numbers:1 numbers:2 numbers:3 numbers:4") 229 .pan("0 0.3 .6 1")`} 230/> 231 232**speed** 233 234<MiniRepl client:visible tune={`sound("bd rim [~ bd] rim").speed("<1 2 -1 -2>").room(.2)`} /> 235 236**fast and slow** 237 238We can use `fast` and `slow` to change the tempo of a pattern outside of Mini-Notation: 239 240<MiniRepl client:visible tune={`sound("bd*4,~ rim ~ cp").slow(2)`} /> 241 242<Box> 243 244Change the `slow` value. Try replacing it with `fast`. 245 246What happens if you use a pattern like `.fast("<1 [2 4]>")`? 247 248</Box> 249 250By the way, inside Mini-Notation, `fast` is `*` and `slow` is `/`. 251 252<MiniRepl client:visible tune={`sound("[bd*4,~ rim ~ cp]*<1 [2 4]>")`} /> 253 254## modulation with signals 255 256Instead of changing values stepwise, we can also control them with signals: 257 258<MiniRepl client:visible tune={`sound("hh*16").gain(sine)`} punchcard punchcardLabels={false} /> 259 260<Box> 261 262The basic waveforms for signals are `sine`, `saw`, `square`, `tri` 🌊 263 264Try also random signals `rand` and `perlin`! 265 266The gain is visualized as transparency in the pianoroll. 267 268</Box> 269 270**setting a range** 271 272By default, waves oscillate between 0 to 1. We can change that with `range`: 273 274<MiniRepl client:visible tune={`sound("hh*16").lpf(saw.range(500, 2000))`} /> 275 276<Box> 277 278What happens if you flip the range values? 279 280</Box> 281 282We can change the modulation speed with slow / fast: 283 284<MiniRepl 285 client:visible 286 tune={`note("<[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>") 287 .sound("sawtooth") 288 .lpf(sine.range(100, 2000).slow(4))`} 289/> 290 291<Box> 292 293The whole modulation will now take 8 cycles to repeat. 294 295</Box> 296 297## Recap 298 299| name | example | 300| ------- | ---------------------------------------------------------------------------------------------------------------- | 301| lpf | <MiniRepl client:visible tune={`note("c2 c3 c2 c3").s("sawtooth").lpf("<400 2000>")`} /> | 302| vowel | <MiniRepl client:visible tune={`note("c3 eb3 g3").s("sawtooth").vowel("<a e i o>")`} /> | 303| gain | <MiniRepl client:visible tune={`s("hh*16").gain("[.25 1]*2")`} /> | 304| delay | <MiniRepl client:visible tune={`s("bd rim bd cp").delay(.5)`} /> | 305| room | <MiniRepl client:visible tune={`s("bd rim bd cp").room(.5)`} /> | 306| pan | <MiniRepl client:visible tune={`s("bd rim bd cp").pan("0 1")`} /> | 307| speed | <MiniRepl client:visible tune={`s("bd rim bd cp").speed("<1 2 -1 -2>")`} /> | 308| signals | `sine`, `saw`, `square`, `tri`, `rand`, `perlin`<br/><MiniRepl client:visible tune={`s("hh*16").gain (saw)`} /> | 309| range | <MiniRepl client:visible tune={`s("hh*16").lpf(saw.range(200,4000))`} /> | 310 311Let us now take a look at some of Tidal's typical [pattern effects](/workshop/pattern-effects).