diff --git a/packages/mini/mini.mjs b/packages/mini/mini.mjs index c6b1d50e..416203e2 100644 --- a/packages/mini/mini.mjs +++ b/packages/mini/mini.mjs @@ -11,6 +11,7 @@ import { addMiniLocations } from '@strudel.cycles/eval/shapeshifter.mjs'; const { pure, Pattern, Fraction, stack, slowcat, sequence, timeCat, silence, reify } = strudel; var _seedState = 0; +const randOffset = 0.0002; function _nextSeed() { return _seedState++; @@ -28,7 +29,7 @@ const applyOptions = (parent) => (pat, i) => { case 'bjorklund': return pat.euclid(operator.arguments_.pulse, operator.arguments_.step, operator.arguments_.rotation); case 'degradeBy': - return reify(pat)._degradeByWith(strudel.rand.early(Math.PI * _nextSeed()).segment(1), operator.arguments_.amount); + return reify(pat)._degradeByWith(strudel.rand.early(randOffset * _nextSeed()).segment(1), operator.arguments_.amount); // TODO: case 'fixed-step': "%" } console.warn(`operator "${operator.type_}" not implemented`); @@ -91,7 +92,7 @@ export function patternifyAST(ast) { return stack(...children); } if (alignment === 'r') { - return strudel.chooseInWith(strudel.rand.early(Math.PI * _nextSeed()).segment(1), children); + return strudel.chooseInWith(strudel.rand.early(randOffset * _nextSeed()).segment(1), children); } const weightedChildren = ast.source_.some((child) => !!child.options_?.weight); if (!weightedChildren && alignment === 't') { diff --git a/repl/src/test/__snapshots__/tunes.test.mjs.snap b/repl/src/test/__snapshots__/tunes.test.mjs.snap index d833c751..47a2b223 100644 --- a/repl/src/test/__snapshots__/tunes.test.mjs.snap +++ b/repl/src/test/__snapshots__/tunes.test.mjs.snap @@ -318,10 +318,10 @@ exports[`renders tunes > tune: bossa 1`] = ` exports[`renders tunes > tune: bossaRandom 1`] = ` [ - "0/1 -> 1/2: {\\"note\\":\\"G4\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5601851851851851}", - "0/1 -> 1/2: {\\"note\\":\\"B4\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5787037037037037}", - "0/1 -> 1/2: {\\"note\\":\\"C5\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5833333333333333}", - "0/1 -> 1/2: {\\"note\\":\\"E5\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.6018518518518519}", + "0/1 -> 1/4: {\\"note\\":\\"G4\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5601851851851851}", + "0/1 -> 1/4: {\\"note\\":\\"B4\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5787037037037037}", + "0/1 -> 1/4: {\\"note\\":\\"C5\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5833333333333333}", + "0/1 -> 1/4: {\\"note\\":\\"E5\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.6018518518518519}", "3/4 -> 1/1: {\\"note\\":\\"G4\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5601851851851851}", "3/4 -> 1/1: {\\"note\\":\\"B4\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5787037037037037}", "3/4 -> 1/1: {\\"note\\":\\"C5\\",\\"clip\\":1,\\"s\\":\\"piano\\",\\"pan\\":0.5833333333333333}",