mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 12:38:35 +00:00
sample adsr support
This commit is contained in:
parent
7f6940f3a5
commit
014c258c57
@ -181,10 +181,10 @@ Pattern.prototype.out = function () {
|
|||||||
crush,
|
crush,
|
||||||
shape,
|
shape,
|
||||||
pan,
|
pan,
|
||||||
attack = 0.001,
|
attack = 0.0001,
|
||||||
decay = 0.05,
|
decay = 0.0001,
|
||||||
sustain = 0.5,
|
sustain = 1,
|
||||||
release = 0.001,
|
release = 0.0001,
|
||||||
speed = 1, // sample playback speed
|
speed = 1, // sample playback speed
|
||||||
begin = 0,
|
begin = 0,
|
||||||
end = 1,
|
end = 1,
|
||||||
@ -284,18 +284,9 @@ Pattern.prototype.out = function () {
|
|||||||
cutGroups[cut] = bufferSource;
|
cutGroups[cut] = bufferSource;
|
||||||
}
|
}
|
||||||
chain.push(bufferSource);
|
chain.push(bufferSource);
|
||||||
if (soundfont || clip) {
|
bufferSource.stop(t + duration + release);
|
||||||
const env = ac.createGain();
|
const adsr = getADSR(attack, decay, sustain, release, 1, t, t + duration);
|
||||||
const releaseLength = 0.1;
|
chain.push(adsr);
|
||||||
env.gain.value = 0.6;
|
|
||||||
env.gain.setValueAtTime(env.gain.value, t + duration);
|
|
||||||
env.gain.linearRampToValueAtTime(0, t + duration + releaseLength);
|
|
||||||
// env.gain.linearRampToValueAtTime(0, t + duration + releaseLength);
|
|
||||||
chain.push(env);
|
|
||||||
bufferSource.stop(t + duration + releaseLength);
|
|
||||||
} else {
|
|
||||||
bufferSource.stop(t + duration);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// master out
|
// master out
|
||||||
const master = ac.createGain();
|
const master = ac.createGain();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user