From 9170eadbb0ca5edd1b08ded3b75051d8823b485b Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 22 Feb 2022 20:47:55 +0100 Subject: [PATCH] replace groove with struct + delete groove --- repl/src/evaluate.ts | 1 - repl/src/groove.ts | 10 ---------- repl/src/shapeshifter.js | 3 --- repl/src/tunes.ts | 24 ++++++++++++------------ repl/src/tutorial/tutorial.mdx | 12 ++++++------ 5 files changed, 18 insertions(+), 32 deletions(-) delete mode 100644 repl/src/groove.ts diff --git a/repl/src/evaluate.ts b/repl/src/evaluate.ts index 0eddc937..ce6b85b7 100644 --- a/repl/src/evaluate.ts +++ b/repl/src/evaluate.ts @@ -3,7 +3,6 @@ import './tone'; import './midi'; import './voicings'; import './tonal'; -import './groove'; import shapeshifter from './shapeshifter'; import { minify } from './parse'; import * as Tone from 'tone'; diff --git a/repl/src/groove.ts b/repl/src/groove.ts deleted file mode 100644 index fac9e5da..00000000 --- a/repl/src/groove.ts +++ /dev/null @@ -1,10 +0,0 @@ -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); -}; - -Pattern.prototype.define('groove', (groove, pat) => pat.groove(groove), { composable: true }); diff --git a/repl/src/shapeshifter.js b/repl/src/shapeshifter.js index 3bd53a28..6fad80ff 100644 --- a/repl/src/shapeshifter.js +++ b/repl/src/shapeshifter.js @@ -340,6 +340,3 @@ function getLocationObject(node, locations) { }; } -// TODO: turn x.groove['[~ x]*2'] into x.groove('[~ x]*2'.m) -// and ['c1*2'].xx into 'c1*2'.m.xx ?? -// or just all templated strings?? x.groove(`[~ x]*2`) diff --git a/repl/src/tunes.ts b/repl/src/tunes.ts index 39e4730a..64d71fed 100644 --- a/repl/src/tunes.ts +++ b/repl/src/tunes.ts @@ -284,7 +284,7 @@ export const giantStepsReggae = `stack( "Eb^7 [Am7 D7] G^7 [C#m7 F#7]", "B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]" ) - .groove("~ [x ~]".fast(4*8)) + .struct("~ [x ~]".fast(4*8)) .voicings(['E3', 'G4']), // bass cat( @@ -293,7 +293,7 @@ export const giantStepsReggae = `stack( "[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]", "[B2 F#2] [F2 Bb2] [Eb2 Bb2] [C#2 F#2]" ) - .groove("x ~".fast(4*8)) + .struct("x ~".fast(4*8)) ).slow(25)`; export const transposedChordsHacked = `stack( @@ -308,9 +308,9 @@ export const scaleTranspose = `stack(f2, f3, c4, ab4) .scaleTranspose(sequence(0, -1, -2, -3).slow(4)) .transpose(sequence(0, 1).slow(16))`; -export const groove = `stack( +export const struct = `stack( "c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]", - "[C^7 A7] [Dm7 G7]".groove("[x@2 x] [~@2 x] [~ x@2]@2 [x ~@2] ~ [~@2 x@4]@2") + "[C^7 A7] [Dm7 G7]".struct("[x@2 x] [~@2 x] [~ x@2]@2 [x ~@2] ~ [~@2 x@4]@2") .voicings(['G3','A4']) ).slow(4)`; @@ -398,8 +398,8 @@ export const loungerave = `() => { const thru = (x) => x.transpose("<0 1>/8").transpose(1); const synths = stack( - "/2".groove("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2").edit(thru).tone(bass), - "/2".groove("~ [x@0.1 ~]").voicings().edit(thru).every(2, early(1/4)).tone(keys).bypass("<0@7 1>/8".early(1/4)) + "/2".struct("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2").edit(thru).tone(bass), + "/2".struct("~ [x@0.1 ~]").voicings().edit(thru).every(2, early(1/4)).tone(keys).bypass("<0@7 1>/8".early(1/4)) ) return stack( drums, @@ -425,15 +425,15 @@ export const caverave = `() => { const thru = (x) => x.transpose("<0 1>/8").transpose(-1); const synths = stack( - "/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).groove("[~ x]*2") + "/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).struct("[~ x]*2") .edit( scaleTranspose(0).early(0), scaleTranspose(2).early(1/8), scaleTranspose(7).early(1/4), scaleTranspose(8).early(3/8) ).edit(thru).tone(keys).bypass("<1 0>/16"), - "/2".groove("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).edit(thru).tone(bass), - "/2".groove("~ [x@0.1 ~]".fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4)) + "/2".struct("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).edit(thru).tone(bass), + "/2".struct("~ [x@0.1 ~]".fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4)) ) return stack( drums.fast(2), @@ -447,9 +447,9 @@ export const callcenterhero = `()=>{ const bass = fmsynth({...osc('sawtooth6'),...adsr(0.05,.6,0.8,0.1)}).chain(vol(0.6), out); const s = scale(slowcat('F3 minor', 'Ab3 major', 'Bb3 dorian', 'C4 phrygian dominant').slow(4)); return stack( - "0 2".groove(" [x ~]").edit(s).scaleTranspose(stack(0,2)).tone(lead), - "<6 7 9 7>".groove("[~ [x ~]*2]*2").edit(s).scaleTranspose("[0,2] [2,4]".fast(2).every(4,rev)).tone(lead), - "-14".groove("[~ x@0.8]*2".early(0.01)).edit(s).tone(bass), + "0 2".struct(" [x ~]").edit(s).scaleTranspose(stack(0,2)).tone(lead), + "<6 7 9 7>".struct("[~ [x ~]*2]*2").edit(s).scaleTranspose("[0,2] [2,4]".fast(2).every(4,rev)).tone(lead), + "-14".struct("[~ x@0.8]*2".early(0.01)).edit(s).tone(bass), "c2*2".tone(membrane().chain(vol(0.6), out)), "~ c2".tone(noise().chain(vol(0.2), out)), "c4*4".tone(metal(adsr(0,.05,0)).chain(vol(0.03), out)) diff --git a/repl/src/tutorial/tutorial.mdx b/repl/src/tutorial/tutorial.mdx index 38fa074d..23636d55 100644 --- a/repl/src/tutorial/tutorial.mdx +++ b/repl/src/tutorial/tutorial.mdx @@ -32,15 +32,15 @@ To get a taste of what Strudel can do, check out this track: const thru = (x) => x.transpose("<0 1>/8").transpose(-1); const synths = stack( - "/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).groove("[~ x]*2") + "/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).struct("[~ x]*2") .edit( scaleTranspose(0).early(0), scaleTranspose(2).early(1/8), scaleTranspose(7).early(1/4), scaleTranspose(8).early(3/8) ).edit(thru).tone(keys).bypass("<1 0>/16"), - "/2".groove("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).edit(thru).tone(bass), - "/2".groove("~ [x@0.1 ~]".fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4)) + "/2".struct("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).edit(thru).tone(bass), + "/2".struct("~ [x@0.1 ~]".fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4)) ) return stack( drums.fast(2), @@ -364,7 +364,7 @@ TODO: should the function really run the first cycle? - append - superimpose - internal Pattern functions? -- groove, TODO move to core from https://github.com/tidalcycles/strudel/blob/main/repl/src/groove.ts +- struct ## Tone API @@ -573,11 +573,11 @@ Turns chord symbols into root notes of chords in given octave. ".rootNotes(3)`} /> -Together with edit, groove and voicings, this can be used to create a basic backing track: +Together with edit, struct and voicings, this can be used to create a basic backing track: ".edit( - x => x.voicings(['d3','g4']).groove("~ x"), + x => x.voicings(['d3','g4']).struct("~ x"), x => x.rootNotes(2).tone(synth(osc('sawtooth4')).chain(out)) )`} />