mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
change "stride"/"offset" of successive degradeBy/chooseIn
This avoids (without fixing) #184). Note that the offset in tidal is currently 0.0001, but using this would result in excess correlation between sequential uses of random, which would manifest in failure of the 'supports the randome choice operator with nesting' test. So I just used 0.0002 instead
This commit is contained in:
parent
72f4d3efa8
commit
58dc46b445
@ -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') {
|
||||
|
||||
@ -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}",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user