mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
different default adsr for synths and samples
This commit is contained in:
parent
4264f013af
commit
699c8d5b60
@ -264,10 +264,6 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
|
|||||||
crush,
|
crush,
|
||||||
shape,
|
shape,
|
||||||
pan,
|
pan,
|
||||||
attack = 0.001,
|
|
||||||
decay = 0.001,
|
|
||||||
sustain = 1,
|
|
||||||
release = 0.001,
|
|
||||||
speed = 1, // sample playback speed
|
speed = 1, // sample playback speed
|
||||||
begin = 0,
|
begin = 0,
|
||||||
end = 1,
|
end = 1,
|
||||||
@ -295,6 +291,8 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
|
|||||||
[note, n] = splitSN(note, n);
|
[note, n] = splitSN(note, n);
|
||||||
}
|
}
|
||||||
if (!s || ['sine', 'square', 'triangle', 'sawtooth'].includes(s)) {
|
if (!s || ['sine', 'square', 'triangle', 'sawtooth'].includes(s)) {
|
||||||
|
// destructure adsr here, because the default should be different for synths and samples
|
||||||
|
const { attack = 0.001, decay = 0.05, sustain = 0.6, release = 0.01 } = hap.value;
|
||||||
// with synths, n and note are the same thing
|
// with synths, n and note are the same thing
|
||||||
n = note || n || 36;
|
n = note || n || 36;
|
||||||
if (typeof n === 'string') {
|
if (typeof n === 'string') {
|
||||||
@ -314,6 +312,8 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
|
|||||||
const adsr = getADSR(attack, decay, sustain, release, 1, t, t + hapDuration);
|
const adsr = getADSR(attack, decay, sustain, release, 1, t, t + hapDuration);
|
||||||
chain.push(adsr);
|
chain.push(adsr);
|
||||||
} else {
|
} else {
|
||||||
|
// destructure adsr here, because the default should be different for synths and samples
|
||||||
|
const { attack = 0.001, decay = 0.001, sustain = 1, release = 0.001 } = hap.value;
|
||||||
// load sample
|
// load sample
|
||||||
if (speed === 0) {
|
if (speed === 0) {
|
||||||
// no playback
|
// no playback
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user