mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
Merge pull request #1318 from daslyfe/jade/gaincurve
feat: Improve gain curve
This commit is contained in:
commit
47fb441feb
@ -18,6 +18,7 @@ export const DEFAULT_MAX_POLYPHONY = 128;
|
|||||||
const DEFAULT_AUDIO_DEVICE_NAME = 'System Standard';
|
const DEFAULT_AUDIO_DEVICE_NAME = 'System Standard';
|
||||||
|
|
||||||
let maxPolyphony = DEFAULT_MAX_POLYPHONY;
|
let maxPolyphony = DEFAULT_MAX_POLYPHONY;
|
||||||
|
|
||||||
export function setMaxPolyphony(polyphony) {
|
export function setMaxPolyphony(polyphony) {
|
||||||
maxPolyphony = parseInt(polyphony) ?? DEFAULT_MAX_POLYPHONY;
|
maxPolyphony = parseInt(polyphony) ?? DEFAULT_MAX_POLYPHONY;
|
||||||
}
|
}
|
||||||
@ -28,6 +29,16 @@ export function registerSound(key, onTrigger, data = {}) {
|
|||||||
soundMap.setKey(key, { onTrigger, data });
|
soundMap.setKey(key, { onTrigger, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let gainCurveFunc = (val) => val;
|
||||||
|
|
||||||
|
export function applyGainCurve(val) {
|
||||||
|
return gainCurveFunc(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setGainCurve(newGainCurveFunc) {
|
||||||
|
gainCurveFunc = newGainCurveFunc;
|
||||||
|
}
|
||||||
|
|
||||||
function aliasBankMap(aliasMap) {
|
function aliasBankMap(aliasMap) {
|
||||||
// Make all bank keys lower case for case insensitivity
|
// Make all bank keys lower case for case insensitivity
|
||||||
for (const key in aliasMap) {
|
for (const key in aliasMap) {
|
||||||
@ -515,7 +526,13 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
compressorRelease,
|
compressorRelease,
|
||||||
} = value;
|
} = value;
|
||||||
|
|
||||||
gain = nanFallback(gain, 1);
|
gain = applyGainCurve(nanFallback(gain, 1));
|
||||||
|
postgain = applyGainCurve(postgain);
|
||||||
|
shapevol = applyGainCurve(shapevol);
|
||||||
|
distortvol = applyGainCurve(distortvol);
|
||||||
|
delay = applyGainCurve(delay);
|
||||||
|
velocity = applyGainCurve(velocity);
|
||||||
|
gain *= velocity; // velocity currently only multiplies with gain. it might do other things in the future
|
||||||
|
|
||||||
const chainID = Math.round(Math.random() * 1000000);
|
const chainID = Math.round(Math.random() * 1000000);
|
||||||
|
|
||||||
@ -532,7 +549,7 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
|
|
||||||
//music programs/audio gear usually increments inputs/outputs from 1, so imitate that behavior
|
//music programs/audio gear usually increments inputs/outputs from 1, so imitate that behavior
|
||||||
channels = (Array.isArray(channels) ? channels : [channels]).map((ch) => ch - 1);
|
channels = (Array.isArray(channels) ? channels : [channels]).map((ch) => ch - 1);
|
||||||
gain *= velocity; // velocity currently only multiplies with gain. it might do other things in the future
|
|
||||||
let audioNodes = [];
|
let audioNodes = [];
|
||||||
|
|
||||||
if (bank && s) {
|
if (bank && s) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user