This commit is contained in:
Jade (Rose) Rowland 2024-05-03 14:56:16 -04:00
parent 47b65846e9
commit 496d60dc1c
7 changed files with 98 additions and 9 deletions

View file

@ -430,6 +430,17 @@ export const { crush } = registerControl('crush');
*/
export const { coarse } = registerControl('coarse');
/**
* modulate the output gain of a sound with a continuous wave
*
* @name gainmod
* @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.
* @example
* s("triangle").gainmod("2:1:0")
*
*/
export const { gainmod } = registerControl('gainmod');
/**
* Allows you to set the output channels on the interface
*

View file

@ -56,7 +56,7 @@ export class Cyclist {
// the following line is dumb and only here for backwards compatibility
// see https://github.com/tidalcycles/strudel/pull/1004
const deadline = targetTime - phase;
onTrigger?.(hap, deadline, duration, this.cps, targetTime);
onTrigger?.(hap, deadline, duration, this.cps, targetTime, end);
}
});
} catch (e) {

View file

@ -4,6 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import Fraction from 'fraction.js';
import { logger } from './logger.mjs';
export class NeoCyclist {
@ -86,7 +87,15 @@ export class NeoCyclist {
this.latency +
this.worker_time_dif;
const duration = hap.duration / this.cps;
onTrigger?.(hap, 0, duration, this.cps, targetTime);
onTrigger?.(
hap,
0,
duration,
this.cps,
targetTime,
this.cycle,
// + Fraction(this.latency).div(this.cps)
);
}
});
};

View file

@ -178,15 +178,15 @@ export function repl({
export const getTrigger =
({ getTime, defaultOutput }) =>
async (hap, deadline, duration, cps, t) => {
async (hap, deadline, duration, cps, t, cycle = 0) => {
// TODO: get rid of deadline after https://github.com/tidalcycles/strudel/pull/1004
try {
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
await defaultOutput(hap, deadline, duration, cps, t);
await defaultOutput(hap, deadline, duration, cps, t, cycle);
}
if (hap.context.onTrigger) {
// call signature of output / onTrigger is different...
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps, t);
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps, t, cycle);
}
} catch (err) {
logger(`[cyclist] error: ${err.message}`, 'error');