make vowel work with node

This commit is contained in:
Felix Roos 2022-09-15 20:11:10 +02:00
parent 4406dd88d1
commit 149b2ab9f9

View file

@ -6,8 +6,8 @@ export var vowelFormant = {
o: { freqs: [430, 820, 2700, 3000, 3300], gains: [1, 0.3162, 0.0501, 0.0794, 0.01995], qs: [40, 80, 100, 120, 120] },
u: { freqs: [370, 630, 2750, 3000, 3400], gains: [1, 0.1, 0.0708, 0.0316, 0.01995], qs: [40, 60, 100, 120, 120] },
};
class VowelNode extends GainNode {
if (typeof GainNode !== 'undefined') {
class VowelNode extends GainNode {
constructor(ac, letter) {
super(ac);
if (!vowelFormant[letter]) {
@ -30,8 +30,9 @@ class VowelNode extends GainNode {
this.connect = (target) => makeupGain.connect(target);
return this;
}
}
}
AudioContext.prototype.createVowelFilter = function (letter) {
AudioContext.prototype.createVowelFilter = function (letter) {
return new VowelNode(this, letter);
};
};
}