rename choke -> clip

This commit is contained in:
Felix Roos 2022-06-28 21:50:08 +02:00
parent cf564a7d06
commit 55f91143d9
4 changed files with 7 additions and 7 deletions

View File

@ -744,7 +744,7 @@ const generic_params = [
['f', 'uid', ''], ['f', 'uid', ''],
['f', 'val', ''], ['f', 'val', ''],
['f', 'cps', ''], ['f', 'cps', ''],
['f', 'choke', ''], ['f', 'clip', ''],
]; ];
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13 // TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13

View File

@ -134,7 +134,7 @@ Pattern.prototype.out = function () {
freq, freq,
s, s,
sf, 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, n = 0,
note, note,
gain = 1, gain = 1,
@ -220,17 +220,17 @@ Pattern.prototype.out = function () {
} }
bufferSource.playbackRate.value = Math.abs(speed) * bufferSource.playbackRate.value; bufferSource.playbackRate.value = Math.abs(speed) * bufferSource.playbackRate.value;
// TODO: nudge, unit, cut, loop // 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; // let duration = bufferSource.buffer.duration;
const offset = begin * duration; const offset = begin * duration;
duration = ((end - begin) * duration) / Math.abs(speed); 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 bufferSource.start(t, offset); // duration does not work here for some reason
} else { } else {
bufferSource.start(t, offset, duration); bufferSource.start(t, offset, duration);
} }
chain.push(bufferSource); chain.push(bufferSource);
if (soundfont || choke) { if (soundfont || clip) {
const env = ac.createGain(); const env = ac.createGain();
const releaseLength = 0.1; const releaseLength = 0.1;
env.gain.value = 0.6; env.gain.value = 0.6;

View File

@ -47,7 +47,7 @@ const maxPan = toMidi('C8');
const panwidth = (pan, width) => pan * width + (1 - width) / 2; const panwidth = (pan, width) => pan * width + (1 - width) / 2;
Pattern.prototype.piano = function () { Pattern.prototype.piano = function () {
return this.choke(1) return this.clip(1)
.s('piano') .s('piano')
.fmap((value) => { .fmap((value) => {
// pan by pitch // pan by pitch

View File

@ -1015,7 +1015,7 @@ x=>x.add(7).color('steelblue')
.cutoff(sine.slow(7).range(200,4000)) .cutoff(sine.slow(7).range(200,4000))
.resonance(10) .resonance(10)
//.hcutoff(400) //.hcutoff(400)
.choke(1) .clip(1)
.stack(s("bd:1*2,~ sd:0,[~ hh:0]*2")) .stack(s("bd:1*2,~ sd:0,[~ hh:0]*2"))
.out() .out()
.pianoroll({vertical:1})`; .pianoroll({vertical:1})`;