From 1d56d7975774a97c040f05166e4e07c4072ef272 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 17 Apr 2022 23:18:01 +0100 Subject: [PATCH 1/6] add `striate()` --- packages/core/pattern.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 71f9755a..8f1f7d61 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -496,6 +496,13 @@ export class Pattern { return this._squeezeBind(func); } + _striate(n) { + const slices = Array.from({ length: n }, (x, i) => i); + const slice_objects = slices.map((i) => ({ begin: i / n, end: (i + 1) / n })); + const slicePat = slowcat(...slice_objects); + return this.union(slicePat)._fast(n); + } + // cpm = cycles per minute _cpm(cpm) { return this._fast(cpm / 60); @@ -732,6 +739,7 @@ Pattern.prototype.patternified = [ 'linger', 'ply', 'segment', + 'striate', 'slow', 'velocity', ]; From 884c13a22dbf3e2adff6d10e4979900b411d3a94 Mon Sep 17 00:00:00 2001 From: Matthew Kaney Date: Thu, 21 Apr 2022 13:14:37 -0400 Subject: [PATCH 2/6] Remove old files --- index.html | 14 -------------- snowpack.config.js | 21 --------------------- 2 files changed, 35 deletions(-) delete mode 100644 index.html delete mode 100644 snowpack.config.js diff --git a/index.html b/index.html deleted file mode 100644 index fa8d6105..00000000 --- a/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Bingo - - - - - - - - diff --git a/snowpack.config.js b/snowpack.config.js deleted file mode 100644 index 266476d8..00000000 --- a/snowpack.config.js +++ /dev/null @@ -1,21 +0,0 @@ -// Snowpack Configuration File -// See all supported options: https://www.snowpack.dev/reference/configuration - -/** @type {import("snowpack").SnowpackUserConfig } */ -module.exports = { - mount: { - /* ... */ - }, - plugins: [ - /* ... */ - ], - packageOptions: { - /* ... */ - }, - devOptions: { - /* ... */ - }, - buildOptions: { - /* ... */ - }, -}; From 52840f91419c70ac8fb5aa1f75f82aa249c03beb Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 22 Apr 2022 11:48:57 +0200 Subject: [PATCH 3/6] add tune + fix another --- repl/src/tunes.mjs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/repl/src/tunes.mjs b/repl/src/tunes.mjs index fbb4b0aa..23693556 100644 --- a/repl/src/tunes.mjs +++ b/repl/src/tunes.mjs @@ -734,8 +734,8 @@ const bass = await sampler({ bell = bell.chain(vol(0.6).connect(delay),out()); "0".euclidLegato(3,8) + .echo(3, 1/16, .5) .add(rand.range(0,12)) - .echo(3, 1/16, (x,n)=>x.add((n+1)*2).velocity(1/(n+1))) .velocity(rand.range(.5,1)) .legato(rand.range(.4,3)) .scale(slowcat('D minor pentatonic')).tone(bell) @@ -808,3 +808,19 @@ stack( //.pianoroll({minMidi:20, maxMidi:160}) // strudel disable-highlighting`; + +export const festivalOfFingers3 = `"[-7*3],0,2,6,[8 7]" +.echoWith(4,1/4, (x,n)=>x + .add(n*7) + .velocity(1/(n+1)) + .legato(1/(n+1))) +.velocity(perlin.range(.5,.9).slow(8)) +.stack("[22 25]*3" + .legato(sine.range(.5,2).slow(8)) + .velocity(sine.range(.4,.8).slow(5)) + .echo(4,1/12,.5)) +.scale(slowcat('D dorian','G mixolydian','C dorian','F mixolydian')) +.legato(1) +.slow(2) +.tone((await piano()).toDestination()) +//.pianoroll({maxMidi:160})`; From 72eeaf446e3d5e186d63cc0d2276f0723cde017a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 22 Apr 2022 12:40:23 +0200 Subject: [PATCH 4/6] fix: cycleArg imprecise fraction operation --- packages/core/timespan.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/timespan.mjs b/packages/core/timespan.mjs index 97ab74f1..5c398da1 100644 --- a/packages/core/timespan.mjs +++ b/packages/core/timespan.mjs @@ -33,7 +33,7 @@ export class TimeSpan { // (Note that the output timespan probably does not start *at* Time 0 -- // that only happens when the input Arc starts at an integral Time.) const b = this.begin.cyclePos(); - const e = b + (this.end - this.begin); + const e = b.add(this.end.sub(this.begin)); return new TimeSpan(b, e); } From 2c224d5092f71b2688327d7eae11b60a9b4b551b Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 22 Apr 2022 11:46:34 +0100 Subject: [PATCH 5/6] Make comparisons rational in _compress --- packages/core/pattern.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 7014aa61..ab2675a9 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -468,7 +468,7 @@ export class Pattern { } _compress(b, e) { - if (b > e || b > 1 || e > 1 || b < 0 || e < 0) { + if (b.gt(e) || b.gt(1) || e.gt(1) || b.lt(0) || e.lt(0)) { return silence; } return this._fastGap(Fraction(1).div(e.sub(b)))._late(b); From 87cfa305084705d215957fbfd70bf5738fa76d68 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 22 Apr 2022 11:51:41 +0100 Subject: [PATCH 6/6] Extra test for ply (and prettify) --- packages/core/test/pattern.test.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index f2b255d2..b4989b71 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -441,7 +441,10 @@ describe('Pattern', function () { ); }); it('Can structure a continuous pattern', () => { - assert.deepStrictEqual(steady('a').struct(true, [true, true]).firstCycle(), sequence('a', ['a', 'a']).firstCycle()); + assert.deepStrictEqual( + steady('a').struct(true, [true, true]).firstCycle(), + sequence('a', ['a', 'a']).firstCycle(), + ); }); }); describe('mask()', function () { @@ -634,6 +637,10 @@ describe('Pattern', function () { sequence(pure('a').fast(3), [pure('b').fast(3), pure('c').fast(3)]).firstCycle(), ); }); + it('Doesnt drop events in the 9th cycle', () => { + // fixed with https://github.com/tidalcycles/strudel/commit/72eeaf446e3d5e186d63cc0d2276f0723cde017a + assert.equal(sequence(1, 2, 3).ply(2).early(8).firstCycle().length, 6); + }); }); describe('chop', () => { it('Can _chop(2)', () => {