mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
add euclidLegato
This commit is contained in:
parent
c1a0f11c39
commit
6c6a7cf136
@ -1,4 +1,4 @@
|
||||
import { Pattern } from '../../strudel.mjs';
|
||||
import { Pattern, timeCat } from '../../strudel.mjs';
|
||||
import bjork from 'bjork';
|
||||
import { rotate } from '../../util.mjs';
|
||||
|
||||
@ -14,4 +14,15 @@ 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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user