mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-04 22:52:55 -04:00
li
This commit is contained in:
+10
-15
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
pattern.mjs - Core pattern representation for strudel
|
||||
Copyright (C) 2025 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/pattern.mjs>
|
||||
Copyright (C) 2025 Strudel contributors - see <https://codeberg.org/uzu/strudel/src/branch/main/packages/core/pattern.mjs>
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
numeralArgs,
|
||||
parseNumeral,
|
||||
pairs,
|
||||
noteToMidi
|
||||
noteToMidi,
|
||||
} from './util.mjs';
|
||||
import drawLine from './drawLine.mjs';
|
||||
import { logger } from './logger.mjs';
|
||||
@@ -1815,9 +1815,9 @@ export const { fastGap, fastgap } = register(['fastGap', 'fastgap'], function (f
|
||||
const newWhole = !hap.whole
|
||||
? undefined
|
||||
: new TimeSpan(
|
||||
newPart.begin.sub(begin.sub(hap.whole.begin).div(factor)),
|
||||
newPart.end.add(hap.whole.end.sub(end).div(factor)),
|
||||
);
|
||||
newPart.begin.sub(begin.sub(hap.whole.begin).div(factor)),
|
||||
newPart.end.add(hap.whole.end.sub(end).div(factor)),
|
||||
);
|
||||
return new Hap(newWhole, newPart, hap.value, hap.context);
|
||||
};
|
||||
return pat.withQuerySpanMaybe(qf).withHap(ef).splitQueries();
|
||||
@@ -3342,12 +3342,10 @@ export const { beat } = register(
|
||||
__beat((x) => x.innerJoin()),
|
||||
);
|
||||
|
||||
|
||||
|
||||
const __quantizeBy = (lens, scale, pat) => {
|
||||
// Supports ':' list syntax in mininotation
|
||||
scale = (Array.isArray(scale) ? scale.flat() : [scale]).flatMap((val) =>
|
||||
typeof val === 'number' ? val : noteToMidi(val) - 48
|
||||
typeof val === 'number' ? val : noteToMidi(val) - 48,
|
||||
);
|
||||
|
||||
return pat.withHap((hap) => {
|
||||
@@ -3374,8 +3372,7 @@ const __quantizeBy = (lens, scale, pat) => {
|
||||
|
||||
return hap.withValue(() => (isObject ? { ...hap.value, note } : note));
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Snap note values to a chosen array of notes within a 12 note/octave scale
|
||||
@@ -3383,8 +3380,6 @@ const __quantizeBy = (lens, scale, pat) => {
|
||||
* @example
|
||||
* note(irand(35).add(48).seg(16).quantize("d:a:a#:f")).s("pulse")
|
||||
*/
|
||||
export const { quantize } = register(
|
||||
['quantize'],
|
||||
(scale, pat) => { return __quantizeBy(12, scale, pat) },
|
||||
);
|
||||
|
||||
export const { quantize } = register(['quantize'], (scale, pat) => {
|
||||
return __quantizeBy(12, scale, pat);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user