mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 13:08:28 +00:00
cleaning up
This commit is contained in:
parent
bee36a7a4f
commit
f0a582dc92
@ -387,20 +387,21 @@ const generic_params = [
|
|||||||
* @name phaser
|
* @name phaser
|
||||||
* @param {number | Pattern} speed speed of modulation
|
* @param {number | Pattern} speed speed of modulation
|
||||||
* @example
|
* @example
|
||||||
* run(8).scale("D:pentatonic").note().sound("sawtooth").phaser("2 8").release(0.5)
|
* run(8).scale("D:pentatonic").note().sound("sawtooth").release(0.5).phaser("2 8")
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
['phaser'],
|
['phaser'],
|
||||||
/**
|
/**
|
||||||
|
* The depth of modulation for phaser
|
||||||
*
|
*
|
||||||
*
|
* @name phaserdepth
|
||||||
* @name phaserDepth
|
|
||||||
* @param {number | Pattern} depth number between 0 and 1
|
* @param {number | Pattern} depth number between 0 and 1
|
||||||
* @example
|
* @example
|
||||||
* run(8).scale("D:pentatonic").note().sound("sawtooth").phaser("2 8").phaserDepth(0.5).release(0.5)
|
* run(8).scale("D:pentatonic").note().sound("sawtooth").release(0.5).phaser("2 8").phaserdepth(0.5)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
['phaserDepth'],
|
['phaserdepth'],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* choose the channel the pattern is sent to in superdirt
|
* choose the channel the pattern is sent to in superdirt
|
||||||
*
|
*
|
||||||
@ -1191,7 +1192,7 @@ const generic_params = [
|
|||||||
['tremolodepth', 'tremdp'],
|
['tremolodepth', 'tremdp'],
|
||||||
['tremolorate', 'tremr'],
|
['tremolorate', 'tremr'],
|
||||||
// TODO: doesn't seem to do anything
|
// TODO: doesn't seem to do anything
|
||||||
['phaserdepth', 'phasdp'],
|
['phasdp'],
|
||||||
['phaserrate', 'phasr'],
|
['phaserrate', 'phasr'],
|
||||||
|
|
||||||
['fshift'],
|
['fshift'],
|
||||||
|
|||||||
@ -67,6 +67,8 @@ superdough({ s: 'bd', delay: 0.5 }, 0, 1);
|
|||||||
- `crush`: amplitude bit crusher using given number of bits
|
- `crush`: amplitude bit crusher using given number of bits
|
||||||
- `shape`: distortion effect from 0 (none) to 1 (full). might get loud!
|
- `shape`: distortion effect from 0 (none) to 1 (full). might get loud!
|
||||||
- `pan`: stereo panning from 0 (left) to 1 (right)
|
- `pan`: stereo panning from 0 (left) to 1 (right)
|
||||||
|
- `phaser`: sets the speed of the modulation
|
||||||
|
- `phaserdepth`
|
||||||
- `vowel`: vowel filter. possible values: "a", "e", "i", "o", "u"
|
- `vowel`: vowel filter. possible values: "a", "e", "i", "o", "u"
|
||||||
- `delay`: delay mix
|
- `delay`: delay mix
|
||||||
- `delayfeedback`: delay feedback
|
- `delayfeedback`: delay feedback
|
||||||
|
|||||||
@ -112,26 +112,18 @@ function getDelay(orbit, delaytime, delayfeedback, t) {
|
|||||||
return delays[orbit];
|
return delays[orbit];
|
||||||
}
|
}
|
||||||
|
|
||||||
let phaserLFOs = {};
|
function getPhaser(speed = 1, depth = 0.5) {
|
||||||
|
|
||||||
function getPhaser(orbit, speed = 1, depth = 0.5, t) {
|
|
||||||
//gain
|
//gain
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const lfoGain = ac.createGain();
|
const lfoGain = ac.createGain();
|
||||||
lfoGain.gain.value = 2000;
|
lfoGain.gain.value = 2000;
|
||||||
|
|
||||||
//lfo
|
//lfo TODO: set the lfo phase relative to current cycle to create "free running" effect
|
||||||
if (phaserLFOs[orbit] == null) {
|
const lfo = ac.createOscillator();
|
||||||
const lfo = ac.createOscillator();
|
lfo.frequency.value = speed;
|
||||||
lfo.frequency.value = speed;
|
lfo.type = 'sine';
|
||||||
lfo.type = 'sine';
|
lfo.start();
|
||||||
lfo.start();
|
lfo.connect(lfoGain);
|
||||||
phaserLFOs[orbit] = lfo;
|
|
||||||
}
|
|
||||||
if (phaserLFOs[orbit].frequency.value !== speed) {
|
|
||||||
phaserLFOs[orbit].frequency.setValueAtTime(speed, t);
|
|
||||||
}
|
|
||||||
phaserLFOs[orbit].connect(lfoGain);
|
|
||||||
|
|
||||||
//filters
|
//filters
|
||||||
const numStages = 2; //num of filters in series
|
const numStages = 2; //num of filters in series
|
||||||
@ -271,7 +263,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||||||
|
|
||||||
//phaser
|
//phaser
|
||||||
phaser,
|
phaser,
|
||||||
phaserDepth,
|
phaserdepth,
|
||||||
//
|
//
|
||||||
coarse,
|
coarse,
|
||||||
crush,
|
crush,
|
||||||
@ -306,6 +298,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||||||
if (bank && s) {
|
if (bank && s) {
|
||||||
s = `${bank}_${s}`;
|
s = `${bank}_${s}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get source AudioNode
|
// get source AudioNode
|
||||||
let sourceNode;
|
let sourceNode;
|
||||||
if (source) {
|
if (source) {
|
||||||
@ -407,11 +400,6 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||||||
chain.push(vowelFilter);
|
chain.push(vowelFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (phaser !== undefined) {
|
|
||||||
// const phaserFX = ac.createPhaser({ speed: phaser, depth: phaserDepth });
|
|
||||||
// chain.push(phaserFX);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// effects
|
// effects
|
||||||
coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse }));
|
coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse }));
|
||||||
crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush }));
|
crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush }));
|
||||||
@ -431,7 +419,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||||||
}
|
}
|
||||||
// phaser
|
// phaser
|
||||||
if (phaser !== undefined) {
|
if (phaser !== undefined) {
|
||||||
const phaserFX = getPhaser(orbit, phaser, phaserDepth, t);
|
const phaserFX = getPhaser(phaser, phaserdepth);
|
||||||
chain.push(phaserFX);
|
chain.push(phaserFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,36 +106,3 @@ class ShapeProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
registerProcessor('shape-processor', ShapeProcessor);
|
registerProcessor('shape-processor', ShapeProcessor);
|
||||||
|
|
||||||
// class PhaseProcessor extends AudioWorkletProcessor {
|
|
||||||
// static get parameterDescriptors() {
|
|
||||||
// return [{ name: 'phaser', defaultValue: 0 }];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// constructor() {
|
|
||||||
// super();
|
|
||||||
// this.notStarted = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// process(inputs, outputs, parameters) {
|
|
||||||
// const input = inputs[0];
|
|
||||||
// const output = outputs[0];
|
|
||||||
// const phaser0 = parameters.phaser[0];
|
|
||||||
// const phaser1 = phaser0 < 1 ? phaser0 : 1.0 - 4e-10;
|
|
||||||
// const phaser = (2.0 * phaser1) / (1.0 - phaser1);
|
|
||||||
// const blockSize = 128;
|
|
||||||
// const hasInput = !(input[0] === undefined);
|
|
||||||
// if (hasInput) {
|
|
||||||
// this.notStarted = false;
|
|
||||||
// for (let n = 0; n < blockSize; n++) {
|
|
||||||
// const value = ((1 + phaser) * input[0][n]) / (1 + phaser * Math.abs(input[0][n]));
|
|
||||||
// for (let o = 0; o < output.length; o++) {
|
|
||||||
// output[o][n] = value;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return this.notStarted || hasInput;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// registerProcessor('phaser-processor', PhaseProcessor);
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user