diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index c9dc15b6..b9d8a257 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -744,7 +744,7 @@ const generic_params = [ ['f', 'uid', ''], ['f', 'val', ''], ['f', 'cps', ''], - ['f', 'choke', ''], + ['f', 'clip', ''], ]; // TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13 diff --git a/packages/webaudio/webaudio.mjs b/packages/webaudio/webaudio.mjs index 1730e6d2..8a13e30c 100644 --- a/packages/webaudio/webaudio.mjs +++ b/packages/webaudio/webaudio.mjs @@ -134,7 +134,7 @@ Pattern.prototype.out = function () { freq, s, sf, - choke = 0, // if 1, samples will be cut off when the hap ends + clip = 0, // if 1, samples will be cut off when the hap ends n = 0, note, gain = 1, @@ -220,17 +220,17 @@ Pattern.prototype.out = function () { } bufferSource.playbackRate.value = Math.abs(speed) * bufferSource.playbackRate.value; // TODO: nudge, unit, cut, loop - let duration = soundfont || choke ? hap.duration : bufferSource.buffer.duration; + let duration = soundfont || clip ? hap.duration : bufferSource.buffer.duration; // let duration = bufferSource.buffer.duration; const offset = begin * duration; duration = ((end - begin) * duration) / Math.abs(speed); - if (soundfont || choke) { + if (soundfont || clip) { bufferSource.start(t, offset); // duration does not work here for some reason } else { bufferSource.start(t, offset, duration); } chain.push(bufferSource); - if (soundfont || choke) { + if (soundfont || clip) { const env = ac.createGain(); const releaseLength = 0.1; env.gain.value = 0.6; diff --git a/repl/src/prebake.mjs b/repl/src/prebake.mjs index 1527a824..5eb64345 100644 --- a/repl/src/prebake.mjs +++ b/repl/src/prebake.mjs @@ -47,7 +47,7 @@ const maxPan = toMidi('C8'); const panwidth = (pan, width) => pan * width + (1 - width) / 2; Pattern.prototype.piano = function () { - return this.choke(1) + return this.clip(1) .s('piano') .fmap((value) => { // pan by pitch diff --git a/repl/src/tunes.mjs b/repl/src/tunes.mjs index df1aa43b..ca35f5ea 100644 --- a/repl/src/tunes.mjs +++ b/repl/src/tunes.mjs @@ -1015,7 +1015,7 @@ x=>x.add(7).color('steelblue') .cutoff(sine.slow(7).range(200,4000)) .resonance(10) //.hcutoff(400) -.choke(1) +.clip(1) .stack(s("bd:1*2,~ sd:0,[~ hh:0]*2")) .out() .pianoroll({vertical:1})`;