Merge pull request #692 from Bubobubobubobubo/filters

Adding filter envelopes and filter order selection
This commit is contained in:
Felix Roos 2023-09-16 02:03:49 +02:00 committed by GitHub
commit 872e10fc95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 679 additions and 132 deletions

View file

@ -49,6 +49,10 @@ Each filter has 2 parameters:
<JsDoc client:idle name="bpq" h={0} />
## ftype
<JsDoc client:idle name="ftype" h={0} />
## vowel
<JsDoc client:idle name="vowel" h={0} />
@ -78,6 +82,58 @@ Strudel uses ADSR envelopes, which are probably the most common way to describe
<JsDoc client:idle name="release" h={0} />
# Filter Envelope
Each filter can receive an additional filter envelope controlling the cutoff value dynamically. It uses an ADSR envelope similar to the one used for amplitude. There is an additional parameter to control the depth of the filter modulation: `lpenv`|`hpenv`|`bpenv`. This allows you to play subtle or huge filter modulations just the same by only increasing or decreasing the depth.
<MiniRepl
client:idle
tune={`note("[c eb g <f bb>](3,8,<0 1>)".sub(12))
.s("<sawtooth>/64")
.lpf(sine.range(500,3000).slow(16))
.lpa(0.005)
.lpd(perlin.range(.02,.2))
.lps(perlin.range(0,.5).slow(3))
.lpq(sine.range(2,10).slow(32))
.release(.5)
.lpenv(perlin.range(1,8).slow(2))
.ftype('24db')
.room(1)
.juxBy(.5,rev)
.sometimes(add(note(12)))
.stack(s("bd*2").bank('RolandTR909'))
.gain(.5)`}
/>
There is one filter envelope for each filter type and thus one set of envelope filter parameters preceded either by `lp`, `hp` or `bp`:
- `lpattack`, `lpdecay`, `lpsustain`, `lprelease`, `lpenv`: filter envelope for the lowpass filter.
- alternatively: `lpa`, `lpd`, `lps`, `lpr` and `lpe`.
- `hpattack`, `hpdecay`, `hpsustain`, `hprelease`, `hpenv`: filter envelope for the highpass filter.
- alternatively: `hpa`, `hpd`, `hps`, `hpr` and `hpe`.
- `bpattack`, `bpdecay`, `bpsustain`, `bprelease`, `bpenv`: filter envelope for the bandpass filter.
- alternatively: `bpa`, `bpd`, `bps`, `bpr` and `bpe`.
## lpattack
<JsDoc client:idle name="lpattack" h={0} />
## lpdecay
<JsDoc client:idle name="lpdecay" h={0} />
## lpsustain
<JsDoc client:idle name="lpsustain" h={0} />
## lprelease
<JsDoc client:idle name="lprelease" h={0} />
## lpenv
<JsDoc client:idle name="lpenv" h={0} />
# Dynamics
## gain

View file

@ -229,7 +229,9 @@ stack(
.add("0,.02")
.note().gain(.3)
.clip("<1@3 [.3 1]>/2")
.s('sawtooth').cutoff(600).color('#F8E71C'),
.cutoff(600)
.lpa(.2).lpenv(-4)
.s('sawtooth').color('#F8E71C'),
).fast(3/2)
//.pianoroll({fold:1})`;
@ -468,7 +470,9 @@ stack(
.note()
.s("sawtooth,square")
.gain(.3).attack(0.01).decay(0.1).sustain(.5)
.apply(filter1),
.apply(filter1)
.lpa(.1).lpenv(2).ftype('24db')
,
"~@3 [<2 3>,<4 5>]"
.echo(4,1/16,.7)
.scale(scales)
@ -803,14 +807,14 @@ stack(
sine.add(saw.slow(4)).range(0,7).segment(8)
.superimpose(x=>x.add(.1))
.scale('G0 minor').note()
.s("sawtooth").decay(.1).sustain(0)
.s("sawtooth").decay(.1).sustain(0).lpa(.1).lpenv(4)
.gain(.4).cutoff(perlin.range(300,3000).slow(8)).resonance(10)
.degradeBy("0 0.1 .5 .1")
.rarely(add(note("12")))
,
// chord
note("Bb3,D4".superimpose(x=>x.add(.2)))
.s('sawtooth').cutoff(1000).struct("<~@3 [~ x]>")
.s('sawtooth').lpf(1000).struct("<~@3 [~ x]>")
.decay(.05).sustain(.0).delay(.8).delaytime(.125).room(.8)
,
// alien