mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
refactor uses of voicings
+ fix usages of scaleTranspose
This commit is contained in:
parent
bc43fc9585
commit
b81a66f07e
@ -1533,7 +1533,7 @@ export const { firstOf, every } = register(['firstOf', 'every'], function (n, fu
|
||||
|
||||
/**
|
||||
* Like layer, but with a single function:
|
||||
* @name _apply
|
||||
* @name apply
|
||||
* @memberof Pattern
|
||||
* @example
|
||||
* "<c3 eb3 g3>".scale('C minor').apply(scaleTranspose("0,2,4")).note()
|
||||
|
||||
@ -31,6 +31,7 @@ export const voicingDictionaries = {
|
||||
* '7alt': ['3M 7m 10m 13m 15P'],
|
||||
* '7#11': ['7m 10m 13m 15P 17m'],
|
||||
* }, ['C3', 'C6'])
|
||||
* "<C^7 A7 Dm7 G7>".voicings('cookie').note()
|
||||
*/
|
||||
export const addVoicings = (name, dictionary, range = ['F3', 'A4']) => {
|
||||
Object.assign(voicingDictionaries, { [name]: { dictionary, range } });
|
||||
|
||||
@ -19,8 +19,7 @@ import { mini } from '@strudel.cycles/mini/mini.mjs';
|
||||
// import euclid from '@strudel.cycles/core/euclid.mjs';
|
||||
// import '@strudel.cycles/tone/tone.mjs';
|
||||
// import '@strudel.cycles/midi/midi.mjs';
|
||||
import '@strudel.cycles/tonal/voicings.mjs';
|
||||
import '@strudel.cycles/tonal/tonal.mjs';
|
||||
import * as tonalHelpers from '@strudel.cycles/tonal';
|
||||
import '@strudel.cycles/xen/xen.mjs';
|
||||
// import '@strudel.cycles/xen/tune.mjs';
|
||||
// import '@strudel.cycles/core/euclid.mjs';
|
||||
@ -164,6 +163,7 @@ evalScope(
|
||||
uiHelpersMocked,
|
||||
controls,
|
||||
webaudio,
|
||||
tonalHelpers,
|
||||
/* controls,
|
||||
toneHelpers,
|
||||
voicingHelpers,
|
||||
|
||||
@ -89,10 +89,11 @@ export const whirlyStrudel = `seq(e4, [b2, b3], c4)
|
||||
|
||||
export const transposedChordsHacked = `stack(
|
||||
"c2 eb2 g2",
|
||||
"Cm7".voicings(['g2','c4']).slow(2)
|
||||
"Cm7".voicings('lefthand').slow(2)
|
||||
).transpose(
|
||||
"<1 2 3 2>".slow(2)
|
||||
).transpose(5)`;
|
||||
// range ['g2','c4']
|
||||
|
||||
export const scaleTranspose = `"f2,f3,c4,ab4"
|
||||
.scale(seq('F minor', 'F harmonic minor').slow(4))
|
||||
@ -102,8 +103,9 @@ export const scaleTranspose = `"f2,f3,c4,ab4"
|
||||
export const struct = `stack(
|
||||
"c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]",
|
||||
"[C^7 A7] [Dm7 G7]".struct("[x@2 x] [~@2 x] [~ x@2]@2 [x ~@2] ~ [~@2 x@4]@2")
|
||||
.voicings(['G3','A4'])
|
||||
.voicings('lefthand')
|
||||
).slow(4)`;
|
||||
// range ['G3','A4']
|
||||
|
||||
export const magicSofa = `stack(
|
||||
"<C^7 F^7 ~> <Dm7 G7 A7 ~>"
|
||||
@ -197,7 +199,7 @@ export const giantStepsReggae = `stack(
|
||||
"B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]"
|
||||
)
|
||||
.struct("~ [x ~]".fast(4*8))
|
||||
.voicings(['E3', 'G4']),
|
||||
.voicings('lefthand'),
|
||||
// bass
|
||||
seq(
|
||||
"[B2 D2] [G2 D2] [Eb2 Bb2] [A2 D2]",
|
||||
@ -208,6 +210,8 @@ export const giantStepsReggae = `stack(
|
||||
.struct("x ~".fast(4*8))
|
||||
).slow(25).note()`;
|
||||
|
||||
// range ['E3', 'G4']
|
||||
|
||||
// TODO:
|
||||
/*
|
||||
export const xylophoneCalling = `// licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
@ -443,9 +447,11 @@ export const bossaRandom = `const chords = "<Am7 Am7 Dm7 E7>"
|
||||
const roots = chords.rootNotes(2)
|
||||
|
||||
stack(
|
||||
chords.voicings(['F4', 'A5']).struct(
|
||||
chords.voicings('lefthand').struct(
|
||||
\` x@2 ~ x ~ ~ ~ x |
|
||||
x? ~ ~ x@3 ~ x |
|
||||
x? ~ ~ x ~ x@3\`),
|
||||
roots.struct("x [~ x?0.2] x [~ x?] | x!4 | x@2 ~ ~ ~ x x x").transpose("0 7")
|
||||
).slow(2).pianoroll().note().piano()`;
|
||||
|
||||
// range ['F4', 'A5']
|
||||
|
||||
@ -81,7 +81,7 @@ stack(
|
||||
"[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]",
|
||||
"Eb^7 [Am7 D7] G^7 [C#m7 F#7]",
|
||||
"B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]"
|
||||
).voicings(['E3', 'G4']),
|
||||
).voicings('lefthand'),
|
||||
// bass
|
||||
seq(
|
||||
"[B2 D2] [G2 Bb2] [Eb2 Bb3] [A2 D2]",
|
||||
@ -90,6 +90,7 @@ stack(
|
||||
"[B2 F#2] [F2 Bb2] [Eb2 Bb3] [C#2 F#2]"
|
||||
)
|
||||
).slow(20).note()`;
|
||||
// range: ['E3', 'G4']
|
||||
|
||||
export const zeldasRescue = `// Koji Kondo - Princess Zelda's Rescue
|
||||
stack(
|
||||
@ -130,10 +131,10 @@ const synths = stack(
|
||||
"<eb4 d4 c4 b3>/2".scale(timeCat([3,'C minor'],[1,'C melodic minor'])
|
||||
.slow(8)).struct("[~ x]*2")
|
||||
.layer(
|
||||
scaleTranspose(0).early(0),
|
||||
scaleTranspose(2).early(1/8),
|
||||
scaleTranspose(7).early(1/4),
|
||||
scaleTranspose(8).early(3/8)
|
||||
x=>x.scaleTranspose(0).early(0),
|
||||
x=>x.scaleTranspose(2).early(1/8),
|
||||
x=>x.scaleTranspose(7).early(1/4),
|
||||
x=>x.scaleTranspose(8).early(3/8)
|
||||
).apply(thru).note().apply(keys).mask("<~ x>/16"),
|
||||
note("<C2 Bb1 Ab1 [G1 [G2 G1]]>/2".apply(thru))
|
||||
.struct("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2))
|
||||
@ -654,7 +655,7 @@ dino:{b4:'https://cdn.freesound.org/previews/316/316403_5123851-hq.mp3'}})
|
||||
stack(
|
||||
s('bass').loopAt(8).clip(1),
|
||||
s("bd*2, ~ sd,hh*4"),
|
||||
note("Abm7".voicings(['c3','a4']).struct("x(3,8,1)".slow(2))),
|
||||
note("Abm7".voicings('lefthand').struct("x(3,8,1)".slow(2))),
|
||||
"0 1 2 3".scale('ab4 minor pentatonic')
|
||||
.superimpose(x=>x.add(.1))
|
||||
.sometimes(x=>x.add(12))
|
||||
@ -665,6 +666,7 @@ note("Abm7".voicings(['c3','a4']).struct("x(3,8,1)".slow(2))),
|
||||
.degradeBy(.4).room(1),
|
||||
note("<b4 eb4>").s('dino').delay(.8).slow(8).room(.5)
|
||||
)`;
|
||||
// ['c3','a4']
|
||||
|
||||
export const sampleDemo = `// licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
// by Felix Roos
|
||||
|
||||
@ -2352,6 +2352,15 @@ exports[`runs examples > example "room" example index 0 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "rootNotes" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/1 | note:C2 ]",
|
||||
"[ 1/1 → 2/1 | note:A2 ]",
|
||||
"[ 2/1 → 3/1 | note:D2 ]",
|
||||
"[ 3/1 → 4/1 | note:G2 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "round" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/3 | note:D3 ]",
|
||||
|
||||
@ -769,7 +769,7 @@ Together with layer, struct and voicings, this can be used to create a basic bac
|
||||
|
||||
<MiniRepl
|
||||
tune={`"<C^7 A7b13 Dm7 G7>".layer(
|
||||
x => x.voicings(['d3','g4']).struct("~ x").note(),
|
||||
x => x.voicings('lefthand').struct("~ x").note(),
|
||||
x => x.rootNotes(2).note().s('sawtooth').cutoff(800)
|
||||
)`}
|
||||
/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user