diff --git a/src/classes/SoundEvent.ts b/src/classes/SoundEvent.ts index 8258146..9c09c1a 100644 --- a/src/classes/SoundEvent.ts +++ b/src/classes/SoundEvent.ts @@ -136,8 +136,11 @@ export class SoundEvent extends AudibleEvent { public lpr = this.lprelease; public cutoff = (value: number) => this.updateValue("cutoff", value); public lpf = this.cutoff; - public resonance = (value: number) => - this.updateValue("resonance", Math.min(Math.max(value, 0), 50)); + public resonance = (value: number) => { + if (value >= 0 || value <= 1) { + this.updateValue("resonance", 50 * Math.min(Math.max(value, 0), 1)); + } + } public lpq = this.resonance; public lpadsr = ( depth: number, diff --git a/src/documentation/synths.ts b/src/documentation/synths.ts index e52fa52..db6da23 100644 --- a/src/documentation/synths.ts +++ b/src/documentation/synths.ts @@ -196,7 +196,7 @@ These filters all come with their own set of parameters. Note that we are descri | Method | Alias | Description | |------------|-----------|---------------------------------| | cutoff | lpf | cutoff frequency of the lowpass filter | -| resonance | lpq | resonance of the lowpass filter | +| resonance | lpq | resonance of the lowpass filter (0-1) | ${makeExample( "Filtering a bass", @@ -209,7 +209,7 @@ ${makeExample( | Method | Alias | Description | |------------|-----------|---------------------------------| | hcutoff | hpf | cutoff frequency of the highpass filter | -| hresonance | hpq | resonance of the highpass filter | +| hresonance | hpq | resonance of the highpass filter (0-1) | ${makeExample( "Filtering a noise source", @@ -222,7 +222,7 @@ ${makeExample( | Method | Alias | Description | |------------|-----------|---------------------------------| | bandf | bpf | cutoff frequency of the bandpass filter | -| bandq | bpq | resonance of the bandpass filter | +| bandq | bpq | resonance of the bandpass filter (0-1) | ${makeExample( "Sweeping the filter on the same guitar sample", @@ -249,7 +249,7 @@ ${makeExample( ` beat(.5) && snd('sawtooth') .cutoff([2000,500].pick() + usine(.5) * 4000) - .resonance(0.9).freq([100,150].pick()) + .resonance(0.2).freq([100,150].pick()) .out() `, true @@ -357,7 +357,7 @@ ${makeExample( beat(.25) :: sound('wt_symetric:8').note([50,55,57,60].beat(.25) - [12,0] .pick()).ftype('12db').adsr(0.05/4, 1/16, 0.25/4, 0) .cutoff(1500 + usine(1/8) * 5000).lpadsr(16, 0.2, 0.2, 0.125/2, 0) - .room(0.9).size(0.9).resonance(20).gain(0.3).out() + .room(0.9).size(0.9).resonance(0.2).gain(0.3).out() beat(1) :: sound('kick').n(4).out() beat(2) :: sound('snare').out() beat(.5) :: sound('hh').out()`, diff --git a/src/examples/excerpts.ts b/src/examples/excerpts.ts index 9713d92..45da2f6 100644 --- a/src/examples/excerpts.ts +++ b/src/examples/excerpts.ts @@ -5,7 +5,7 @@ beat(.25) :: sound('wt_symetric:8') .ftype('12db').adsr(0.05/4, 1/16, 0.25/4, 0) .cutoff(1500 + usine(1/8) * 5000) .lpadsr(16, 0.2, 0.2, 0.125/2, 0) - .room(0.9).size(0.9).resonance(20) + .room(0.9).size(0.9).resonance(0.2) .gain(0.7).out() beat(1) :: sound('kick').n(4).out() beat(2) :: sound('snare').out() @@ -118,7 +118,7 @@ beat(rarely(12) ? .5 : .25) :: sound('ST22') .note([30, 30, 30, 31].repeat(8).beat(.5)) .cut(1).n([19, 21].beat(.75)) .cutoff(irand(200, 5000)) - .resonance(rand(0.2,0.8)) + .resonance(rand(0.2,0.5)) .room(0.9).size(1).orbit(2) .speed(0.5).vel(0.6).end(0.5) .out() @@ -147,11 +147,11 @@ beat(1) :: snd('kick').out(); beat(2) :: snd('sd').room(0.9).size(0.9).out(); beat(0.25) :: snd('hh').out(); beat(2) :: snd('square') - .cutoff(500).note(50-12).resonance(20).sustain(0.2).out() + .cutoff(500).note(50-12).resonance(0.2).sustain(0.2).out() beat(1/4)::snd(['sawtooth', 'triangle', 'square'].beat(1)) .vib(2).vibmod(0.5) .note([50, 53, 55, 50, 50, 52, 58, 50+12, 50+15].beat(4) + [0, 12, 24].beat(0.5)) - .cutoff(usine(.5)*10000).resonance([10,20].beat(2)) + .cutoff(usine(.5)*10000).resonance([0.1,0.2].beat(2)) .fmi($(1) % 10).fmh($(2) % 5) .room(0.8).size(0.9) .delay(0.5).delaytime(0.25) @@ -188,11 +188,11 @@ flip(3) :: beat([.25,.5].beat(.5)) :: sound('dr') beat([.25,.125].beat(4))::snd('arpy:4') .note(30 + [0,3,7,10, 12, 5, 7].beat()).speed(0.999).pan(0) .cutoff(1000 + usine(1/8) * 400).lpadsr(8, 1/8, 1/16, 0, 0) - .resonance(1).gain(0.4).end(0.8).room(0.9).size(0.9).n(0).out(); + .resonance(0.1).gain(0.4).end(0.8).room(0.9).size(0.9).n(0).out(); beat([.25,.125, .5].beat(4))::snd('arpy:4') .note(30 + [0,3,7,10, 12, 5, 7].beat()).speed(1.001).pan(1) .cutoff(100 + usine(1/8) * 800).lpadsr(5, 0, [1/8, 1.16].beat(), 0, 0) - .resonance(5).gain(0.4).end(0.8).room(0.9).size(0.9).n(3).out(); + .resonance(0.2).gain(0.4).end(0.8).room(0.9).size(0.9).n(3).out(); beat(.5) :: snd('arpy').note([30, 33, 35].repeat(4).beat(1) - [24,12].beat(0.5)) .cutoff(500).lpadsr(8, 0.05, .125, 0, 0).out()`, `// Naïf et agréable -- Bubobubobubo z1('1/8 024!3 035 024 0124').sound('wt_stereo')