Merge pull request #218 from tidalcycles/webdirt-feature-parity

samples now have envelopes
This commit is contained in:
Felix Roos 2022-09-22 19:18:18 +02:00 committed by GitHub
commit 82cb6c93cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11039 additions and 11047 deletions

View file

@ -182,8 +182,8 @@ Pattern.prototype.out = function () {
shape, shape,
pan, pan,
attack = 0.001, attack = 0.001,
decay = 0.05, decay = 0.001,
sustain = 0.5, sustain = 1,
release = 0.001, release = 0.001,
speed = 1, // sample playback speed speed = 1, // sample playback speed
begin = 0, begin = 0,
@ -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();

View file

@ -54,6 +54,7 @@ const panwidth = (pan, width) => pan * width + (1 - width) / 2;
Pattern.prototype.piano = function () { Pattern.prototype.piano = function () {
return this.clip(1) return this.clip(1)
.s('piano') .s('piano')
.release(.1)
.fmap((value) => { .fmap((value) => {
const midi = typeof value.note === 'string' ? toMidi(value.note) : value.note; const midi = typeof value.note === 'string' ? toMidi(value.note) : value.note;
// pan by pitch // pan by pitch

File diff suppressed because it is too large Load diff