From 3fb4582d61c8c66975b870cdcf2680b3e3caa984 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 13 Feb 2022 21:48:30 +0100 Subject: [PATCH] add groove --- repl/src/groove.ts | 8 ++++++++ repl/src/parse.ts | 1 + repl/src/tunes.ts | 14 ++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 repl/src/groove.ts diff --git a/repl/src/groove.ts b/repl/src/groove.ts new file mode 100644 index 00000000..eb83d17a --- /dev/null +++ b/repl/src/groove.ts @@ -0,0 +1,8 @@ +import { Pattern as _Pattern } from '../../strudel.mjs'; + +const Pattern = _Pattern as any; + +// is this the same as struct? +Pattern.prototype.groove = function (groove) { + return groove.fmap(() => (v) => v).appLeft(this); +}; diff --git a/repl/src/parse.ts b/repl/src/parse.ts index ddc91a67..baa5a47e 100644 --- a/repl/src/parse.ts +++ b/repl/src/parse.ts @@ -5,6 +5,7 @@ import './tone'; import './midi'; import './voicings'; import './tonal'; +import './groove'; import * as toneStuff from './tone'; import shapeshifter from './shapeshifter'; diff --git a/repl/src/tunes.ts b/repl/src/tunes.ts index 751a753c..525fcb58 100644 --- a/repl/src/tunes.ts +++ b/repl/src/tunes.ts @@ -293,4 +293,18 @@ export const scaleTranspose = `stack(f2, f3, c4, ab4) .filter(800) .gain(0.5)`; +export const groove = `stack( + m('c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]') + .synth('sawtooth') + .filter(500) + .gain(.6), + m('[C^7 A7] [Dm7 G7]') + .groove(m('[x@2 x] [~@2 x] [~ x@2]@2 [x ~@2] ~ [~@2 x@4]@2')) + .voicings(['G3','A4']) + .synth('square') + .filter(1000) + .adsr(.1,.1,.2) + .gain(0.25) +).slow(4.5)`; + export default swimming;