diff --git a/src/classes/SoundEvent.ts b/src/classes/SoundEvent.ts
index 9c09c1a..6d56f42 100644
--- a/src/classes/SoundEvent.ts
+++ b/src/classes/SoundEvent.ts
@@ -134,11 +134,20 @@ export class SoundEvent extends AudibleEvent {
public lps = this.lpsustain;
public lprelease = (value: number) => this.updateValue("lprelease", value);
public lpr = this.lprelease;
- public cutoff = (value: number) => this.updateValue("cutoff", value);
+ public cutoff = (value: number, resonance?: number) => {
+ this.updateValue("cutoff", value);
+ if (resonance) {
+ this.resonance(resonance)
+ }
+ return this;
+ }
public lpf = this.cutoff;
public resonance = (value: number) => {
- if (value >= 0 || value <= 1) {
- this.updateValue("resonance", 50 * Math.min(Math.max(value, 0), 1));
+ if (value >= 0 && value <= 1) {
+ this.updateValue(
+ "resonance",
+ 50 * value
+ );
}
}
public lpq = this.resonance;
@@ -182,7 +191,13 @@ export class SoundEvent extends AudibleEvent {
public hpr = this.hprelease;
public hcutoff = (value: number) => this.updateValue("hcutoff", value);
public hpf = this.hcutoff;
- public hresonance = (value: number) => this.updateValue("hresonance", value);
+ public hresonance = (value: number, resonance?: number) => {
+ this.updateValue("hresonance", value);
+ if (resonance) {
+ this.resonance(resonance)
+ }
+ return this;
+ }
public hpq = this.hresonance;
public hpadsr = (
depth: number,
@@ -221,7 +236,13 @@ export class SoundEvent extends AudibleEvent {
public bps = this.bpsustain;
public bprelease = (value: number) => this.updateValue("bprelease", value);
public bpr = this.bprelease;
- public bandf = (value: number) => this.updateValue("bandf", value);
+ public bandf = (value: number, resonance?: number) => {
+ this.updateValue("bandf", value);
+ if (resonance) {
+ this.resonance(resonance)
+ }
+ return this;
+ }
public bpf = this.bandf;
public bandq = (value: number) => this.updateValue("bandq", value);
public bpq = this.bandq;
diff --git a/src/documentation/synths.ts b/src/documentation/synths.ts
index db6da23..6343cb8 100644
--- a/src/documentation/synths.ts
+++ b/src/documentation/synths.ts
@@ -230,6 +230,8 @@ ${makeExample(
true
)}
+Alternatively, lpf, hpf and bpf can take a second argument, the **resonance**.
+
## Filter order (type)
You can also use the ftype method to change the filter type (order). There are two types by default, 12db for a gentle slope or 24db for a really steep filtering slope. The 24db type is particularly useful for substractive synthesis if you are trying to emulate some of the Moog or Prophet sounds: