Merge branch 'main' into glossing/filter-lfo
This commit is contained in:
commit
99b3c04a76
6 changed files with 16 additions and 13 deletions
|
|
@ -57,7 +57,7 @@ export class Cyclist {
|
||||||
}
|
}
|
||||||
|
|
||||||
// query the pattern for events
|
// query the pattern for events
|
||||||
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps, cyclist: 'cyclist' });
|
||||||
|
|
||||||
haps.forEach((hap) => {
|
haps.forEach((hap) => {
|
||||||
if (hap.hasOnset()) {
|
if (hap.hasOnset()) {
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,7 @@ export class NeoCyclist {
|
||||||
if (this.started === false) {
|
if (this.started === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps, cyclist: 'neocyclist' });
|
||||||
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
|
||||||
haps.forEach((hap) => {
|
haps.forEach((hap) => {
|
||||||
if (hap.hasOnset()) {
|
if (hap.hasOnset()) {
|
||||||
const timeUntilTrigger = cycleToSeconds(hap.whole.begin - this.cycle, this.cps);
|
const timeUntilTrigger = cycleToSeconds(hap.whole.begin - this.cycle, this.cps);
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,7 @@ export class Pattern {
|
||||||
|
|
||||||
// runs func on query state
|
// runs func on query state
|
||||||
withState(func) {
|
withState(func) {
|
||||||
return this.withHaps((haps, state) => {
|
return new Pattern((state) => this.query(func(state)));
|
||||||
func(state);
|
|
||||||
return haps;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,10 @@ export function repl({
|
||||||
}
|
}
|
||||||
let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions);
|
let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions);
|
||||||
if (Object.keys(pPatterns).length) {
|
if (Object.keys(pPatterns).length) {
|
||||||
let patterns = Object.values(pPatterns);
|
let patterns = [];
|
||||||
|
for (const [key, value] of Object.entries(pPatterns)) {
|
||||||
|
patterns.push(value.withState((state) => state.setControls({ id: key })));
|
||||||
|
}
|
||||||
if (eachTransform) {
|
if (eachTransform) {
|
||||||
// Explicit lambda so only element (not index and array) are passed
|
// Explicit lambda so only element (not index and array) are passed
|
||||||
patterns = patterns.map((x) => eachTransform(x));
|
patterns = patterns.map((x) => eachTransform(x));
|
||||||
|
|
@ -228,6 +231,7 @@ export function repl({
|
||||||
pattern = allTransforms[i](pattern);
|
pattern = allTransforms[i](pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPattern(pattern)) {
|
if (!isPattern(pattern)) {
|
||||||
const message = `got "${typeof evaluated}" instead of pattern`;
|
const message = `got "${typeof evaluated}" instead of pattern`;
|
||||||
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ export class State {
|
||||||
return this.setSpan(func(this.span));
|
return this.setSpan(func(this.span));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns new State with different controls
|
// Returns new State with added controls.
|
||||||
setControls(controls) {
|
setControls(controls) {
|
||||||
return new State(this.span, controls);
|
return new State(this.span, { ...this.controls, ...controls });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,13 @@ export async function prebake() {
|
||||||
// import('@strudel/osc'),
|
// import('@strudel/osc'),
|
||||||
);
|
);
|
||||||
// load samples
|
// load samples
|
||||||
const ds = 'https://raw.githubusercontent.com/felixroos/dough-samples/main/';
|
const ds = 'https://raw.githubusercontent.com/felixroos/dough-samples/main';
|
||||||
|
|
||||||
// TODO: move this onto the strudel repo
|
// TODO: move this onto the strudel repo
|
||||||
const ts = 'https://raw.githubusercontent.com/todepond/samples/main/';
|
const ts = 'https://raw.githubusercontent.com/todepond/samples/main';
|
||||||
|
|
||||||
|
const tc = 'https://raw.githubusercontent.com/tidalcycles/uzu-drumkit/main';
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
modulesLoading,
|
modulesLoading,
|
||||||
registerSynthSounds(),
|
registerSynthSounds(),
|
||||||
|
|
@ -36,9 +39,9 @@ export async function prebake() {
|
||||||
samples(`${ds}/tidal-drum-machines.json`),
|
samples(`${ds}/tidal-drum-machines.json`),
|
||||||
samples(`${ds}/piano.json`),
|
samples(`${ds}/piano.json`),
|
||||||
samples(`${ds}/Dirt-Samples.json`),
|
samples(`${ds}/Dirt-Samples.json`),
|
||||||
samples(`${ds}/uzu-drumkit.json`),
|
|
||||||
samples(`${ds}/vcsl.json`),
|
samples(`${ds}/vcsl.json`),
|
||||||
samples(`${ds}/mridangam.json`),
|
samples(`${ds}/mridangam.json`),
|
||||||
|
samples(`${tc}/strudel.json`),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
aliasBank(`${ts}/tidal-drum-machines-alias.json`);
|
aliasBank(`${ts}/tidal-drum-machines-alias.json`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue