This commit is contained in:
Felix Roos 2022-03-23 20:12:35 +01:00
parent c71be675aa
commit c0bd0966a8
5 changed files with 14 additions and 4 deletions

View File

@ -444,6 +444,9 @@ class Pattern {
_slow(factor) {
return this._fast(Fraction(1).div(factor));
}
_cpm(cpm) {
return this._fast(cpm / 60);
}
_early(offset) {
offset = Fraction(offset);
return this.withQueryTime((t) => t.add(offset)).withEventTime((t) => t.sub(offset));
@ -559,7 +562,7 @@ class Pattern {
return this._withContext((context) => ({...context, velocity: (context.velocity || 1) * velocity}));
}
}
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"];
Pattern.prototype.factories = {pure, stack, slowcat, fastcat, cat, timeCat, sequence, polymeter, pm, polyrhythm, pr};
const silence = new Pattern((_) => []);
function pure(value) {

View File

@ -18,6 +18,7 @@ Pattern.prototype.pianoroll = function({
events.forEach((event) => {
const isActive = event.whole.begin <= t && event.whole.end >= t;
ctx.fillStyle = isActive ? active : inactive;
ctx.globalAlpha = event.context.velocity ?? 1;
const x = Math.round(event.whole.begin / timeframe * w);
const width = Math.round((event.whole.end - event.whole.begin) / timeframe * w);
const y = Math.round(h - (Number(event.value) - minMidi) / midiRange * h);

View File

@ -42715,6 +42715,10 @@ class Pattern {
_slow(factor) {
return this._fast(_fractionMjsDefault.default(1).div(factor));
}
// cpm = cycles per minute
_cpm(cpm) {
return this._fast(cpm / 60);
}
_early(offset) {
// Equivalent of Tidal's <~ operator
offset = _fractionMjsDefault.default(offset);
@ -42876,6 +42880,7 @@ Pattern.prototype.patternified = [
'apply',
'fast',
'slow',
'cpm',
'early',
'late',
'duration',
@ -136422,6 +136427,7 @@ _strudelMjs.Pattern.prototype.pianoroll = function({ timeframe =10 , inactive ='
events.forEach((event)=>{
const isActive = event.whole.begin <= t && event.whole.end >= t;
ctx.fillStyle = isActive ? active : inactive;
ctx.globalAlpha = event.context.velocity ?? 1;
const x = Math.round(event.whole.begin / timeframe * w);
const width = Math.round((event.whole.end - event.whole.begin) / timeframe * w);
const y = Math.round(h - (Number(event.value) - minMidi) / midiRange * h);
@ -183327,4 +183333,4 @@ exports.default = cx;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
//# sourceMappingURL=index.95a69858.js.map
//# sourceMappingURL=index.74a36131.js.map

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,6 @@
<body>
<div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/tutorial/index.95a69858.js" defer=""></script>
<script src="/tutorial/index.74a36131.js" defer=""></script>
</body>
</html>