mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
cleaning up
This commit is contained in:
parent
bee36a7a4f
commit
f0a582dc92
@ -387,20 +387,21 @@ const generic_params = [
|
||||
* @name phaser
|
||||
* @param {number | Pattern} speed speed of modulation
|
||||
* @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'],
|
||||
/**
|
||||
* The depth of modulation for phaser
|
||||
*
|
||||
*
|
||||
* @name phaserDepth
|
||||
* @name phaserdepth
|
||||
* @param {number | Pattern} depth number between 0 and 1
|
||||
* @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
|
||||
*
|
||||
@ -1191,7 +1192,7 @@ const generic_params = [
|
||||
['tremolodepth', 'tremdp'],
|
||||
['tremolorate', 'tremr'],
|
||||
// TODO: doesn't seem to do anything
|
||||
['phaserdepth', 'phasdp'],
|
||||
['phasdp'],
|
||||
['phaserrate', 'phasr'],
|
||||
|
||||
['fshift'],
|
||||
|
||||
@ -67,6 +67,8 @@ superdough({ s: 'bd', delay: 0.5 }, 0, 1);
|
||||
- `crush`: amplitude bit crusher using given number of bits
|
||||
- `shape`: distortion effect from 0 (none) to 1 (full). might get loud!
|
||||
- `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"
|
||||
- `delay`: delay mix
|
||||
- `delayfeedback`: delay feedback
|
||||
|
||||
@ -112,26 +112,18 @@ function getDelay(orbit, delaytime, delayfeedback, t) {
|
||||
return delays[orbit];
|
||||
}
|
||||
|
||||
let phaserLFOs = {};
|
||||
|
||||
function getPhaser(orbit, speed = 1, depth = 0.5, t) {
|
||||
function getPhaser(speed = 1, depth = 0.5) {
|
||||
//gain
|
||||
const ac = getAudioContext();
|
||||
const lfoGain = ac.createGain();
|
||||
lfoGain.gain.value = 2000;
|
||||
|
||||
//lfo
|
||||
if (phaserLFOs[orbit] == null) {
|
||||
const lfo = ac.createOscillator();
|
||||
lfo.frequency.value = speed;
|
||||
lfo.type = 'sine';
|
||||
lfo.start();
|
||||
phaserLFOs[orbit] = lfo;
|
||||
}
|
||||
if (phaserLFOs[orbit].frequency.value !== speed) {
|
||||
phaserLFOs[orbit].frequency.setValueAtTime(speed, t);
|
||||
}
|
||||
phaserLFOs[orbit].connect(lfoGain);
|
||||
//lfo TODO: set the lfo phase relative to current cycle to create "free running" effect
|
||||
const lfo = ac.createOscillator();
|
||||
lfo.frequency.value = speed;
|
||||
lfo.type = 'sine';
|
||||
lfo.start();
|
||||
lfo.connect(lfoGain);
|
||||
|
||||
//filters
|
||||
const numStages = 2; //num of filters in series
|
||||
@ -271,7 +263,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
||||
|
||||
//phaser
|
||||
phaser,
|
||||
phaserDepth,
|
||||
phaserdepth,
|
||||
//
|
||||
coarse,
|
||||
crush,
|
||||
@ -306,6 +298,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
||||
if (bank && s) {
|
||||
s = `${bank}_${s}`;
|
||||
}
|
||||
|
||||
// get source AudioNode
|
||||
let sourceNode;
|
||||
if (source) {
|
||||
@ -407,11 +400,6 @@ export const superdough = async (value, deadline, hapDuration) => {
|
||||
chain.push(vowelFilter);
|
||||
}
|
||||
|
||||
// if (phaser !== undefined) {
|
||||
// const phaserFX = ac.createPhaser({ speed: phaser, depth: phaserDepth });
|
||||
// chain.push(phaserFX);
|
||||
// }
|
||||
|
||||
// effects
|
||||
coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse }));
|
||||
crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush }));
|
||||
@ -431,7 +419,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
||||
}
|
||||
// phaser
|
||||
if (phaser !== undefined) {
|
||||
const phaserFX = getPhaser(orbit, phaser, phaserDepth, t);
|
||||
const phaserFX = getPhaser(phaser, phaserdepth);
|
||||
chain.push(phaserFX);
|
||||
}
|
||||
|
||||
|
||||
@ -106,36 +106,3 @@ class ShapeProcessor extends AudioWorkletProcessor {
|
||||
}
|
||||
|
||||
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