mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +00:00
Make param args a sequence, remove some redundancy
This commit is contained in:
parent
89a7bd4e7d
commit
e28a411408
@ -1,23 +1,37 @@
|
||||
import { Pattern } from '@strudel.cycles/core/strudel.mjs';
|
||||
import { Pattern, sequence } from '@strudel.cycles/core/strudel.mjs';
|
||||
|
||||
const _name = (name, pat) => pat.withValue(x => ({ [name]: x }));
|
||||
const _name = (name, ...pats) => sequence(...pats).withValue((x) => ({ [name]: x }));
|
||||
|
||||
export const s = pat => _name("s", pat);
|
||||
Pattern.prototype.s = function (pat) { return (this.union(s(pat))) };
|
||||
export const snd = s;
|
||||
Pattern.prototype.snd = Pattern.prototype.s;
|
||||
const _unionise = (func) =>
|
||||
function (...pats) {
|
||||
return this.union(func(...pats));
|
||||
};
|
||||
|
||||
export const s = (...pats) => _name('s', ...pats);
|
||||
Pattern.prototype.s = _unionise(s);
|
||||
export const sound = s;
|
||||
Pattern.prototype.sound = Pattern.prototype.s;
|
||||
export const n = pat => _name("n", pat);
|
||||
Pattern.prototype.n = function (pat) { return (this.union(n(pat))) };
|
||||
export const num = n;
|
||||
Pattern.prototype.num = Pattern.prototype.n;
|
||||
|
||||
export const n = (pat) => _name('n', pat);
|
||||
Pattern.prototype.n = _unionise(n);
|
||||
export const number = n;
|
||||
Pattern.prototype.number = Pattern.prototype.n;
|
||||
export const room = pat => _name("room", pat);
|
||||
Pattern.prototype.room = function (pat) { return (this.union(room(pat))) };
|
||||
export const size = pat => _name("size", pat);
|
||||
Pattern.prototype.size = function (pat) { return (this.union(size(pat))) };
|
||||
export const speed = pat => _name("speed", pat);
|
||||
Pattern.prototype.speed = function (pat) { return (this.union(speed(pat))) };
|
||||
|
||||
export const room = (pat) => _name('room', pat);
|
||||
Pattern.prototype.room = _unionise(room);
|
||||
|
||||
export const size = (pat) => _name('size', pat);
|
||||
Pattern.prototype.size = _unionise(size);
|
||||
|
||||
export const speed = (pat) => _name('speed', pat);
|
||||
Pattern.prototype.speed = _unionise(speed);
|
||||
|
||||
export const squiz = (pat) => _name('squiz', pat);
|
||||
Pattern.prototype.squiz = _unionise(squiz);
|
||||
|
||||
// currently overwritten by tone package
|
||||
export const gain = (pat) => _name('gain', pat);
|
||||
Pattern.prototype.gain = _unionise(gain);
|
||||
|
||||
export const vowel = (pat) => _name('vowel', pat);
|
||||
Pattern.prototype.vowel = _unionise(vowel);
|
||||
Loading…
x
Reference in New Issue
Block a user