This commit is contained in:
Felix Roos 2022-03-17 22:19:37 +01:00
parent e694475556
commit 1182d0e45d
5 changed files with 27 additions and 15 deletions

8
docs/dist/euclid.js vendored
View File

@ -1,4 +1,4 @@
import {Pattern} from "../_snowpack/link/strudel.js";
import {Pattern, timeCat} from "../_snowpack/link/strudel.js";
import bjork from "../_snowpack/pkg/bjork.js";
import {rotate} from "../_snowpack/link/util.js";
const euclid = (pulses, steps, rotation = 0) => {
@ -11,4 +11,10 @@ const euclid = (pulses, steps, rotation = 0) => {
Pattern.prototype.euclid = function(pulses, steps, rotation = 0) {
return this.struct(euclid(pulses, steps, rotation));
};
Pattern.prototype.euclidLegato = function(pulses, steps, rotation = 0) {
const bin_pat = euclid(pulses, steps, rotation);
const firstOne = bin_pat.indexOf(1);
const gapless = rotate(bin_pat, firstOne).join("").split("1").slice(1).map((s) => [s.length + 1, true]);
return this.struct(timeCat(...gapless)).late(firstOne / steps);
};
export default euclid;

View File

@ -24,13 +24,11 @@ Pattern.prototype.voicings = function(range) {
}));
});
};
Pattern.prototype.rootNotes = function(octave = 2) {
Pattern.prototype._rootNotes = function(octave = 2) {
return this.fmap((value) => {
const [_, root] = value.match(/^([a-gA-G][b#]?).*$/);
return root + octave;
});
};
Pattern.prototype.define("voicings", (range, pat) => pat.voicings(range), {composable: true});
Pattern.prototype.define("rootNotes", (pat) => {
return pat.rootNotes();
}, {composable: true});
Pattern.prototype.define("rootNotes", (oct, pat) => pat.rootNotes(oct), {composable: true, patternified: true});

View File

@ -59696,8 +59696,7 @@ Pattern.prototype.voicings = function(range) {
);
});
};
Pattern.prototype.rootNotes = function(octave = 2) {
// range = ['G1', 'C3']
Pattern.prototype._rootNotes = function(octave = 2) {
return this.fmap((value)=>{
const [_, root] = value.match(/^([a-gA-G][b#]?).*$/);
return root + octave;
@ -59707,11 +59706,10 @@ Pattern.prototype.define('voicings', (range, pat)=>pat.voicings(range)
, {
composable: true
});
Pattern.prototype.define('rootNotes', (pat)=>{
// console.log('call rootNotes ...', pat);
return pat.rootNotes();
}, {
composable: true
Pattern.prototype.define('rootNotes', (oct, pat)=>pat.rootNotes(oct)
, {
composable: true,
patternified: true
});
},{"../../strudel.mjs":"ggZqJ","chord-voicings":"bZACi","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"bZACi":[function(require,module,exports) {
@ -136278,6 +136276,16 @@ const euclid = (pulses, steps, rotation = 0)=>{
_strudelMjs.Pattern.prototype.euclid = function(pulses, steps, rotation = 0) {
return this.struct(euclid(pulses, steps, rotation));
};
_strudelMjs.Pattern.prototype.euclidLegato = function(pulses, steps, rotation = 0) {
const bin_pat = euclid(pulses, steps, rotation);
const firstOne = bin_pat.indexOf(1);
const gapless = _utilMjs.rotate(bin_pat, firstOne).join('').split('1').slice(1).map((s)=>[
s.length + 1,
true
]
);
return this.struct(_strudelMjs.timeCat(...gapless)).late(firstOne / steps);
};
exports.default = euclid;
},{"../../strudel.mjs":"ggZqJ","bjork":"hTZTb","../../util.mjs":"9Z602","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"hTZTb":[function(require,module,exports) {
@ -183283,4 +183291,4 @@ exports.default = cx;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
//# sourceMappingURL=index.df5f5725.js.map
//# sourceMappingURL=index.dd5b0e5b.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.df5f5725.js" defer=""></script>
<script src="/tutorial/index.dd5b0e5b.js" defer=""></script>
</body>
</html>