avoid floating point inaccuracy by using Fraction
This commit is contained in:
parent
d7b83e200c
commit
7f50bcebd2
1 changed files with 2 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||||
|
|
||||||
import { timeCat, register, silence } from './pattern.mjs';
|
import { timeCat, register, silence } from './pattern.mjs';
|
||||||
import { rotate, flatten, splitAt, zipWith } from './util.mjs';
|
import { rotate, flatten, splitAt, zipWith } from './util.mjs';
|
||||||
|
import Fraction, { lcm } from './fraction.mjs';
|
||||||
|
|
||||||
const left = function (n, x) {
|
const left = function (n, x) {
|
||||||
const [ons, offs] = n;
|
const [ons, offs] = n;
|
||||||
|
|
@ -165,7 +166,7 @@ const _euclidLegato = function (pulses, steps, rotation, pat) {
|
||||||
.split('1')
|
.split('1')
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.map((s) => [s.length + 1, true]);
|
.map((s) => [s.length + 1, true]);
|
||||||
return pat.struct(timeCat(...gapless)).late(rotation / steps);
|
return pat.struct(timeCat(...gapless)).late(Fraction(rotation).div(steps));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const euclidLegato = register(['euclidLegato'], function (pulses, steps, pat) {
|
export const euclidLegato = register(['euclidLegato'], function (pulses, steps, pat) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue