From c71be675aa0a16d9bf58b47f5113b9edb1a7d9f8 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 23 Mar 2022 20:09:49 +0100 Subject: [PATCH] add cpm --- strudel.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/strudel.mjs b/strudel.mjs index 72a3fff3..ac04568c 100644 --- a/strudel.mjs +++ b/strudel.mjs @@ -607,6 +607,11 @@ class Pattern { return this._fast(Fraction(1).div(factor)) } + // cpm = cycles per minute + _cpm(cpm) { + return this._fast(cpm / 60); + } + _early(offset) { // Equivalent of Tidal's <~ operator offset = Fraction(offset) @@ -759,7 +764,7 @@ class Pattern { } // methods of Pattern that get callable factories -Pattern.prototype.patternified = ['apply', 'fast', 'slow', 'early', 'late', 'duration', 'legato', 'velocity', 'segment']; +Pattern.prototype.patternified = ['apply', 'fast', 'slow', 'cpm', 'early', 'late', 'duration', 'legato', 'velocity', 'segment']; // methods that create patterns, which are added to patternified Pattern methods Pattern.prototype.factories = { pure, stack, slowcat, fastcat, cat, timeCat, sequence, polymeter, pm, polyrhythm, pr}; // the magic happens in Pattern constructor. Keeping this in prototype enables adding methods from the outside (e.g. see tonal.ts)