mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-21 20:55:12 -04:00
fixed non synced clock
This commit is contained in:
@@ -434,12 +434,13 @@ export const { coarse } = registerControl('coarse');
|
||||
* modulate the amplitude of a sound with a continuous waveform
|
||||
*
|
||||
* @name am
|
||||
* @synonyms tremelo
|
||||
* @param {number | Pattern} speed modulation speed in cycles
|
||||
* @example
|
||||
* s("triangle").am("2").amshape("<tri saw ramp square>").amdepth(.5)
|
||||
*
|
||||
*/
|
||||
export const { am } = registerControl(['am', 'amdepth', 'amskew', 'amphase']);
|
||||
export const { am, tremolo } = registerControl(['am', 'amdepth', 'amskew', 'amphase'], 'tremolo');
|
||||
|
||||
/**
|
||||
* depth of amplitude modulation
|
||||
@@ -1582,7 +1583,6 @@ export const { zmod } = registerControl('zmod');
|
||||
// like crush but scaled differently
|
||||
export const { zcrush } = registerControl('zcrush');
|
||||
export const { zdelay } = registerControl('zdelay');
|
||||
export const { tremolo } = registerControl('tremolo');
|
||||
export const { zzfx } = registerControl('zzfx');
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,15 +34,7 @@ export class Cyclist {
|
||||
|
||||
try {
|
||||
const begin = this.lastEnd;
|
||||
|
||||
const end = this.num_cycles_at_cps_change + num_cycles_since_cps_change;
|
||||
let cycle2 = this.now();
|
||||
//magic number that fixes cycle calcuation, cycle is probably not being calculated correctly
|
||||
const modifier = this.cps * -interval;
|
||||
cycle2 = cycle2 + modifier;
|
||||
// let cycle = begin + (phase - t) * this.cps;
|
||||
// cycle = begin t
|
||||
// console.log({ phase, t, cycle2 });
|
||||
if (phase < t) {
|
||||
// avoid querying haps that are in the past anyway
|
||||
console.log(`skip query: too late`);
|
||||
@@ -51,23 +43,18 @@ export class Cyclist {
|
||||
|
||||
// query the pattern for events
|
||||
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
||||
let mod2 = t - phase - this.latency;
|
||||
mod2 = mod2 * this.cps;
|
||||
console.log(this.clock.duration);
|
||||
const cycle_gap = (t - phase - this.latency) * this.cps;
|
||||
|
||||
haps.forEach((hap) => {
|
||||
if (hap.hasOnset()) {
|
||||
const targetTime =
|
||||
(hap.whole.begin - this.num_cycles_at_cps_change) / this.cps + this.seconds_at_cps_change + latency;
|
||||
const duration = hap.duration / this.cps;
|
||||
const cycle = hap.whole.begin.valueOf() + cycle_gap;
|
||||
// the following line is dumb and only here for backwards compatibility
|
||||
// see https://github.com/tidalcycles/strudel/pull/1004
|
||||
|
||||
const deadline = targetTime - phase;
|
||||
// console.log();
|
||||
let cycle = hap.whole.begin.valueOf() + mod2;
|
||||
|
||||
// console.log({ cycle, cycle2, mod2 });
|
||||
onTrigger?.(hap, deadline, duration, this.cps, targetTime, cycle);
|
||||
const _deadline = targetTime - phase;
|
||||
onTrigger?.(hap, _deadline, duration, this.cps, targetTime, cycle);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user