mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 04:28:30 +00:00
Document reverb controls
This commit is contained in:
parent
0ad0046a76
commit
abff279707
@ -970,6 +970,41 @@ const generic_params = [
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
[['room', 'size']],
|
[['room', 'size']],
|
||||||
|
/**
|
||||||
|
* Reverb lowpass starting frequency (in hertz).
|
||||||
|
*
|
||||||
|
* @name revlp
|
||||||
|
* @param {number} level between 0 and 20000hz
|
||||||
|
* @example
|
||||||
|
* s("bd sd").room(0.5).revlp(10000)
|
||||||
|
* @example
|
||||||
|
* s("bd sd").room(0.5).revlp(5000)
|
||||||
|
*/
|
||||||
|
['revlp'],
|
||||||
|
/**
|
||||||
|
* Reverb lowpass frequency at -60dB (in hertz).
|
||||||
|
*
|
||||||
|
* @name revdim
|
||||||
|
* @param {number} level between 0 and 20000hz
|
||||||
|
* @example
|
||||||
|
* s("bd sd").room(0.5).revlp(10000).revdim(8000)
|
||||||
|
* @example
|
||||||
|
* s("bd sd").room(0.5).revlp(5000).revdim(400)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
['revdim'],
|
||||||
|
/**
|
||||||
|
* Reverb fade time (in seconds).
|
||||||
|
*
|
||||||
|
* @name fade
|
||||||
|
* @param {number} seconds for the reverb to fade
|
||||||
|
* @example
|
||||||
|
* s("bd sd").room(0.5).revlp(10000).fade(0.5)
|
||||||
|
* @example
|
||||||
|
* s("bd sd").room(0.5).revlp(5000).fade(4)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
['fade'],
|
||||||
/**
|
/**
|
||||||
* Sets the room size of the reverb, see {@link room}.
|
* Sets the room size of the reverb, see {@link room}.
|
||||||
*
|
*
|
||||||
@ -1162,7 +1197,7 @@ const generic_params = [
|
|||||||
];
|
];
|
||||||
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13
|
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13
|
||||||
|
|
||||||
controls.createParam = function (names) {
|
controls.createParam = function(names) {
|
||||||
const name = Array.isArray(names) ? names[0] : names;
|
const name = Array.isArray(names) ? names[0] : names;
|
||||||
|
|
||||||
var withVal;
|
var withVal;
|
||||||
@ -1186,7 +1221,7 @@ controls.createParam = function (names) {
|
|||||||
|
|
||||||
const func = (...pats) => sequence(...pats).withValue(withVal);
|
const func = (...pats) => sequence(...pats).withValue(withVal);
|
||||||
|
|
||||||
const setter = function (...pats) {
|
const setter = function(...pats) {
|
||||||
if (!pats.length) {
|
if (!pats.length) {
|
||||||
return this.fmap(withVal);
|
return this.fmap(withVal);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,13 @@ import reverbGen from './reverbGen.mjs';
|
|||||||
|
|
||||||
if (typeof AudioContext !== 'undefined') {
|
if (typeof AudioContext !== 'undefined') {
|
||||||
AudioContext.prototype.generateReverb = reverbGen.generateReverb;
|
AudioContext.prototype.generateReverb = reverbGen.generateReverb;
|
||||||
AudioContext.prototype.createReverb = function(duration, audioContext) {
|
AudioContext.prototype.createReverb = function(
|
||||||
|
duration,
|
||||||
|
audioContext,
|
||||||
|
fade,
|
||||||
|
revlp,
|
||||||
|
revdim
|
||||||
|
) {
|
||||||
const convolver = this.createConvolver();
|
const convolver = this.createConvolver();
|
||||||
convolver.setDuration = (d) => {
|
convolver.setDuration = (d) => {
|
||||||
this.generateReverb(
|
this.generateReverb(
|
||||||
@ -11,9 +17,9 @@ if (typeof AudioContext !== 'undefined') {
|
|||||||
sampleRate: 44100,
|
sampleRate: 44100,
|
||||||
numChannels: 2,
|
numChannels: 2,
|
||||||
decayTime: d,
|
decayTime: d,
|
||||||
fadeInTime: d,
|
fadeInTime: fade,
|
||||||
lpFreqStart: 2000,
|
lpFreqStart: revlp,
|
||||||
lpFreqEnd: 15000,
|
lpFreqEnd: revdim,
|
||||||
},
|
},
|
||||||
(buffer) => {
|
(buffer) => {
|
||||||
convolver.buffer = buffer;
|
convolver.buffer = buffer;
|
||||||
|
|||||||
@ -113,7 +113,13 @@ function getReverb(orbit, duration = 2) {
|
|||||||
// If no reverb has been created for a given orbit, create one
|
// If no reverb has been created for a given orbit, create one
|
||||||
if (!reverbs[orbit]) {
|
if (!reverbs[orbit]) {
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const reverb = ac.createReverb(duration, getAudioContext());
|
const reverb = ac.createReverb(
|
||||||
|
duration,
|
||||||
|
getAudioContext(),
|
||||||
|
fade,
|
||||||
|
revlp,
|
||||||
|
revdim,
|
||||||
|
);
|
||||||
reverb.connect(getDestination());
|
reverb.connect(getDestination());
|
||||||
console.log(reverb)
|
console.log(reverb)
|
||||||
reverbs[orbit] = reverb;
|
reverbs[orbit] = reverb;
|
||||||
@ -222,6 +228,9 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||||||
delaytime = 0.25,
|
delaytime = 0.25,
|
||||||
orbit = 1,
|
orbit = 1,
|
||||||
room,
|
room,
|
||||||
|
fade = 0.1,
|
||||||
|
revlp = 15000,
|
||||||
|
revdim = 1000,
|
||||||
size = 2,
|
size = 2,
|
||||||
velocity = 1,
|
velocity = 1,
|
||||||
analyze, // analyser wet
|
analyze, // analyser wet
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user