diff --git a/examples/ameliewaltz.js b/examples/ameliewaltz.js new file mode 100644 index 0000000..9c3694b --- /dev/null +++ b/examples/ameliewaltz.js @@ -0,0 +1,16 @@ + +setDefaultVoicings('legacy') +stack( + n("[0@2 ~, ~ [[1,2,3] ~]!2]") + .chord("<[Dm Am]!2 [F C]!2>/4") + .anchor("<[B3 G3]!2 [C4 B3]!2>/4") + .voicing().velocity(0.5) + , + n("<[3@5.5 2@0.5 1@3 0@3] [3@3.5 [4 3 2 1 2]@2.5 1@3 0@3] [2@5.5 1@0.5 -3@6]!2>/4") + .scale("a4:minor") + +).s("gm_harmonica").lpf(4000).clip(1) + .attack(0.1).release(0.1) + .room(1.5) + .cpm(64).gain(.6) + .pianoroll() \ No newline at end of file diff --git a/examples/anniesroom.js b/examples/anniesroom.js new file mode 100644 index 0000000..ed9a90c --- /dev/null +++ b/examples/anniesroom.js @@ -0,0 +1,23 @@ +// "Up In Annie's Room" (work in progress) +// song @by The Sea Nymphs +// script @by eefano +setcps(90/60) + +const split = register('split', (deflt, callback, pat) => + callback(deflt.map((d,i)=>pat.withValue((v)=>Array.isArray(v)?(i/2".pickRestart([ +"/2", +"/2"]) + .layer(x=>x.chord().anchor('b4').voicing().s("gm_reed_organ").attack(0.1).release(1.5).room(1).rsize(4).gain(0.4), + x=>n("<0!32 [0,1,2,3,4]!24>/2").chord(x).anchor('c3').mode('root').voicing().s("gm_church_organ").room(1).rsize(4).gain(0.4), + x=>n("<[0,[~ 1@20],[~@2 2@20],[~@3 3@20],[~@4 4@20]]>/2").chord(x).anchor('e4').voicing().s("gm_acoustic_guitar_nylon").room(0.6).gain(0.5)) + +v: "<0@16 1@16 2@24>/2".pickRestart([ + "*2", + "*2","<~>*2"]) + .split([0,0],(x)=>note(x[0]).penv(x[1])) + .patt('0.4').s("gm_choir_aahs:5").room(1).gain(1) + +//d: s("") + diff --git a/examples/anothersatellite.js b/examples/anothersatellite.js new file mode 100644 index 0000000..6126da1 --- /dev/null +++ b/examples/anothersatellite.js @@ -0,0 +1,36 @@ +// "Another Satellite" (work in progress) +// song @by XTC +// script @by eefano +setcps(119/60) +samples({'gtr': {'g3': 'https://cdn.freesound.org/previews/705/705412_11110011-lq.mp3'}}) +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i/16".split([0,1],(y)=>y[0].pickRestart([ + "/2", + "<[bb2@3 eb3]!2 [c#3 f#3] [e3 d3] [g2@3 f3] [bb2@3 eb3] g2@2 >/8", + "/4", + "/4" +]).s('gtr').begin(.045).end(.5).clip(1).note().gain(.9).room(2).gain(.8).velocity(y[1])) + +vox: "<~@3 0:0.6@8 1 2 1 3@1.5 ~!2>/16".split([0,1],(y)=>y[0].pickRestart([ + `<~ d4:.7!3 d4:1 c4:.7!4 ~ f4 ~ d4@2:1 c4:1 bb3 ~ d4:.7!3 d4:1 c4:.7!4 d4!2 f4 d4!2 d4:1 db4 db4@3:1 ab3 ab3@2 ~@2 + [db4!3]@6 db4 db4@2:1 d4 d4 ~ d4 ~@3 d4@2 d4 d4@2 d4 e4 d4@3 b3 b3@2:1 a3:1 g3@2 ~ + ~ d4 d4@2 c4!3 c4@2 f4 d4@2:1 c4:1 bb3@3:1 g3:1 f3@2:1 c4@4:1:4 c#4@10:1 ~@22>*2`, + `<~@4 e4@4 e4@3 d4 db4@2:1 b3@2:1 a3@4:1 a4@3 a4!2 e4 e4@3:1 d4:1 c4@2>*2`, + `<~@4 d4@4 d4@3:1 c4:1 b3@2 a3@2:1 c4@4:1:4 b3@4:1:-1 ~@4>*2`, + `<~@4 [d4:1 e4:1 d4:1 c4:1 b3:1 a3]@12 c4:1:4@8 d4:1:2@8 a3:1:-4@8 ~@8>*2`, +]).split([0, .9, 0], (x) => note(x[0]).clip(x[1]).penv(x[2])).patt('.2').s('gm_oboe').lpf(30000).room(.5).gain(1.7).velocity(y[1])) + .superimpose(x=>x.late(2).gain(0.5).pan("<0 1>/16").room(1.5)) + +faf: "<~@62 [0,1]@8 >/4".pickRestart([ + `<~ d4:.5!2 d4@2:1 c4:.5!3 c4 ~ f4 ~ d4@2:1 c4:1 bb3 ~@2 d4:0.5 d4@2:1 c4:.5 c4:1 bb3:.5 bb3@2:1 f3@2:1 c4:1:4@3 ~ >*2`.pan(.3), + `<~ f4:.5!2 f4@2:1 eb4:.5!3 eb4 ~ bb4 ~ f4@2:1 eb4:1 d4 ~@2 f4:0.5 f4@2:1 eb4:.5 eb4:1 d4:.5 d4@2:1 bb3@2:1 eb4:1:4@3 ~ >*2`.pan(.7), +]).split([0,.9,0],(x)=>note(x[0]).clip(x[1]).penv(x[2])).patt('.2').s('triangle').lpf(30000).room(.5).gain(0.2) + +$: s("").bank("RolandMT32").gain(.05).room(.2) +$: s(">*2").bank("RolandMT32").gain("<0.4 0.2>").room(.2) +$: s("<[[~ ~ rim]!5]@15 ~>*2").bank("RolandMT32").gain(.2).room(.2) + diff --git a/examples/appealingtovenus.js b/examples/appealingtovenus.js new file mode 100644 index 0000000..213b13a --- /dev/null +++ b/examples/appealingtovenus.js @@ -0,0 +1,38 @@ +// "Appealing to Venus" +// song @by The Sea Nymphs +// script @by eefano +setDefaultVoicings('legacy') +const chords = `/2` +stack( + // melody + `< + ~@2 c5 d5@2 eb5 d5@3 c5@2 g#4@3 eb5@8 ~@2 + ~@2 c#5 d#5@2 f5 d#5@3 c#5@2 d#5@3 + d#5@3 f5@3 a5@3 a#5@3 a#5@3 g5@6 f5 e5@4 + ~ e5 f5@2 a5@3 a#5@3 a#5@3 g5@6 f5 e5@4 + ~ e5 f5@2 a5@3 a#5@3 a#5@3 + g5@7 f5@6 d#5@3 f5@3 g5@6 + ~@24 + + e5@2 e5@3 f5@3 g5@3 g#5@3 g5@3 g5@3 c6@3 + c6@3 c6@3 c#6@3 b5@3 [f#5 g#5 f#5@3]@3 e5@3 b5@3 b5@3 + g#5@7 d#5@6 c#5@3 d#5@3 f5@6 + ~@24 + >*3`.note().clip(0.95).s('gm_oboe').gain(0.5) + , + // second voice + `< + ~@150 + + c5@2 c5@3 d5@3 e5@3 d#5@3 d#5@3 c5@3 g5@3 + g5@3 g5@3 g#5@3 e5@3 [c#5 d#5 c#5@3]@3 b4@3 f#5@3 f#5@3 + c#5@7 c5@6 a#4@3 c5@3 c#5@6 + ~@24 + >*3`.note().clip(0.95).s('gm_oboe').gain(0.5) + , + chords.rootNotes(2).note().s('gm_bassoon').lpf(400).gain(0.5), + chord(chords).anchor("C5").voicing().struct("x").piano().gain(0.4), + chord(chords).anchor("E5").voicing().s('gm_drawbar_organ').gain(0.15), + +).cpm(120).room(0.5)//.pianoroll() \ No newline at end of file diff --git a/examples/aztecchallenge.js b/examples/aztecchallenge.js new file mode 100644 index 0000000..c059bf2 --- /dev/null +++ b/examples/aztecchallenge.js @@ -0,0 +1,20 @@ +// "Aztec Challenge" +// song @by Paul Norman +// script @by eefano +setcps(180/60) +let parts = +{a1:n("<0>/32") +,a2:n("<-7>/32") +,a3:n("<-14@5 [4 7]*5 4@2 >/4") +,b:n("<0 ~@3 0 ~ 0 ~>*4".sub(7)) +,c1:n("<0@2 2 1 1b@2 3 2>") +,c2:n("<<0 1b> 5 4 3 4 5 4 3>*2") +,d1:n("<0@2 2 1 1b@2 3 2>/2") +,d2:n("<<-7 -6b> -2 -3 -4 -3 -2 -3 -4>") +,e1:n("<0 ~ 0 1 0 ~ 0 1 0 ~ 0 1 2 1 0 -1 1 ~ 1 2 1 ~ 1 2 1 ~ 1 2 1 0 -1 -2#>*2") +,e2:n("<-2@2 4b ~ 2@2 4b 5 >*2") +,e3:n("<2@3 3 3#@3 4 7@2 6 5# 3#@3 4 7@2 6 5# 3#@3 1 0@8>/2") +} +sid1: "/16".pickRestart(parts).scale('a1:minor').s('gm_lead_2_sawtooth').lpf(4000).color('yellow').gain(0.9)._scope() +sid2: "/16".pickRestart(parts).scale('a2:minor').s('sawtooth').lpf(3000).color('cyan')._scope() +sid3: "/16".pickRestart(parts).scale('a4:minor').s("/16").color('magenta')._scope() diff --git a/examples/bennington.js b/examples/bennington.js new file mode 100644 index 0000000..b696c66 --- /dev/null +++ b/examples/bennington.js @@ -0,0 +1,47 @@ +// "Bennington" (work in progress) +// composed @by John Maus +// script @by eefano +setcps(135 / 60 / 4) + +bass: "<0@3 1 0 1@2 0@2 0*4 [2@25 3@7]@2 0 [0 ~@31]>/8".pickRestart([ + n("<7!3 [4 6] 7*2 7!2 6 9!3 [6 9] 11*2 11!2 10>*4"), + n("<[9*2 9!2 [6 7]]!2 [11*2 11!2 [6 7]] [11 12# 13 14] >"), + n("<[~ 9 12!2]!2 [~ 9 10!2] [~ 7 10!2] [7!2 14!2] [~ 7 11!2]!2>*2"), + n("<[~ 6 13!2]!3>*2") +]).scale('c1:minor').s('sawtooth').clip(.95).lpf(300).lpe(1).gain(1).room(.2) + +gneeow: "<0 ~@3 0 ~@4 ~ ~@2 0 1>/8".pickRestart([ + n("<~ [4,7,9]@3 ~@4>*2"),n("<[4,7,9]@2 ~@6>") +]).scale('c5:minor').s('sawtooth').vib(4.5).vibmod(.4).gain(1).room(.8) + +dindin: "<~ 0@2 ~@4 0@2 ~@5>/8".pickRestart([ + n("[1 2]*4").pan("[.45 .55]*4") +]).scale('c6:minor').s('square').att(0).dec(.5).rel(.3).gain(.15) + +pads: "<5 ~@2 0 1 0@2 ~@2 2 [3@25 4@7]@2 ~@2>/8".pickRestart([ + n("<[2,4,6] [-3,-1,1]>/2").lpf(1500).att(.4).rel(.5).gain(.7), + n("<~@4 11 [9 10] 8 -1 [0@3 ~]@2 ~@2 11 [9 10] 8 13 >*2").lpf(1500).att(.4).rel(.5).gain(1.2), + n("<[-3,0,2] [-3,-1,1]>/2").lpf(1500).gain(.5), + n("<[5,7,9]@2 [5,7,10]@2 [[4,7,9] [4,7,8] [4,6]]@3>*2").gain(1), + n("<[6,8,10]@3 ~@4>*2").gain(1), + n("<0>").gain(0) // preload +]).scale('c4:minor').s('gm_pad_warm').room(.4) + +voice: "<~ 0 1 2 ~ 2 2*2 0 1 ~ [3@27 ~@5]@2 ~@2>/8".pickRestart([ + n("<~@3 [2 2@3]@2 3 4 [5 6@3]@2 7 [8 6] [~ 4@3]@2 ~@9 [4 3@3]@2 4 3 4 [5 6@3]@2 [7 8@3]@2 ~>*4").gain(.4), + n("<~@5 4 [4 ~] [3 ~] [4 6@2 4@5]@4 ~@7 [2 2@3]@2 3 4 [5 6@3]@2 ~@4 >*4").gain(.4), + n("<~@4 6 7 8 [6 4@3]@2 ~@10 4 [6 7@2 8@2 6@2 4@3]@5 ~@7>*4").gain(.5), + n("<9 ~ 7 ~ 11 8 ~ ~ [9 10 9] 7 ~ 11 8 ~>*2").gain(.8).delay(.4).dt(.3).dfb(.75) +]).scale('c3:minor').s('pulse').clip(.9).layer(x=>x.pan(.2),x=>x.late(.02).pan(.8)).room(.5) + +drums: "<[0,1,2] 2@2 [0,2] [0,1,2] [0,2]@2 2@2 [2,[~ 1*2]] 2@2 [0,1,2] ~>/8".pickRestart([ + "<[~ <~@3 bd ~@4>]>*4", "<~ ~@6>*4", "*4" +]).pickOut({ + bd:s('linndrum_bd').lpf(3000).room(.2).gain(.8), + sd:s('linndrum_sd').room(.2).gain(.65), + cp:s('cp').velocity(2).room(1) +}) + +all(x=>x + //.ribbon(13*8,1*8) + ) diff --git a/examples/bigship.js b/examples/bigship.js new file mode 100644 index 0000000..d505ffe --- /dev/null +++ b/examples/bigship.js @@ -0,0 +1,17 @@ +// "Big Ship (Coda)" +// song @by Cardiacs +// script @by eefano +setDefaultVoicings('legacy') +const progr = "".fast(2); +const anchr = "".fast(2); + +stack( + n("-2 -1 0 2 0 1").chord(progr).anchor("G5").voicing().s('gm_violin').clip(1).gain(0.3).room(0.1) +, chord(progr).anchor(anchr).voicing().s('gm_drawbar_organ').clip(1).gain(0.9).room(0.3) +, chord(progr).rootNotes(1).struct("x*2").s('gm_electric_bass_finger').clip(1).gain(1) + +, s("[bd!2 ~ bd]*2").bank("AkaiLinn").lpf(200).gain(0.35) +, s("[~ <[sd ~ ~ sd] sd>]*2").bank("AkaiLinn").hpf(250).lpf(4000).gain(0.30) +, s("oh*4").gain(0.15) + +).cpm(120/4).room(0.3)//.pianoroll() diff --git a/examples/bluemonday.js b/examples/bluemonday.js new file mode 100755 index 0000000..1acca5a --- /dev/null +++ b/examples/bluemonday.js @@ -0,0 +1,6 @@ + +stack( + s("bd!2 [bd*4]!2 bd!4").slow(8).bank("SequentialCircuitsDrumtracks"), + s("~ hh").bank("SequentialCircuitsDrumtracks"), + n("<[[2 ~] [2 ~] 2 3] [[3 ~] [3 ~] 3 3]>@4 [-1 ~] -1 -1 [0 ~] 0 0 [0 ~] 0 0 [0 ~] 0 0").slow(8).scale("d2:minor").s("gm_lead_8_bass_lead") +).cpm(130) diff --git a/examples/breakfastline.js b/examples/breakfastline.js new file mode 100644 index 0000000..e959af5 --- /dev/null +++ b/examples/breakfastline.js @@ -0,0 +1,27 @@ +// "Theme from The Breakfast Line" +// song @by Cardiacs +// script @by eefano +const maj = "[0,4,7]" +const imaj = "[0,4,-5]" +const melody =`[ + c#6@2 f5 c6@3 a#5 a5@2 g5@3 c#5 e5@2 d#5@2 f#5 a5@3 a5@3 + a5 g5 f5 d#5 c#5 b4 a5@3 a5@3 f5 g5 a5 a#5 g#5 g5 f5 g5 a5 b5 d5 g5 + c#5@2 b4 f5@3 c#5 d#5 f5 g5 c#5@2 c5@3 c#5@3 c#5@6 + c#5 g#5 g5 a#4 f5 d#5 c#5 c5 g#5 c#5 c5 b4 c#5@2 b4 a5@3 c#5 b4@2 a5@6 + b5 g5@2 e5 a5 b5 b5@6 b5 a#5 g5 a5@3 b5 g5 d5 c#5 a5@2 b5 g5 d#5 c#5 a5@2 + g5@2 d#5 f5 d#5 c#5 b4 a4 g4 a4 b4 c#5 d#5 f5 g5 ]/24`.clip(0.93) +stack( + // melody + melody.note().transpose( 0).s('gm_overdriven_guitar').pan(0.45).gain(0.70), + melody.note().transpose(-12).s('gm_overdriven_guitar').pan(0.55).gain(0.80), + // chords + "*2".add(imaj) + .note().s('gm_string_ensemble_2').gain(0.6), + // bass + "*2".clip(0.90) + .note().s('gm_electric_bass_finger').gain(0.7), + // drums + s("<[bd ~ bd sd ~ bd]!23 [sd*6]>").bank("AkaiLinn").gain(0.30), + s("hh*6").gain(0.10) +).cpm(76/2).room(0.6)//.pianoroll() + \ No newline at end of file diff --git a/examples/budsandspawn.js b/examples/budsandspawn.js new file mode 100644 index 0000000..f130de5 --- /dev/null +++ b/examples/budsandspawn.js @@ -0,0 +1,24 @@ +// "Buds And Spawn" (work in progress) +// song @by Cardiacs +// script @by eefano +const i_chords = x => x.s("recorder_tenor_sus").clip(1).decay(1.2).sustain(0).release(0.5) +const i_sax = x => x.s("sax").gain(0.3).clip(1).release(0) +const i_bass = x => x.s("triangle").clip(1).release(0.1) +const i_drums = x => x.bank("YamahaRY30").clip(1).gain(0.08) +const i_piano = x => x.piano().gain(0.2) + +const I_chord = n("[0,2,4]") +const p_up = n("[-5@0.5 -4 -3 [-2 -1] 0 1 2@0.5]").clip(0.7) +const p_dw = p_up.rev() + +function stackme(sc, chordpart, saxpart, drumpart) { + return stack(chordpart.scale(sc).apply(i_chords), saxpart.scale(sc).apply(i_sax), s(drumpart).apply(i_drums)) +} + +const s1=stackme("f#:major" ,I_chord,p_up,"cr,bd") +const s2=stackme("a#:major" ,I_chord,p_up,"[bd sd bd*2 sd bd*2 sd]") +const s3=stackme("b:whole:tone",I_chord,p_dw,"[sd@0.5 sd sd [ht ht] lt lt bd@0.5]") +const s4=stackme("f#:major" ,I_chord,p_up,"[bd sd [~ bd] sd bd sd],hh*6") + +arrange([3,s1],[1/1.2,s2.fast(1.2)],[1/1.3,s3.fast(1.3)],[4,s4]).cpm(165/4) + //.pianoroll() \ No newline at end of file diff --git a/examples/bugfromheaven.js b/examples/bugfromheaven.js new file mode 100644 index 0000000..7beaf1d --- /dev/null +++ b/examples/bugfromheaven.js @@ -0,0 +1,62 @@ +// "Bug From Heaven (wip)" +// song @by Tim Smith +// script @by eefano +setcps(108/60/2) +const standardtuning = [40,45,50,55,59,64]; +const fingering = +{A:"0:0:2:2:2:0",Am:"0:0:2:2:1:0",A7:"x:0:2:0:2:0",D:"x:0:0:2:3:2",Dm:"x:0:0:2:3:1",D7:"x:0:0:2:1:2", + E:"0:2:2:1:0:0",Em:"0:2:2:0:0:0",E7:"0:2:2:1:3:0",G7:"3:2:0:0:0:1",C:"x:3:2:0:1:0", + // guitar only chords + Dx:"x:0:0:2:3:2",Ds:"x:0:0:1:3:0", + Ax:"0:0:2:2:2:0",Amx:"0:0:2:2:1:0", + Ex:"0:2:2:1:0:0",Emx:"0:2:2:0:0:0", +}; +const gstrum = +{u:"<[[1,[~ 3@10],4]@2 ~]!2 [1,4,5]>*3", + v:"<[[0,[~ 3@10],5]@2 ~]!2 [0,3,4]>*3", + w:"<[[1,[~ 3@10],4]@2 ~]!2 [1,2,3]>*3", + x:"<[1,[~ 2@50],[~ ~ 4@50]] ~@3>/4", + z:"<[[3,4,5] ~]*2>", + k:"<[[2,3,4] ~]*2>", + n:"~" +}; +const bstrum = {u:"<[1 2]>", v:"<[2 1]>", w:"<[1 0]>", x:"~", z:"~", k:"~", n:"0"}; + +const gString = register('gString', (n, pat) => + (pat.fmap((v) => { if(v[n]=='x') return note(0).velocity(0); + return note(v[n]+standardtuning[n]); } + ).innerJoin())); +const guitar = (strums,fingers,tuning=standardtuning) => (strums.pickOut( + [fingers.pickOut(fingering).gString(0),fingers.pickOut(fingering).gString(1),fingers.pickOut(fingering).gString(2) + ,fingers.pickOut(fingering).gString(3),fingers.pickOut(fingering).gString(4),fingers.pickOut(fingering).gString(5)])); +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i" + .pickRestart([ + "","","", + "","","", + "", + "",/* 157 */"" + ]).split([0,0,0],s=>s[0].layer( + x=>guitar(s[1].pick(gstrum),x).s("gm_acoustic_guitar_steel:1").release(.1).gain(.75).room(.5).hpf(300).lpf(5000).late(1/64), + x=>guitar(s[1].pick(bstrum),x).s("gm_pizzicato_strings:1").transpose(-12).release(.1).gain(.65).room(.6).lpf(1000), + x=>chord(x).anchor("g5").voicing().s("gm_string_ensemble_1").gain(.15).room(1).layer(p=>p.pan(1),p=>p.pan(0).late(.1)) + ).transpose(s[2])) + +vox: "<~@25 0@22 0@22 1@13 2@10 0@22 1@13 3@8 ~@30>".pickRestart([ + "*6", + /*69*/"*6", + /*82*/"*6", + /*127*/"" +]).s("sawtooth").note().attack(.05).release(.05).gain(.30).hpf(500).clip(0.95) + +drm: "< 0@2 [0,1]@17 2 ~ 0@32>".pick([ + s("*2"), + s("<~ sd>*2"), + s("") + ]).bank("BossDR110").room(1).lpf(1800).gain(.6) + +uff: "<[gm_acoustic_guitar_steel:1,gm_string_ensemble_1,gm_pizzicato_strings:1] ~@1000>".gain(0) \ No newline at end of file diff --git a/examples/bustybeez.js b/examples/bustybeez.js new file mode 100644 index 0000000..1ed8d41 --- /dev/null +++ b/examples/bustybeez.js @@ -0,0 +1,71 @@ +// "Busty Beez" (work in progress) +// song @by Cardiacs +// script @by eefano +setcps(182 / 60 / 8) +const beez = `<~@8 + i@28 j@18 k@5 l@2 m@30 n@22 o@22 + i@28 j@18 k@5 l@2 m@30 n@22 o@22 + n@22 m@30 k@5 l@2 k@5 p@16 + i@28 j@18 j@18 k@5 l@2 m@30 k@5 l@2 m@30 n@22 o@22 + i@28 j@18 k@5 l@2 m@30 n@22 o@22 + i@28 j@18 k@5 l@2 m@30 n@22 o@22 + n@22 m@30 k@5 l@2 k@5 p@16 + i@28 j@18 j@18 k@5 l@2 m@30 k@5 l@2 m@30 n@22 q@6 p@16 + i@28 j@18 j@18 j@18 j@18 j@18 j@18 j@18 j@18 ~@18 >` +const melody = { + i: "", + j: "", + k: "", + l: "", + m: "", + n: "", + o: "", + p: "", + q: "" } +const ch0rds = { + i: "", + j: "", + k: "", + l: "", + m: "", + n: "", + o: "", + p: "", + q: "" } +const drums = { + i: "<[bd,cr]@3 bd sd@2 bd@2 sd bd@2 sd@2 sd [bd,cr]@2 [bd,cr]@2 sd@2 bd!2 sd@2 sd [bd,cr]@2 sd>", + j: "<[bd,cr]@2 sd@3 bd sd [sd,mt] [sd,lt]!2 [bd,cr]@2 sd@3 bd@2 sd>", + k: "<[bd,cr] bd sd bd sd>", + l: "<[bd,cr]@2>", + m: "<[bd,cr]@2 sd@2 bd!2 sd@2 bd!2 sd@2 bd sd [bd,cr]@2 sd bd sd bd [bd,cr]@2 [bd,cr]@2 [bd,cr]@2 sd bd [sd,mt] lt>", + n: "<[bd,cr]@2 sd@3 bd@3 sd@2 bd sd@2 bd@2 bd@2 sd bd@2 [bd,cr]@2>", + o: "", + p: "<[bd,cr]@2 sd bd [sd,mt] bd [bd,cr]@2 [bd,cr]@3 sd!2 [sd,mt] [sd,lt]!2>", + q: "" } +const colors= {i:'white',j:'yellow',k:'cyan',l:'green',m:'red',n:'salmon',o:'magenta',p:'orange',q:'lightgrey'} + +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(inote(s[0]).penv(s[1])).patt(.1).clip(.98) + .layer(x=>x.s("gm_overdriven_guitar:3").vib(10).vibmod(.09).delay(.4).dt(.2).dfb(.30).gain(1), + x=>x.transpose(12).s("gm_pad_bowed:1").gain(.4)) +$: chord(beez.pickRestart(ch0rds)).anchor('F4').voicing() + .layer(x=>x.s("gm_church_organ:3").pan(.40).gain(.4), + x=>x.s("gm_brass_section:1").pan(.55).gain(.7)) +$: beez.pickRestart(ch0rds).rootNotes(2).note() + .s("gm_electric_bass_pick:2").lpf(200).gain(.6) +$: beez.pickRestart(drums).pickOut({ + bd:s('bd').velocity(.55).lpf(500), + sd:s('sd').velocity(.55).hpf(200), + cr:s('cr').velocity(.1).pan(.55), + mt:s('mt').velocity(.3).pan(.6), + lt:s('lt').velocity(.2).pan(.7)}).bank("linn9000").speed(.95).gain(.7) +$: s("").speed(1.1).hpf(4000).gain(.1) + +all(x => x.room(.2) + //.color(beez.pick(colors)) + .fast(8) +) diff --git a/examples/byebyespirit.js b/examples/byebyespirit.js new file mode 100644 index 0000000..2b0f3cd --- /dev/null +++ b/examples/byebyespirit.js @@ -0,0 +1,23 @@ +// "Bye Bye Spirit" (Work In Progress) +// song @by The Sea Nymphs +// script @by eefano +setDefaultVoicings('legacy') +setcps(140/60*3/4/3) + +const ch = ["", + ""] +const bs = ["" + ,""] +const me = ["*3" + ,`<[a3 b3 c#4] g3 c#4 g3 [a3 b3 c#4] [g3@2 b3] c#4 g3 ~ + [e4 ~ e4] [a3 ~ a3] [b3 ~ b3] [[g3@4 f#3]@2 e3] b3 ~ + [a3 ~ a3] [b3 ~ b3] [[g3@4 f#3]@2 e3] b3 ~ g3 b3@2 ~ g3 b3@2 g3 ~ ~ >`] + +piano: "<0@30 1@30>".pickRestart(ch).chord().anchor("e4".add("<~ -2 2>*3")).voicing().struct("<~ x x>*3").piano().room(0.8).gain(0.4) + +bass: "<0@30 1@30>".pickRestart(bs).note().piano().room(.8).gain(0.6) + +bowed: n("<0 1 2 2 1 0>*3").chord("<~@15 0@15 ~@30>".pickRestart(ch)).anchor("g5").voicing().s('gm_pad_bowed').sustain(0.4).room(0.7).gain(0.5) + +voice: "<0@30 1@30>".pickRestart(me).transpose(12).s('triangle').note().room(0.6).attack(0.05).release(0.2).gain(0.4).vmod(0.10).v(5) + diff --git a/examples/cabinet.js b/examples/cabinet.js new file mode 100644 index 0000000..ddd579f --- /dev/null +++ b/examples/cabinet.js @@ -0,0 +1,22 @@ +// "Cabinet" (work in progress) +// song @by Spratleys Japs +// script @by eefano +setDefaultVoicings('legacy') +function arr(p,l) { return [l,p.slow(l)]; } + +const h1 = arr(`D@8 A F@3`,24/2); +const h2 = arr(`D@5 E C@3 A@2 B G@2 E@7 F# D@2 B C# A@2 F#@3 G# E@2`,68/2); +const h3 = arr(`C#@8 D# B@2 G# A# F#@2 D#@3 F C#@3 A# C G#@2 F@3 G D#@3 C@2 D A#@2 G@3 A F@2`,88/2); + +const chords = arrange(h1,h2,h3); + + +stack( + chord(chords).rootNotes(3).s('triangle').lpf(400).gain(0.6), + chord(chords).anchor("E5").voicing().s('gm_drawbar_organ').gain(0.35), + + s("sleighbells").struct("x*6").gain(3), + s("[bd sd]").gain(0.4).room(2), + s("rd*6").gain(0.01) + +).cpm(133/8).pianoroll() \ No newline at end of file diff --git a/examples/cadenza.js b/examples/cadenza.js new file mode 100644 index 0000000..18fb0a0 --- /dev/null +++ b/examples/cadenza.js @@ -0,0 +1,10 @@ +// "The Cardiacs Cadence" +// script @by eefano +setDefaultVoicings('legacy') +const magic = ""; + +stack( +chord(magic).anchor("G4".transpose("<3 0 -3 0>")).voicing().struct("x").piano().gain(cosine.segment(16).range(0.5,1).slow(8)), +chord(magic).anchor("B5".transpose("<0 -3 6 3>/16")).voicing().s("gm_drawbar_organ").gain(0.8), +"/4".transpose("<0 <-12 -8>>").struct("x!2").note().lpf(180).s("gm_electric_bass_finger").gain(1) +).cpm(120/2).room(0.5).pianoroll() diff --git a/examples/changetempowitharrows.js b/examples/changetempowitharrows.js new file mode 100644 index 0000000..5a9e89f --- /dev/null +++ b/examples/changetempowitharrows.js @@ -0,0 +1,11 @@ +let mytempo = 0 +window.onkeydown = (e) => { + if (e.key === 'ArrowLeft') { mytempo -= 1; console.log(mytempo); } + if (e.key === 'ArrowRight') { mytempo += 1; console.log(mytempo); } +} +const addmytempo = register('addmytempo', (pat) => pat.withValue((v) => { + if (v.cps !== undefined) return { ...v, cps: v.cps + (mytempo / 60) }; + else return v; +})); + +note("c d e f").cps(100 / 60).addmytempo() diff --git a/examples/cinghiale.js b/examples/cinghiale.js new file mode 100644 index 0000000..5549752 --- /dev/null +++ b/examples/cinghiale.js @@ -0,0 +1,19 @@ +// "L'Era Del Cinghiale Bianco" +// song @by Franco Battiato +// script @by eefano +setCps(127/60/2) +setDefaultVoicings('legacy') +stack( + "<0@16 1@14 >".pickRestart(["<[0 1]!2 [0 2] [0 3]>/4","<[4!2]@14>"]).pickRestart( + ["<[7 6 5 6 7 5 6 7]!2>".add("<0 1>") + ,"<[9 8 7 8]*3@1.5 [9 ~!1]@0.5>" + ,"<9 [~ 7 8 6]>","<9 [~ 7 8 9]>" + ,"<7@3 6@3 7@5 8 9 7 5@3 6@3 7@5 ~@5>*4" + ]).n().scale("c4:major").transpose("<[0 -5]@16 [[0@7 -5@8]!2]@14 >").s("sawtooth").vib(5).vmod(0.1).clip(0.85).attack(0.05).release(0.1).gain(0.6) + +,"<0@16 [1!2]@14 >".pickRestart(["<[Am G C@2]!2 [Em D G@2]!2>/4","*4"]) + .chord().anchor("C4").voicing().s("triangle").lpf(1200).attack(0.01).gain(0.35) + +,"<0@16 1@14 >".pickRestart(["[[bd <~!7 bd>] sd],*4", + "*2,*4"]).s().bank("YamahaRY30").clip(1).gain(0.4) +).room(0.4) diff --git a/examples/clandeisiciliani.js b/examples/clandeisiciliani.js new file mode 100644 index 0000000..112f04c --- /dev/null +++ b/examples/clandeisiciliani.js @@ -0,0 +1,24 @@ +// "The Sicilian Clan" (work In Progress) +// song @by Ennio Morricone +// script @by eefano +const chrds = "*2"; +const anchr = "*2"; +const dickt = { + '': ['0 4 7', '4 7 12', '7 12 16'], // major chords (no symbol) + m: ['0 3 7', '3 7 12', '7 12 15'], // minor chords via 'm' + dim: ['0 3 6', '3 6 12', '6 12 15'], // diminished + 7: ['4 7 10'], // upper 7th + }; +stack( +n("<0@12 1@2>".pickRestart(["<[~ 0 1 0 2@2]!14 [~ 0 1 2 2@2] [~ 1 4 3 4@2]>*8/6","<2 ~>"])) + .chord(chrds).dict(dickt).anchor(anchr).voicing().s("gm_electric_guitar_jazz").gain(0.8).color('red'), +n("<[2@2 ~ 2 1@2 ~@2]!4>") + .chord(chrds).dict(dickt).anchor(chrds.rootNotes(2)).voicing().s("gm_electric_bass_finger").lpf(190).gain(1).color('blue'), +"*2" + .note().s("gm_oboe").gain(0.4).color('green'), +chord(chrds).anchor("G4").struct("x*4").dict(dickt).voicing().s("gm_synth_strings_2").gain(0.2).color('yellow'), + +s("[~ rim]*2").bank("AlesisHR16").gain(0.4), +s("rd*8").note(42).bank("AkaiLinn").gain(0.08) + +).cpm(120.3/4).room(0.6)//.pianoroll(); \ No newline at end of file diff --git a/examples/clubbed.js b/examples/clubbed.js new file mode 100644 index 0000000..648c4f4 --- /dev/null +++ b/examples/clubbed.js @@ -0,0 +1,31 @@ +// "Clubbed" +// @by eefano +setcps(162/60/3) +const standardtuning = [40,45,50,55,59,64]; +const fingering = +{A:"x:0:2:2:2:0",Am:"x:0:2:2:1:0",A7:"x:0:2:0:2:0",D:"x:0:0:2:3:2",Dm:"x:0:0:2:3:1",D7:"x:0:0:2:1:2", + E:"0:2:2:1:0:0",Em:"0:2:2:0:0:0",E7:"0:2:2:1:3:0",G7:"3:2:0:0:0:1",C:"x:3:2:0:1:0", +}; +const strumming = +{d: "<[1,3,4]*8>/3", u:"<[2,4,5]*8>/3" +}; +const gString = register('gString', (n, pat) => + (pat.fmap((v) => { if(v[n]=='x') return note(0).velocity(0); + return note(v[n]+standardtuning[n]); } + ).innerJoin())); +const guitar = (strums,fingers,tuning=standardtuning) => + (strums.pickRestart(strumming).pickOut( + [fingers.pickOut(fingering).gString(0),fingers.pickOut(fingering).gString(1),fingers.pickOut(fingering).gString(2) + ,fingers.pickOut(fingering).gString(3),fingers.pickOut(fingering).gString(4),fingers.pickOut(fingering).gString(5)])); + +guy: "<0@2 1 0 1 0>/24".pickRestart(["/4","/4"]).layer( + x=>guitar("/3",x).s("gm_electric_guitar_clean:2").clip(0.5).release(0.1).gain(0.9).room(0.2).layer(p=>p.pan(1),p=>p.pan(0).late(.01)), + x=>chord(x).anchor("g5").voicing().s("gm_percussive_organ").gain(0.8).mask("<~@3 1@6 ~@3>/12").room(.4) + ) + +drm: "<~ 0 [0,1]@6 [1,2]@4 [0,1]@8 1@3 ~ >/6".pick([ + s("<[~ hh]*2>"), + s("] [[sd bd] ~]>*2"), + s("") + ]).bank("RolandTR808").room(1).lpf(1800).gain(3.5) + diff --git a/examples/disto.js b/examples/disto.js new file mode 100644 index 0000000..4585330 --- /dev/null +++ b/examples/disto.js @@ -0,0 +1,21 @@ +setcps(90/60) + +g: n("<[[0,4]]*3>") + .scale("c#2:minor").s("supersaw").transpose("<0 2 [3 1]>/8") + .lpa(0).lpe(10).lpd(0.2).lpr(1).lpf("<[10 10 100]>").dist("8:0.18") + +s: n("<[[5 ~]*3] 4 4b 3 [1 2 1] 0 [4 5 2] 4 >") + .scale("c#4:minor").transpose("<0 2 [3 1]>/8") +.s("supersaw").lpf(500).dist("10:0.12").room(0.2) + .mask("<0@3 1@4 >/8").hush() + +d: "[,,/5]" + .pickOut({bd:s("EmuDrumulator_bd").velocity(1).lpf(1000), + sd:s("EmuDrumulator_sd").velocity(1), + oh:s("EmuDrumulator_oh").pan(0.6).speed(0.7).velocity(0.2), + mt:s("EmuDrumulator_mt").velocity(0.6), + lt:s("EmuDrumulator_lt").velocity(0.6), + cr:s("SequentialCircuitsDrumtracks_cr").speed(1.3).pan(0.4).velocity(0.5)}) + .room(0.9).gain(0.5) + .mask("<0 1@5 0 1 >/8") + diff --git a/examples/edenontheair.js b/examples/edenontheair.js new file mode 100644 index 0000000..8a0d80c --- /dev/null +++ b/examples/edenontheair.js @@ -0,0 +1,9 @@ +setDefaultVoicings('legacy') + +const chrds = "A@2 E@2 A F#m B@2 E@2 A ~ F#@4 A@2 ~ F#@4 ~@2".slow(25/4); + +stack( +n(run(6).palindrome().fast(5)).clip(2).chord(chrds).anchor(chrds.rootNotes(5)).voicing().s("gm_electric_guitar_jazz"), +chord(chrds).anchor("B4").voicing().s("gm_piccolo") + +).gain("0.4@12 1@4 0.4@3 1@4 0.4@2".slow(25/4)).cpm(95/4).room(0.5) \ No newline at end of file diff --git a/examples/elpueblo.js b/examples/elpueblo.js new file mode 100644 index 0000000..a5e7ba7 --- /dev/null +++ b/examples/elpueblo.js @@ -0,0 +1,45 @@ +// "El Pueblo Unido Jamas Sera Vencido" (work in progress) +// song @by Inti-Illimani +// script @by eefano +setCps(95/60/4) +const standardtuning = [40,45,50,55,59,64]; +const fingering = +{Am:"0:0:2:2:1:0",C:"x:3:2:0:1:0",Dm:"x:0:0:2:3:1",E7:"0:2:2:1:3:0",G7:"3:2:0:0:0:1", + F:"1:3:3:2:1:1",A7:"x:0:2:2:2:3",E:"0:2:2:1:0:0",B7:"0:2:4:2:4:2" +}; +const sk = 300, sh = silence, strumming = +{d: stack(0,timeCat([1,sh],[sk,1]),timeCat([2,sh],[sk,2]),timeCat([3,sh],[sk,3]),timeCat([4,sh],[sk,4]),timeCat([5,sh],[sk,5])) +,u: stack(5,timeCat([1,sh],[sk,4]),timeCat([2,sh],[sk,3]),timeCat([3,sh],[sk,2]),timeCat([4,sh],[sk,1]),timeCat([5,sh],[sk,0])) +}; + +const gString = register('gString', (n, pat) => + (pat.fmap((v) => { if(v[n]=='x') return note(0).velocity(0); + return note(v[n]+standardtuning[n]); } + ).innerJoin())); +const guitar = (strums,fingers,tuning=standardtuning) => + (strums.pickRestart(strumming).pickOut( + [fingers.pickOut(fingering).gString(0),fingers.pickOut(fingering).gString(1),fingers.pickOut(fingering).gString(2) + ,fingers.pickOut(fingering).gString(3),fingers.pickOut(fingering).gString(4),fingers.pickOut(fingering).gString(5)])); + +stack( + guitar("*4", + "<0@4 1 2 1 3 4@2>/2".pickRestart( + ["*2","*2","*2","*2",""])) + + .s("gm_acoustic_guitar_steel:2").clip(1).release(0.4).gain(0.4).room(0.6), + + "<~@2 0@2 1 2 1 3 4@2>/2".pickRestart([ + "<0@5 0 2@5 2 4@2 4 3@2 2 1@5 <-3 4>>*12", + "<5@5 2 1@5 5 4@2 3 4@2 1 0@5 4>*12", + "<3@5 0 0b@5 3 2@2 1 2@2 3 4@2 4b 4@2 6>*12", + "<3@5 0 0b@5 3 2@2 1 0@2 0b 0@5 0>*12", + "<[3!2]@4 ~ 3 [3!2]@4 ~ 3 [4b@!2]@4 ~ 4b [4b!2]@4 ~ 4b [4!2]@4 ~ 4 [4!2]@4 ~ 4 [4!2]@4 ~ 4 [4!2]@4 ~ ~>*12", + ]).scale("a5:minor").note().clip(0.95).color('yellow') + .layer(x=>x.s("gm_ocarina").gain(0.6).room(0.6) + ,x=>x.transpose(-24).attack(0.01).release(0.1).s("gm_choir_aahs:3").gain(0.8).room(0.5)), + + "<0@2 ~@8>/2".pickRestart([note(">*12")]) + .clip(0.90).s("gm_applause:3").color('red').room(2).gain(0.35) + +)//.pianoroll() + diff --git a/examples/enjoythesilence.js b/examples/enjoythesilence.js new file mode 100644 index 0000000..38082c9 --- /dev/null +++ b/examples/enjoythesilence.js @@ -0,0 +1,21 @@ +// "Enjoy The Silence (coda)" +// song @by Depeche Mode +// script @by eefano +setCps(113/60/4) +await samples({'gtr': 'gtr/0001_cleanC.wav'}, 'github:tidalcycles/Dirt-Samples/master/'); + +const melodia = x => x.note().s("ocarina").gain(0.6).clip(1).release(0.1) +const guitar = x => x.note().s("gtr").room(1).gain(0.25).clip(1).release(0.5) +const accordi = x => x.note().s("recorder_bass_sus").gain(1.5).clip(1).release(0.5) +const basso = x => x.note().s("triangle").gain(0.8).clip(1).sustain(0.8) +const ritmo = x => x.bank("AlesisHR16").clip(1).gain(0.08) + +const scala = cat('c minor') // IV VI I III +stack( +"<[3,5,0] [5,0,2] [0,2,4] [2,4,-1]>".scale(scala).apply(accordi), +"<[2@3 3] [0@3 2] [4@3 6] [2@3 3] [0@3 1] [-1@3 -2] -3 [0 1]>".scale(scala).transpose(12).apply(melodia), +"~@2 2 <7 9 6 6>@2 2 <8 6 4 4>@2".scale(scala).transpose(-12).apply(guitar), +"<-4 -2 0 -1>".struct("[[x ~]!2 x x@0.5 [x ~]!2 x@0.5 [x ~]!2]").scale(scala).apply(basso), +s("bd!4,[~ sd]!2,[~ hh!2 hh*2]!2").apply(ritmo), +//s("hh!4").apply(ritmo) +) diff --git a/examples/epicbiopic.js b/examples/epicbiopic.js new file mode 100644 index 0000000..28f65e9 --- /dev/null +++ b/examples/epicbiopic.js @@ -0,0 +1,61 @@ +// "Epic Biopic" version 1.0 +// song @by eefano +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i pat.withValue((v)=> + v.endsWith('m') ? [v.substring(0,v.length-1),'minor']:[v,'major'])); +setCps(1) +orch: "<~ a@2 b a@2 b c@6 d@2 a@2 b e@2 f@9 i@6 g@4 h ~>/5".pickRestart({ + a:"", + b:"", + c:"", + d:"", + e:"", + f:"@2:4>", + g:"", + h:"", + i:"<[[Fm@4:1 F#@2:1 A#@4:1]!2]@20 [Fm@2:2 F@3:2 D#m:2 D@3:2 A:2]@10>" +}).split([0,0],t=>stack( + + chord(t[0]).anchor('c5').voicing().s(t[1].pickOut([ + "supersaw".lpf(5000).velocity(.9), + "triangle".velocity(.65), + "supersaw".lpf(4800).velocity(.51).attack(.05).release(.05), + "triangle".lpf("4000").velocity(.55) + ])).room(.4).gain(.75).color('yellow'), + + n(t[1].pickRestart([ + "<-1 [0 1]*3 0>".velocity(1.1), + "<1 0*3>".velocity(.7).lpf(2800), + "<[1 1*3] 2*3>","<[1 0] ~>".lpf(2500).velocity(.78) + ])).chord(t[0]).mode('root').anchor('g2').voicing().clip(.97).s("square").color('cyan').gain(.85), + + "<~@4 a@2 b ~@2 c@4 d@2 e ~@2 ~@2 f@6 i@3 c@4 d@2 g@4 h ~>/5".pickRestart({ + a: "<~ [[5b 4 2]*2] [7 8b 7] [4 6b 4] [4 6] [[2 3] 4@7]@2 [~@3 6b*2] [6b@3 7*2] 9 >", + b: "<9*3 11 9*3 11@2>", + c: `<[2 1 0] [4@2 4*2] [4 ~ 0] [2@3 1 0@2] 2 [5@2 4] [2@3 1 2@2] [0 1] [2@3 1 2@2] [0@2 1] + [9@3 7*2] [7@2 7] [9@3 7*2] [4 ~ 0] [2@3 1 0@2] [7@3 6 7@2] [6 7] [7@3 6 7@2] [6 7] [7@3 6 7@2]>`, + d: "<[11 10] <[9 8] [9 10]> [9 8 7] [6 5 4]>", + e: "<2@2 ~@3>", + f: "<[[2 3] 4@2]!2 <[2] [4 3]> >".add("<0 [0,-2]>/15"), + g: "<[9@8 9]@2 7@2 [9@8 8 9]@2 9@3 [9@2 [10 11]] 9@3 [[9 7 9]!2] [9@5 9]@2 9@4>".add("<0@14 [0,-2]@6>"), + h: "<[11 ~]>/5".add("0,-2"), + i: "<[2 1 0] <[4@2 4*2]!2 4> <[4 ~ 0] 2*3 2> [2@3 1 0@2] 2 [4 3 2]>".add("<[0,-2]>/15"), + }).scale(t[0].toscale()).s("gm_tuba").clip(.9).note().color('magenta').gain(1).room(.2) +)) +drums: "/5".pickRestart({ + a: s("<[[cr,lt]!2]@10>").lpf(2600), + b: s("<~ [[cr,lt]!2]@4>").lpf(2600), + c: s("<[lt ~ lt]>").lpf(200), + d: s("<[[cr,lt]!5]@10>").lpf(2600), + e: s("<[cr,lt]@5 [cr,lt] [lt mt*2 lt*2] lt@3>").lpf(2800), + f: s("<[lt mt lt]!30 [lt mt*2 lt*2]!13 lt*3 [lt mt*2 lt*2]>") + .lpf("<200@15 400@15 1000@13 1500@2>").velocity("<.9@28 1.2@2>"), + g: s("<[mt mt*2 mt*2]>,<[[cr,lt]!3]@6 [[cr,lt]!4]@8 [[cr,lt]!3]@6>").lpf(2600).velocity(.78), + h: s("<[[cr,lt]!2]@4 ~>").lpf(2800).velocity(.9), + i: s("<[lt mt*2 lt*2],<~@20 [cr!3]@6 [cr!2]@4>>").lpf("<1500 1800 2400>/10").velocity(.78), + k: s("/30").lpf(2800).velocity(.45), + x: s("<[mt mt lt] lt>").lpf("<800@2 1200@2 2400>") +}).bank("BossDR550").room(1.4).speed(.7).gain(.45) diff --git a/examples/eversoclosely.js b/examples/eversoclosely.js new file mode 100755 index 0000000..f9e9545 --- /dev/null +++ b/examples/eversoclosely.js @@ -0,0 +1,35 @@ +// "The Everso Closely Guarded Line (Coda)" - Work In Progress +// song @by Cardiacs +// script @by eefano +setCps(93.2/60*3/4/9) +setDefaultVoicings('legacy') +const epic = "*9"; +const mels ={0:"d4@2 a d4 g c4 f a d4" + ,1:"a@7 c4@3 d4@6 e4@2 c4@7 d4@2" + ,2:"a@7 e4 c4 [d4@3 e4]@2 f#4 ~ g4@2 [c4@3 d4]@2 e4 [c4@5 ~]@4 c5@2 ~ d5@2" + ,3:"a@2 f#4 f4@2 a ~ e4@2 d4@2 a ~ g4@2 c4@2 e4 ~ f4@2 c5@2 e4 ~ d4@2" + ,4:"a d4 f#4 [a4 e5 c5]@6 d5 a4 f#4 [a4 g4]@4 c5@3 a4 f4 [e4 c4]@4 d4@2" + ,5:"a d4 f#4 [a4 c5 a4]@6 d5 a4 f#4 [a4 g4]@4 c5@3 a4 f4 [e4 c4]@4 d4@2" + ,6:"f#4 f4 e4 f#4 g4 e4 f4 [a@2 c4] [[a#@3 c4]@2 d4]" + ,7:"[f#4 f4]@6 @3 [d4@3 e4]@2 f#4 [g4 a#4 c5 a4]@8 f4 e4 <[c5@2 ~ a#4@2] [c4@3 a#@2]>@5" + ,8:"[~@25 d4@29]/2" + ,9:"<0,1,2,3,4,5,6,7>*9"} +stack +("<0 1 2 3 4 0 1 2 3 [4@26 ~] 0 1 2 3 [[4@25 ~@29],8]@2 >".pickRestart(mels).sub(12).note().s("gm_overdriven_guitar").gain(.8) +,"<~ ~ ~ ~ 5 5 6 7@2 [2@4 ~] 5 5 6 7 [[5@25 ~@29],8]@2>".pickRestart(mels).note().s("gm_tenor_sax").gain(.8).color("yellow") +,"<1@14 [[4@25 ~@29],8]@2>".pickRestart(mels).add(24).note().s("gm_ocarina").gain(.3).color("red") +,"<9@14 ~@2>".pickRestart(mels).n().chord(epic).anchor("C4").voicing().s("").gain("<.25@10 .45@4 ~@2>").color("green").midichan(3) +,"<0@14 [[4@25 ~@29],8]@2>".pickRestart(mels).sub(24).note().s("gm_electric_bass_finger").lpf(400).gain(.77).color("blue") +,"<0 [0@2 1@2 0 2@4] 0!4 [0@2 1@2 0 2@4] 0!2 [0@26 ~] 0!2 [0@2 1@2 0 2@4] 0 3@2>".pickRestart( + [" sd> ~ bd>*3 , cr/9>*9" + ,"[[sd [bd,cr] ~]!2@3]*9/2" + ,"<[sd,[~ sd@10]] [[[bd,cr] ~]!2]@4 bd [sd,[~ sd@10]] mt lt >*9*3" + ,"< [<[sd,[~ sd@10]]!2 ~> <[bd,cr]!2 [sd,[~ sd@10]]> [bd,cr]!2 ~ [bd,cr] ~ [bd,cr,cr] ~]*3 ~*4 >" + ]).pickOut({rd:s('rd').velocity(.12).hpf(9000).pan(.45), + bd:s('bd').velocity(.5).lpf(2500), + sd:s('sd').velocity(.5).hpf(200), + cr:s('cr').velocity(.1).pan(.55), + mt:s('mt').velocity(.3).pan(.6), + lt:s('lt').velocity(.3).pan(.7) +}).bank("Linn9000").speed(.95).gain(.7).color("cyan").midichan(10) ).room(.8) + \ No newline at end of file diff --git a/examples/happybirthday.js b/examples/happybirthday.js new file mode 100644 index 0000000..bd25609 --- /dev/null +++ b/examples/happybirthday.js @@ -0,0 +1,13 @@ +// HAPPY BIRTHDAY +setDefaultVoicings('legacy') + +const chrds = "F@3 C@6 F@6 Bb@3 F@2 C F@3".slow(8); + +stack( +"[C4@3 C4] D4 C4 F4 E4@2 [C4@3 C4] D4 C4 G4 F4@2 [C4@3 C4] C5 A4 F4 E4 D4 [Bb4@3 Bb4] A4 F4 G4 F4@2".slow(8).early(1/3).note().s("gm_harmonica").gain(0.4).color('green'), +chord(chrds).anchor("G4").struct("x*3").voicing().piano().gain(0.2).color('yellow'), +n("2 ~ ~ 2 1 ~").chord(chrds).anchor(chrds.rootNotes(2)).voicing().s("gm_electric_bass_finger").lpf(190).gain(1).color('blue'), + +s("hh*3, , ~ ~ rim").bank("KorgDDM110").gain(0.2) + +).cpm(120/4).room(0.3)//.pianoroll(); diff --git a/examples/happybirthdayramones.js b/examples/happybirthdayramones.js new file mode 100644 index 0000000..be5052c --- /dev/null +++ b/examples/happybirthdayramones.js @@ -0,0 +1,18 @@ +// "HAPPY BIRTHDAY BURNSIE" +// song @by Ramones +// script @by eefano +setDefaultVoicings('legacy') + +const chrds = "F@3 C@6 F@6 Bb@3 F@2 C F@3".slow(8); + +stack( +"C4*2 [D4 C4]@3 F4 E4 ~@2 C4*2 [D4 C4]@3 G4 F4 ~@2 C4*2 [C5 A4]@3 ~ [E4 D4]@3 Bb4*2 [A4 F4]@3 G4 F4 ~@2".slow(8).early(1/4).note().s("gm_distortion_guitar").gain(1).color('green'), + +n("0,2").chord(chrds).anchor("E3").mode('root').struct("[[x ~]*2 x*2]*2").voicing().s("gm_distortion_guitar").clip(0.95).gain(0.7).color('yellow'), +n("0").chord(chrds).anchor("E2").mode('root').voicing().s("gm_electric_bass_finger").lpf(190).gain(1).color('blue'), + + s("<[~@5 crow crow ~]!2 ~ [~@3 crow crow ~@3 ]>").slow(2).gain(1.2), + + s("oh*4, *2 , [~ sd]*2").bank("Linn9000").gain(0.15) + +).cpm(200/4).room(0.3)//.scope()//.pianoroll() diff --git a/examples/heymoon.js b/examples/heymoon.js new file mode 100644 index 0000000..2c0965f --- /dev/null +++ b/examples/heymoon.js @@ -0,0 +1,21 @@ +// "Hey Moon" (work in progress) +// song @by John Maus +// script @by eefano +setcps(88/60) + +const split = register('split', (deflt, callback, pat) => + callback(deflt.map((d,i)=>pat.withValue((v)=>Array.isArray(v)?(i*2").chord("/2").anchor("/2").voicing().s("gm_pad_warm").release(2).room(0.6).gain(0.6) + +m: "<0@16>/2".pickRestart([ + "<~!14 3 1 3@2 ~@4 0 5 4 4 4 [5 3@3]@2 ~!5 [1 0] -1b 0@2 0 [0 0] ~!14 >*2", + "<~!15 3 3@3 0 0@2 5@2 4@2 3 2 2 3 3 0 0 >*2"]) + .layer(x=>x.scale("g4:major").note().s("gm_piccolo").pan(0.4).room(1).gain(0.5), + x=>x.scale("g2:major").note().s("supersaw").pan(0.6).room(1).gain(0.6)) + + +$: s("").gain(0.3).room(1) +$: s("/2").gain(0.1).room(1) +$: s("<[~ <~!3 sd>] sd>").gain(0.3).room(1) + diff --git a/examples/humanperformance.js b/examples/humanperformance.js new file mode 100644 index 0000000..9b97247 --- /dev/null +++ b/examples/humanperformance.js @@ -0,0 +1,45 @@ +// "Human Performance" (work in progress) +// @song by Parquet Courts +// @script by eefano +setcps(110 / 60 / 2) + +const song = "<0@2 1@11 1@11 1@6 2@3 3@24 4@4 1@11 1@11 1@6 2@3 3@24 4@4>" + +const zero = register('zero', (pat) => pat.withValue((v)=>0)) + +const chseq = song.pickRestart(["~","","".struct("x*4"), + "@9>*4".struct("x*4"),""]) + +const cs = zero(chseq).pickRestart(["<[0,[~ 1@40],[~@2 2@40],[~@3 3@40]]@2>"]) +const ds= "<0@3 0@2 0 0@2 0!2 0@2>*4".pickRestart(["[0,1,2,3]"]) + +const cln = x=>x.s("gm_electric_guitar_clean:2").lpf(1800).gain(.7) +const dst = x=>x.s("gm_electric_guitar_clean:2").hpf(100).lpf(1800).clip(1).gain(.7) + + +$: n(song.pick([cs,cs,ds,ds,cs])).chord(chseq).mode('above').anchor('e3') + .voicing().mode("root").pickF(song,[cln,cln,cln,dst,cln]) ._pianoroll() + +$: n(song.pickRestart(["~", "<~ 8 8 7 9 8 ~ ~ ~ 7 7 5 8 7 ~ ~ ~ 8 8 7 9 8 7 6 7 5 ~ 4 7 5 ~ ~ ~ 7 7 6 7 2@2 ~@5>*4", + "<7@2 ~ [7 5] [9 7]@2 ~@100>*4", + "<<[12!2 11 12]!2 [9!3 8] [9 8 7 9] [9!3 8] [9 8 7 9] [9!3 8] [9 8 7 9]> ~@2>","~"])) + .scale("a2:major").s("gm_tenor_sax:1").gain(1).color('yellow') + +$: n(song.pickRestart(["<~ [~ 0 2 2b]>", + "<1 [4b 4] 5 [2 5] 4 [1 4] [3@3 3] [0@3 0] [-4@3 -4] [0 0] [0 0 2 2b]>", + "<1>*4","<<0!2 2 0!2 2 0!2>@3 <-2!2 4 3 1 -2 4 3>@9>*4".struct("x*4"),"<5!4 2!4 -2!3 2 5 -2 2 2b>*4"])) + .scale("a2:major").s("gm_electric_bass_finger:3").clip(.97).lpf(350).gain(1).color('cyan') + +$: song.pickRestart(["<~>","","", + "*4,*4","~"]).pickOut({ + rd:s("").speed(1.1).hpf(4000).velocity(.1), + bd:s('linn9000_bd').velocity(.55).lpf(500), + sd:s('linn9000_sd').velocity(.55).hpf(200), + cr:s('linn9000_cr').velocity(.1).pan(.55), + mt:s('linn9000_mt').velocity(.3).pan(.6), + lt:s('linn9000_lt').velocity(.2).pan(.7)}).speed(.94).gain(.6) .color('magenta') + +all(x => x + .room(.3) + //.ribbon(24*2,1*8) +) diff --git a/examples/hydraswap.js b/examples/hydraswap.js new file mode 100755 index 0000000..06cd42d --- /dev/null +++ b/examples/hydraswap.js @@ -0,0 +1,26 @@ + +await initHydra() + +let bass = note("").euclid(3,8).s("sawtooth").lpf(sine.range(400, 1000)) +let kick = s("<[bd ~ ~ bd]!3 [bd(5,8,1)]> ") +let hihat = s("hh!6 [hh*2 hh]!2").slow(2) +let final = stack(note("c3@4, c2@4").s("sawtooth").lpf(1000), + s("cr")).delay(.5).delaytime(".75") +let silence = s("bd").hush() + +let sequence = "0@4 1@4 2@8 3 4@7".slow(24) + +solid(0,0,0) +.add(osc(10, 0.1, 10) ,H(sequence.pick([1,0,0,1]))) +.add(noise() ,H(sequence.pick([0,1,0,1]))) +.add(shape() ,H(sequence.pick([0,0,1,0]))) +.out() + +sequence.pick([ bass, // = 0 + stack(bass, kick), // = 1 + stack(bass,kick,hihat), // = 2 + final, // = 3 + silence]) // = 4 + + + diff --git a/examples/ilredelmondo.js b/examples/ilredelmondo.js new file mode 100644 index 0000000..980ada0 --- /dev/null +++ b/examples/ilredelmondo.js @@ -0,0 +1,29 @@ +// "Il Re Del Mondo (intro)" +// song @by Franco Battiato +// script @by eefano +setCps(91/60/4) +const accordi = x => x.note().s("recorder_tenor_sus").clip(1).release(0.5) +const melodia = x => x.note().s("sax").gain(0.3).clip(1).release(0.5) +const walking = x => x.note().s("triangle").clip(1).release(0.1) +const ritmo = x => x.bank("YamahaRY30").clip(1).gain(0.08) +const scaleggio = x => x.piano().gain(0.2) + +const myscale = "[e:major e:minor]!3 [e:major]@0.5".slow(14) + +const scala2 = "".slow(2.5) + +const verse = stack( +"[4 5 6 7]*2".scale(scala2).note().apply(scaleggio), +"[0@4 [7 ~]!2 0@3 7@2 ~ 7 ~ 0@3 7@3]/2.5".scale(scala2).transpose(-12).apply(walking), +s("hh!4").apply(ritmo), +"<-3,-2,-1,0,1,2,3 ~@1000>".scale(myscale).velocity(0).apply(melodia).color('black') +) + +const chorus = stack( +"[0,2,4]/2".scale(myscale).apply(accordi), +"[-3@3 -2 -1@3 0 -1@8 0@3 1 2@3 3 2@8 2@8 2@8 1@8]/14".scale(myscale).transpose(12).apply(melodia), +"~ -3 [0 ~] [0 ~] [1 ~] [1 ~] [2 3] [4 ~] ".scale(myscale).apply(walking), +s("[[bd [sd [~ bd]] [bd bd] sd,hh!7 oh]!13 [bd sd sd*4 lt*4,hh!3 oh ~!4]]/14").apply(ritmo), +) + +arrange([10,verse],[14,chorus]) diff --git a/examples/jitterbug.js b/examples/jitterbug.js new file mode 100644 index 0000000..2b3a8f1 --- /dev/null +++ b/examples/jitterbug.js @@ -0,0 +1,27 @@ +// "Jitterbug (Coda)" +// song @by Cardiacs +// script @by eefano +setDefaultVoicings('legacy') +const m1 = `f#4@3 d4@4 g4@6 g#4@4 f4@3 d#4@3 e4@4 c#4@6 b3@4 g#3@3 g#4@5 a4@4 f#4@3 d#4@3 f#4@4 g4@6 a4@4 a#4@6 d#4@3.9 ~@0.1 d#4@3`.slow(82/8); +const m2 = `f4@3 d4@4 d#4@5 e4@3 g4@4 e4@6 f#4@4 c4@2.9 ~@0.1 c4@3 g#3@4 a#3@4 b3@6 c#4@4 g4@6 a4@4 a#4@6 d#4@3.9 ~@0.1`.slow(73/8); +const m3 = `d#4@3 f#4@3.5 ~@0.5`.slow(7/8); +const m4 = `c#4@4 f#4@4 `.slow(8/8); +const m5 = `e4@4 g4@7.9 ~@0.1 f4@4 f#4@4.9 ~@0.1 d#4@3 e4@4 c#4@6.9 ~@0.1 f#4@2 f4@3.9 ~@0.1`.slow(41/8); +const melody = arrange([82/8,m1],[73/8,m2],[7/8,m3],[82/8,m1],[8/8,m4],[73/8,m2],[41/8,m5]); + +const h1 = `D@2 G@2 C D#@2 G#@2 C# B@2 E@2 A F#m@2 B@2 G#@2 C#@2 A@2 D Cm@2 F#@2 D# Em@2 A@2 F# D#m@2 G#@2`.slow(40/4); +const h2 = `Cm F@2`.slow(3/4); +const h3 = `Bm@2 B@2 C@2 G@2 C A@2 D@2 Am C@2 G#@2 F#@2 E B@2 C#m@2 D# Em@2 A@2 F# D#m@2 G#@2`.slow(35/4); +const h4 = `Cm F#@2`.slow(3/4); +const h5 = `Cm F#@4 F@2`.slow(7/4); +const h6 = `C#m@2 D#@4 C#@2 F#@2 B@2 E@2 C#m@2 F#@2 A#@2`.slow(20/4); +const chords = arrange([40/4,h1],[3/4,h2],[35/4,h3],[3/4,h4],[40/4,h1],[7/4,h5],[35/4,h3],[20/4,h6]); + +stack( + n(stack("0","1".late(.1),"2".late(.2)).fast(4)).chord(chords).anchor("G5").voicing().s("gm_pad_choir").echo(2,1/6,.7).gain(0.8), + chords.rootNotes(2).note().s("gm_lead_2_sawtooth").attack(0.2).sustain(1.2).lpf(1000).gain(0.4), + melody.note().s("gm_lead_1_square").attack(0.02).sustain(1.5).lpf(1200).gain(0.75), + s("").bank('LinnDrum').gain(0.07) +).cpm(115/4) +.room( slider(0.91,0,10)) + .rsize( slider(4,0,8,1)) diff --git a/examples/jitterbugreverse.js b/examples/jitterbugreverse.js new file mode 100644 index 0000000..41d5ca9 --- /dev/null +++ b/examples/jitterbugreverse.js @@ -0,0 +1,31 @@ +// "Jitterbug (Coda)" - In Reverse +// song @by Cardiacs +// script @by eefano +setDefaultVoicings('legacy') +const melody = + `f#4@3 d4@4 g4@6 g#4@4 f4@3 d#4@3 e4@4 c#4@6 b3@4 g#3@3 g#4@5 a4@4 f#4@3 d#4@3 f#4@4 g4@6 a4@4 a#4@6 d#4@3.9 ~@0.1 d#4@3 + f4@3 d4@4 d#4@5 e4@3 g4@4 e4@6 f#4@4 c4@2.9 ~@0.1 c4@3 g#3@4 a#3@4 b3@6 c#4@4 g4@6 a4@4 a#4@6 d#4@3.9 ~@0.1 + d#4@3 f#4@3.5 ~@0.5 + f#4@3 d4@4 g4@6 g#4@4 f4@3 d#4@3 e4@4 c#4@6 b3@4 g#3@3 g#4@5 a4@4 f#4@3 d#4@3 f#4@4 g4@6 a4@4 a#4@6 d#4@3.9 ~@0.1 d#4@3 + c#4@4 f#4@4 + f4@3 d4@4 d#4@5 e4@3 g4@4 e4@6 f#4@4 c4@2.9 ~@0.1 c4@3 g#3@4 a#3@4 b3@6 c#4@4 g4@6 a4@4 a#4@6 d#4@3.9 ~@0.1 + e4@4 g4@7.9 ~@0.1 f4@4 f#4@4.9 ~@0.1 d#4@3 e4@4 c#4@6.9 ~@0.1 f#4@2 f4@3.9 ~@0.1` + .rev(); +const chords = + `D@2 G@2 C D#@2 G#@2 C# B@2 E@2 A F#m@2 B@2 G#@2 C#@2 A@2 D Cm@2 F#@2 D# Em@2 A@2 F# D#m@2 G#@2 + Cm F@2 + Bm@2 B@2 C@2 G@2 C A@2 D@2 Am C@2 G#@2 F#@2 E B@2 C#m@2 D# Em@2 A@2 F# D#m@2 G#@2 + Cm F#@2 + D@2 G@2 C D#@2 G#@2 C# B@2 E@2 A F#m@2 B@2 G#@2 C#@2 A@2 D Cm@2 F#@2 D# Em@2 A@2 F# D#m@2 G#@2 + Cm F#@4 F@2 + Bm@2 B@2 C@2 G@2 C A@2 D@2 Am C@2 G#@2 F#@2 E B@2 C#m@2 D# Em@2 A@2 F# D#m@2 G#@2 + C#m@2 D#@4 C#@2 F#@2 B@2 E@2 C#m@2 F#@2 A#@2` + .rev(); + +stack( + chord(chords).anchor("C5").voicing().s("gm_rock_organ").pan(0.4).gain(0.9), + chord(chords).anchor("G5").voicing().s("gm_pad_choir").pan(0.6).gain(0.9), + chords.rootNotes(2).note().s("gm_lead_2_sawtooth").attack(0.2).sustain(1.2).lpf(1000).gain(0.5), + melody.note().s("gm_lead_1_square").attack(0.02).sustain(1.5).lpf(1200).gain(0.75), +).cpm(115/183).room( slider(0.91,0,10)) .rsize( slider(4,0,8,1)) + diff --git a/examples/lovegoeson.js b/examples/lovegoeson.js new file mode 100644 index 0000000..1a9604f --- /dev/null +++ b/examples/lovegoeson.js @@ -0,0 +1,42 @@ +// "Love Goes On" (work in progress) +// song @by The Go-Betweens +// script @by eefano +const standardtuning = [40,45,50,55,59,64]; + +const fingering = +{Am:"0:0:2:2:1:0",C:"x:3:2:0:1:0", + D:"x:0:0:2:3:2", Dm:"x:0:0:2:3:1", + G:"3:2:0:0:0:3", G7:"3:2:0:0:0:1", + F:"1:3:3:2:1:1", A7:"x:0:2:2:2:3", + E:"0:2:2:1:0:0", Em:"0:2:2:0:0:0", E7:"0:2:2:1:3:0", + B7:"0:2:4:2:4:2",Bm:"0:2:4:4:3:2" +}; +const sk = 300, sh = silence, strumming = +{d: stack(0,timeCat([1,sh],[sk,1]),timeCat([2,sh],[sk,2]),timeCat([3,sh],[sk,3]),timeCat([4,sh],[sk,4]),timeCat([5,sh],[sk,5])) +,u: stack(5,timeCat([1,sh],[sk,4]),timeCat([2,sh],[sk,3]),timeCat([3,sh],[sk,2]),timeCat([4,sh],[sk,1]),timeCat([5,sh],[sk,0])) +}; + +const gString = register('gString', (n, pat) => + (pat.fmap((v) => { if(v[n]=='x') return note(0).velocity(0); + return note(v[n]+standardtuning[n]); } + ).innerJoin())); +const guitar = (strums,fingers,tuning=standardtuning) => + (strums.pickRestart(strumming).pickOut( + [fingers.pickOut(fingering).gString(0),fingers.pickOut(fingering).gString(1),fingers.pickOut(fingering).gString(2) + ,fingers.pickOut(fingering).gString(3),fingers.pickOut(fingering).gString(4),fingers.pickOut(fingering).gString(5)])); + +setcps(150/60) + +strum: + guitar("*2", + "<0@2>/16".pickRestart( + ["/4"])) + .s("gm_acoustic_guitar_steel:2").clip(1).release(0.4).gain(0.4).room(0.6) + +voice: + "<0 1>/16".pickRestart([ + "<2 2@2 2@2 2 2 2@2 1@2 ~@5 3 3@2 3@2 1 1@2 2@2 ~@6>*2", + "<3 1@2 -1@2 -1 -1 0@2 1@2 ~@5 0 0@2 0@2 1 1@2 -1@4 ~@4>*2" + ]).scale("a3:minor").note().clip(0.95).color('yellow') + .s("gm_bassoon:2").gain(1).room(0.4) + diff --git a/examples/madeallup.js b/examples/madeallup.js new file mode 100644 index 0000000..0efa365 --- /dev/null +++ b/examples/madeallup.js @@ -0,0 +1,62 @@ +// "Made All Up (wip)" +// song @by Cardiacs +// script @by eefano +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i`, + b: ``, + c: ``, + d: ``, + e: `<[F# D A]@6 [[[C#:1 ~]!2 [C#:1:-2 ~]!2 [C#:1:-4 ~]!2]!4]@24>` +}).split([0,0,0],t=>stack( + + chord(t[0]) + .anchor(sequence.pickRestart( + {a:"", + b:"", + c:"",d:"",e:"" + })).voicing().s("gm_piano").room(.4).gain(.9).color('yellow') + .superimpose(x=>x.late(0.1).attack(.1).velocity(.7).pan(.2)), + + n(t[1].pickRestart(["<0>/8","<[0 ~]>"])).chord(t[0]).mode('root').anchor('e2').voicing() + .transpose(t[2]).s("gm_electric_bass_finger").lpf(200).gain(1.4).color('cyan') +).rsize(4) +) +const choirline = note(`*2`); +const mode1 = x => x.adsr([0,.1,.8,0]).clip("0.92") + .superimpose(x=>x.transpose(12).velocity(.8).speed(1.002).pan(.4), + x=>x.transpose(24).velocity(.4).speed(.998).pan(.6)); +const mode2 = x => x.attack(.04).release(.02).clip("0.85"); +choir: sequence.pickRestart({ + a: mode1(choirline), + b: mode1(choirline.transpose(1)), + c: mode2(note(`<~ b4@2 g#4@2 a#4@2 f#4 ~ g#4@2 a#4@2 b4@2 d#5 + ~ f#5@2 a#4@2 e5@2 d#5 ~ c#5@2 b4@2 a#4@2 ~>`)), + d: mode2(note(`<~ a#4@2 g4@2 c5@2 b4 ~ a#4@2 f#4@2 g#4@2 ~>`)), + e: mode2(note(`<~ c#5@2 d5@2 c#5@8 ~@18 >`)) +}).s("triangle").gain(0.9).lpf(5000).color('magenta').room(.5).rsize(4)//.pdec("<0@23 1@15>") + +const tricky = "<0@7 0@6 0@4 0 0@6 0@7 0@7>" + .pickRestart([">"]); +drums: sequence.pickRestart({ + a: tricky, + b: tricky, + c:" <~ bd>] sd>>", + d:" <~ bd>] sd>>", + e:"<[rd!3]@6 sd!22 sd*4@2>" +}).pickOut({ + bd: s('bd').lpf(800).velocity(1.1), + sd: s('sd').velocity(.7), + rd: s('rd').velocity(0.3).hpf(8000), + cr: s('cr').speed(0.7).velocity(0.1).hpf(6000), +}).bank("Linn9000").room(0.4).gain(0.5).rsize(4) diff --git a/examples/mammalschilling.js b/examples/mammalschilling.js new file mode 100644 index 0000000..e55112d --- /dev/null +++ b/examples/mammalschilling.js @@ -0,0 +1,70 @@ +// "Mammals Chilling" version 1.0 +// song @by eefano +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i/40".pickRestart({ + a: "< ~>/5", + b: "", + c: "".velocity(1.4), + d: "".velocity(1.6), + e: "< ~>/5".velocity(1.3), +}).split([0,0,0],s=>stack( + n(s[2].pickRestart({ + h:"<~ [<0@2 2 1>@3 ~]>*2", i:"<~ [<3@2 0 1>@3]>*2", + j:"<0 2>/2", k:"<1 <0 2>>/2", l:"<2 ~>/8" + })).chord(s[0]).anchor(s[1].transpose(-22)).mode('above').voicing() + .s("gm_pizzicato_strings:4").gain(1.35).color('green'), + + n(s[2].pickRestart( + {h:"<[[0,[~ 1@40],[~@2 2@40],[~@3 3@40]] ~@2]>/2", + i:"<[[3,[~ 2@40],[~@2 1@40],[~@3 0@40]] ~@2]>/2", + j:"<[[~ 0@3],[~@1 1@3],[~@2 <2 3>@2],[~@3 <3 2>]]>/2", + k:"<[[~ 3@3],[~@1 2@3],[~@2 <1 0>@2],[~@3 <0 1>]]>/2", + l:"<[[1,[~ 2@30],[~@2 3@30],[~ 0]]]>/4"})) + .chord(s[0]).anchor(s[1]).mode('above').voicing() + .s("gm_acoustic_guitar_nylon").gain(.65).color('yellow') +)).room(.2) + +melo: "<~ a b ~@2 c d e ~ d>/40".pickRestart({ + a: n(`<~ 4 0 ~ 1 0 ~ 1 2*3 ~@2 5 5 6 ~ 2 ~ 5 2 5 ~ 2 ~@5 6 ~ 2*3 ~@5 6 ~ 1*3 ~ [6*3]@2 + 5 4 5 ~ 2 ~ 6 ~ 4 ~@3 4 ~ 3#!2 [2 0# 2]@2 3# ~ 4 ~ 3#!2 0# ~ 3# ~ 5!2 6!2 2 ~@6>*2`).late(.1), + b: n(`<~@4 2 ~ 3# ~ 4 ~@7 3# ~@5 7 ~ 8 ~@15 9*2 8 ~@14 8*2 6 ~@10 [4*3]@4 ~@6>*2`), + c: n(`<7 [9 13 12@2]@3 ~@2 [9 12 13 9 8 6]@4 ~@8 [9 12 13 9 8 6]@4 ~@8 [6 8 9 13 12 9]@4 ~@6>`), + d: n(`< ~ [~ 2] [~ 5] [~ 3#] ~@5 [~ 8] [~ 7] [~ 6] ~@8 [9*2 8] ~@7 [8*2 6] + ~@3 8*2 9*3 10#*4 9*5 6*3 6*4 5*5 ~>`), + e: n(`<~@10 12 12 13 ~ 9 ~ 12 9 12 ~ ~@32 [9 12 13 9 8 6]@8 ~@100>*2`).velocity(.5).pan(.3) +}).scale('f4:major').s("gm_marimba").room(.2).gain("<.65 .75 .85>").color('cyan') + +trom: "<~@2 b ~ a c d e ~ d>/40".pickRestart({ + a: `<~ [2 ~] [6:1 ~] [4 ~] ~ [2 ~] [5:1 ~] [6 ~] [1@4 0# 1]@3 + [2 ~] [3# ~] ~ [3# 4] [4# ~] [5 ~] 7*2 6*2 5*2 [4 6:2@3]@2 4@3 + ~ 4*2 [3# 3] 2 ~ 2*2 [1# 1] 0# [3# 0# 2@2]@3 0# [3# 6 5@2]@3 >`.clip(.9), + b: `< ~ 2:3@5 6 ~ 4 ~ ~@4 2:3@2 1@6 9:1 ~ 8 ~ ~@6 9:1 8 ~@14 8:1 6 ~@10 [[0# ~]*3]@4 ~@20>*2`.clip(.9), + c: `<~@10 [[[-2 ~] [1 ~] 2 [-2 ~] [3# ~] ~]!2]@8 ~@4 + [[[3# ~] [2 ~] 1 [-1 ~] [2 ~] ~]!2]@8 ~@6 >`.clip(.9), + d: `<[2:3@5 5]@3 [~ 3#] [~@5 2:3@2 1@6 7]@7 [~ 8] ~@4 [9:1 8] ~@7 [8:1 6] + ~@7 1 2 3# 2:2 -1 ~ -2 ~>`.clip(.9), + e: `<~@30 0!2 -1!2 -2!2 -3 -1:2@3 -3@2 ~@10 [2 -2 -1 2 1 -1]@8 ~@100 >*2`.velocity(.5).pan(.7).clip(.4) +}).split([0,0],t=>n(t[0]).scale('f3:major').penv(t[1])) + .s("gm_trombone:4").room(.2).gain(.85).color('magenta') + +drums: `<[a,c]@4 [a,c,e]@7 [a,c,e,f] [v,a,b]@4 [[a,b,d]@11 g]@8 [v,a]@4 [~ a]!3 [~ h] [a,k]@4 a@4>/10` +.pickRestart({ + a:"*2", + b:"<~@8 [~ cw]!2>", c:"<~@8 [cw ~]!2>", + d:"<[ [,]]>", e:"<<[<~ cl>@3 ~@3>]>@2>", + f:"<~@6 [[cj*3]!2]@4>",g:"<[~ cj!6 wh@5]@8>", h:"", + k:"",v:"" +}).pickOut({ + sh: s("shaker_small:0").velocity(3), sk: s("shaker_small:1").velocity(2), + cl: s("clave").velocity(7), cm: s("clave").velocity(4).speed(.95), + bd: s("bongo:3").velocity(5), cj: s("agogo").velocity(7), + cw: s("cowbell").velocity(1.2).pan("<.2 .8>/10"), + wh: s("ballwhistle"), wx: s("ballwhistle:1"), + vi: s("vibraslap").velocity(.9), + se: s("brown").adsr([1,0,1,1]).speed("<1.4 1.5>/10").pan("<.4 .6>/10") +}).room(.2).gain(1) diff --git a/examples/markovchain.js b/examples/markovchain.js new file mode 100644 index 0000000..d558c98 --- /dev/null +++ b/examples/markovchain.js @@ -0,0 +1,40 @@ + +let markovstates = {}; + +let markovtables = { + 'drums': + //bd sd hh + [[ 0, .2, .8], // bd + [ .3, 0, .7], // sd + [ .9, .1, 0]] // hh + +, 'chords': + [[ .2, .2, .4, .2], + [ .5, .3, .2, .1], + [ 0, .2, .7, .1], + [ .7, .1, .1, .1]] + } + +const markov = register('markov', (id, pat) => pat.withHap((hap)=> { + + if(markovstates[id]===undefined) markovstates[id]=[0]; + const mystate = markovstates[id]; + const mytable = markovtables[id]; + //console.log(mytable) + + const p = hap.whole.begin.n; + while(mystate.length<=p) + { + const prev = mystate[mystate.length-1]; + const t = mytable[prev]; + let next = prev; + for(let i=0,j=t[i];imystate[p]); +})) + +$: s(rand.segment(1).markov('drums').pick(["bd","sd","hh"])).fast(8) + +$: chord(rand.late(.2).segment(1).markov('chords').pick(["C","Dm","F","A"])).fast(2).voicing().piano() diff --git a/examples/mouthbreather.js b/examples/mouthbreather.js new file mode 100644 index 0000000..1c23353 --- /dev/null +++ b/examples/mouthbreather.js @@ -0,0 +1,22 @@ +// "Mouth Breather" (work in progress) +// composed @by The Jesus Lizard +// script @by eefano +setcps(215/60*2) + +const xposes = "<0@9 -5 -7 0@4 ~ 0@2 -5 -7 ~@2>/48" +g:"<0@5 1 0 1 0@3 ~@2 0 ~ 0@4 ~@2 >/48".pickRestart( + [stack("","".add("<0,5>")).struct("") + ,"<[c3,g3,c4]@6 ~@42>".add(-3).penv(-3).patt(1) + ]).note().transpose(xposes).s("gm_electric_guitar_clean:2").distort("10:.17").room(.1) + +b:"<~@3 0@2 ~ 0 ~ 0@6 ~ 0@4 ~@2 >/48".pickRestart(["@3>"]) + .note().transpose(xposes).s("gm_electric_bass_pick").release(.06).distort("5:.3").room(.2).color('green') + +d:"<~ 0@14 ~ 0@6>/48".pickRestart( + [stack(s(""), + s("<~!3 sd ~!6 sd ~!5 sd ~!3 sd ~!3>").gain(1.4), + s("/2").speed(1.03).gain(.3).pan(.4), + s("/12").speed(1.1).gain(.2).pan(.6))]) + .room(.8).color('cyan') + +// all((x)=>x.scope({scale:.05})) //._pianoroll({minMidi:10,maxMidi:60,autorange:false}) diff --git a/examples/mouthbreathercomplex.js b/examples/mouthbreathercomplex.js new file mode 100644 index 0000000..1022d15 --- /dev/null +++ b/examples/mouthbreathercomplex.js @@ -0,0 +1,35 @@ +// "Mouth Breather" (work in progress, complex variant) +// composed @by The Jesus Lizard +// script @by eefano +setcps(215/60*2) +const fvi = register('fvi', (i, d, pat) => pat.filterValues(v=>v[i]==d)) +const ati = register('ati', (i, d, pat) => pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i/16` +.layer( + x=>x.fvi(0,'G').ati(1,0).pickRestart( + [stack("".pan(.51),"".add("<0,5>").pan(.49)).struct("") + ,"<[c3,g3,c4]@3 ~@45>".add(-8).penv(-3).patt(.6).lpf(3000) + ]).note() + .transpose(x.fvi(0,'G').ati(2,0)) + .s("gm_electric_guitar_clean:2").hpf(80).distort("10:.17").room(.1) + +,x=>x.fvi(0,'B').ati(1,0).pickRestart( + ["@3>"]) + .note() + .transpose(x.fvi(0,'B').ati(2,0)) + .s("gm_electric_bass_pick").release(.06).distort("5:.31").room(.2).color('green') + +,x=>x.fvi(0,'D').ati(1,0).pickRestart( + ["<[bd ~ bd sd ~ bd!2 ~!2 bd sd ~ bd ~!2 bd sd bd ~ bd sd ~ bd ~],oh*12,cr*2>/24"]) + .pickOut({bd:s('bd').lpf(1800), + sd:s('sd').speed(.88), + oh:s('oh').speed(.9).velocity(.15).pan(.45), + cr:s('cr').speed(.95).velocity(.2).pan(.55) + }).bank("linn9000").gain(1.3).room(.85).color('cyan') +) \ No newline at end of file diff --git a/examples/nudelimprov1.js b/examples/nudelimprov1.js new file mode 100644 index 0000000..ad9e555 --- /dev/null +++ b/examples/nudelimprov1.js @@ -0,0 +1,36 @@ +setcpm(120/4) +let key = "/2"; +let tra = "0, 3, 5".add("<0 [0 2]>/2"); + +$: n("<6 3> - [2 <1 0>] <0*2 ->") +.scale(key) +.scaleTranspose(tra) +.s("kawai") +.lpf("<2000 1000 500>/2") +.gain("<0 .3 .7@2>/8") + + +$: n("<[2 -]*4 [0 -]*6>") +.scale(key) +.s("supersaw") +.scaleTranspose(tra) +.transpose("<0 -5>/8") +.room(.5) +.gain(.5) + +$: n("<0 0 0>").scale(key).transpose(-12) + .penv("<0 12 -12>") + .patt(.3) + .s("gm_fretless_bass") + .gain(1) + +$: s("white*16").clip(.5) +.speed("<<1@2 1 2> <2 3>>*16") +.hpa(.05).hpd(.05).hpe(3).hpf("<1000@2 2000 500>*8") +.gain(0.4) + +$: s("< ~@14 <~@15 bd>>*8") +.speed(1.2).lpf(1000).gain(0.6).room(1) + +$: +s("- - [clap | -] clap*2:<0 4 5 1>").room(.6).gain(.5) diff --git a/examples/oddeven.js b/examples/oddeven.js new file mode 100755 index 0000000..f643175 --- /dev/null +++ b/examples/oddeven.js @@ -0,0 +1,22 @@ +// "Odd Even" (Work In Progress) +// song @by Cardiacs +// script @by eefano +setDefaultVoicings('legacy') +const k = 0.01; + +stack( + + n(stack("0@2 0 3@2 3 0 3", + "1@2 1 2@2 2 1 2".late(k), + "2@2 2 1@2 1 2 1".late(k*2), + "3@2 3 0@2 0 3 0".late(k*3))) + .chord("".slow(2)).voicing() + .s("gm_electric_guitar_jazz").clip(1).release(0.2).gain(0.5), + + + `< ~!4 + [4 3 [2 ~] [1 ~] 0@2 4@2] + [4 3 [2 ~] [1 ~] 0@2 7@2] + >`.scale("g2:lydian").note().s("gm_bassoon") + +).cpm(120/4)//.pianoroll() diff --git a/examples/oh.js b/examples/oh.js new file mode 100644 index 0000000..a26e048 --- /dev/null +++ b/examples/oh.js @@ -0,0 +1,21 @@ +// "Oh" +// song @by Tim Smith Spratleys Japs +// script @by eefano +setDefaultVoicings('legacy') +const ln = 24; +const cresc = saw.range(0.4,0.7).slow(ln*2); +const chrds = "G#@4 F#@2 B@3 E A@2 D G@2 A G@4 A G@4 G# C# F# B E A@2 B A@2 C D#@6 F@2 D#@4".slow(ln); +const meldy = "[d#5@4 d#5@2 d#5@3 e5 c#5@2 d5 d5@2 c#5 b4@4 c#5 b4@4 c5 f5 a#4 d#5 g#4 e5 [b4@3 d#5] f#5 d#5@2 e5 g4 g5@3 f5 a5@4 a#5@3]".slow(ln); +stack( + meldy.note().s('gm_piccolo').velocity(.9).gain(add(cresc,0.1)).color("yellow"), + + chord(chrds).anchor("C4".transpose(run(12).slow(ln))).voicing().s('gm_choir_aahs').velocity(.8).pan(0.6).gain(add(cresc,tri.range(0,0.1).slow(ln))), + chord(chrds).anchor("C5".transpose(run(12).slow(ln))).voicing().s('gm_string_ensemble_2').pan(0.4).gain(add(cresc,tri.range(0,0.1).slow(ln))), + + n("[0 1 2 3 4 3 4 5 4 3 2 3 2 1]*1.7").chord(chrds).anchor("C6").voicing().s('gm_oboe').room(0.5).gain(0.2), + chrds.rootNotes("[1 2]!2").struct("x*8").clip(0.90).note().s('gm_electric_bass_finger').lpf(280).gain(0.5), + + s("[bd!2 ~ bd]*2").bank("AkaiLinn").lpf(300).gain(0.15), + s("<~ sd>*4").bank("AkaiLinn").hpf(250).lpf(3500).gain(0.30), + s("hh*8").hpf(8000).gain(0.08) +).cpm(90/4).room(0.8) //.pianoroll() diff --git a/examples/oldmacdonald.js b/examples/oldmacdonald.js new file mode 100644 index 0000000..41e0d25 --- /dev/null +++ b/examples/oldmacdonald.js @@ -0,0 +1,26 @@ +// old mcdonalds has bad samples +setDefaultVoicings('legacy') +const beast = ["crow","space","gm_bird_tweet","space:4","clash","space:1"] +const bsequ = "<~@2 0 ~@3 1 0 ~@3 2 1 0 ~@3 3 2 1 0 ~@3 4 3 2 1 0 ~@2>".pick(beast) +const chrds = "F [A# F] [F C] [F@3 ~]"; +const strct = "[[x ~]!2] [[x ~]!2 x ~]"; +const bstrc = "[[~ x]!2] [[~ x]!2 ~ x]"; +const trnsp = "<0!4 1!5 2!6 3!7 4!8 ~>"; + +"<[0,3] [0,1] 2 0!2 [0,1] [2,1] 2 0!2 [0,1] [2,1]!2 2 0!2 [0,1] [2,1]!3 2 0!2 [0,1] [2,1]!4 2 [0@7 ~] ~>".pick( +[stack( + "F5*2 [F5 C5] D5*2 C5 A5*2 G5*2 F5@2".note().clip(0.9), + chord(chrds).anchor("G4").voicing().struct("[~ x]*4 [[~ x]*2 [x@3 ~]]").gain(0.6), + n("[2 1]*4").chord(chrds).anchor("F2").voicing().struct("[x ~]*8").gain(0.6), + ).piano().add(note(trnsp)) +,"~@7 [C5 D5]".note().clip(0.8).piano().add(note(trnsp)) +,stack( + stack( + "[[F5*2 ~]!2] [[F5 ~]!2 F5*2 ~]".note(), + chord("F").anchor("G4").voicing().struct(strct).gain(0.6), + "F2".struct(strct).note().gain(0.6) + ).clip(0.8).piano().add(note(trnsp)), + "F".struct(bstrc).s(bsequ).release(0)) + +,"0,1,2,3,4,5".pick(beast).gain(0) // samples preload trick +]).cpm(140/8).room(0.4) diff --git a/examples/omalley.js b/examples/omalley.js new file mode 100755 index 0000000..ddc6f0b --- /dev/null +++ b/examples/omalley.js @@ -0,0 +1,23 @@ +// "O'Malley, Former Underdog" (work in progress) +// song @by Deerhoof +// script @by eefano +setDefaultVoicings('legacy') +const crdpart = "<~@6 0@17 1@4 0@17 1@4 2@10>".pickRestart( +["< C@2 D@2 [[C ~]!3 D@2 [D ~] D@2]@2 G@2 D@3 Am G D A D@2 >" +,"< Em@2 D@2 >" +,"< [G A] [[C ~]!3 D@2 [D ~] D@2]!3 D >/2" +,"< G [D@6 G@10] >" +]); +stack("~" +,"<0@6 1@17 2@4 1@17 2@4 3@2 ~@8>".pickRestart( +["< <~ 0 1 2 3 4 5 6 7 4 5 6 7 8 9 10 11 7 8 9 10 11 12 13> ~>*8".sub(7) +,"< ~@2 5 6 7@2 6 5 6 ~ 4 ~@3 8 ~@11 7 8 9@2 8 7 8 ~ 6 ~@3 11@4 10 9 10 ~ 8 ~ 9@2 8 7 8 ~ 6 ~ 7 6 5 ~ 6 ~ 4 ~@5 >*4" +,"< 7@3 8 9@2 12@2 11@3 8 6@4 >*4" +,"< 7@2 6@2 5 6 5 4 >*4" +,"< 7 ~@7 6 ~@7 5 ~@2 5 ~ 5 4 ~@9 >*4" +]).n().scale("g3:major").s("gm_lead_1_square").room(0.4).delay(0.4).dfb(0.3).dt(60/128).gain(0.65) + +,crdpart.chord().anchor("A4").voicing().s("gm_lead_8_bass_lead").room(0.4).color("blue").gain(0.5) + +,s("hh*2").bank("RolandTR909").room(0.2).color("yellow").gain(0.2) +).cpm(147/2) diff --git a/examples/pumpupthejam.js b/examples/pumpupthejam.js new file mode 100644 index 0000000..ece4559 --- /dev/null +++ b/examples/pumpupthejam.js @@ -0,0 +1,42 @@ +// "Pump Up The Jam" - Work In Progress +// song @by Technotronic +// script @by eefano +const pickRestart = register('pickRestart', (arr, pat) => pat.pick(arr.map((x)=>x.restart(pat.collect().fmap(v=>v+1))))) +const as = register('as', (mapping, pat) => { mapping = Array.isArray(mapping) ? mapping : [mapping]; + return pat.fmap((v) => { v = Array.isArray(v) ? v : [v, 0]; + return Object.fromEntries(mapping.map((prop, i) => [prop, v[i]])); }); }); +stack("~" +,"<~@8 0@4 1@4 ~@8>".pickRestart( + ["[u [u e] a [u i] [u ~] [a u] [i a] [o@3 i] ~ [a e] [a i] [o@3 i] [~ u@2 a] [e e] [o i] [o@3 i]]/4" + ,"~ [u i] [u ~ ~ a] [i i@2 o]" +]).vowel().s("z_sawtooth").clip(0.8).gain(1.4) + +,"<~@16 0@8>".pickRestart( + ["[ ~@2 4 [5:1 ~] ~ [~ 0] [3:-1@5 3:1@2 2]@2 ~ [4@3:1 3 3@3 2 2@3 3 4:1@3 0 0@2 2:2@2]@5 [~ ~ 0@2 ~ 0@2 -2:-3]@2 ]/4" +]).as("n:penv").scale("c4:minor").clip(0.90).patt("0.15").s("square").delay(0.3).dfb(0.3).dt(60/128).gain(0.7) + +,"<0@32>".pickRestart( + ["[~@13 [[~@3 [0,-2,-4]@2 ~]@3 [0,-2,-4] [1,-1,-3]!2]@3 ]/4" +]).scale("c4:minor").note().clip(0.7).s("z_sawtooth").color("red").adsr("0.07:.1:0.6:0.1").gain(0.5) + +,"<0@12 0 1 ~@2 3@8>".pickRestart( + ["[0 ~@23]/2" + ,"~@2 [~ [e2 ~]] [[0 2] ~]" + ,"[0 ~ ~ 0 ~ ~ 0 ~] <[[~ [0 1]] [2 ~]] ~>" +]).scale("c2:minor").note().clip(0.9) + .layer(x=>x.s("z_sawtooth").delay(0.6).dfb(0.5).dt(60/125*3/4).pan(0.55).gain(0.8) + ,x=>x.s("z_square").lpf(300).lpe(2).lpa(-1.5).lpd(0.1).lpr(0.05).pan(0.45).gain(1)).color("green") + +,"<0@4 [0,1]@12 [0,1,2]@4 [0,1,2,3]@4>".pickRestart( + [stack(s("oh*16").pan(0.45).gain("[0.08 0.16]*4").release(0),s("hh*4").pan(0.7).gain(0.20)) + ,s("bd*4").lpf(150).gain(1) + ,s("[~ cp]*2").gain(0.5).pan(0.25) + ,s("[~ rd]*4").gain(0.15).release(0).hpf(1500).pan(0.75) + ,s("[~ sd!3]!4 [sd*4]!4").slow(2).gain(run(32).slow(2).mul(1/31).add(0.1).mul(0.4)) + ,s("cr").gain(0.2) + ,s("bd").gain(0.8) + ]).bank("RolandTR909").color("yellow").velocity(0.7) + +).cpm(124.5/4).room(0.3) + + diff --git a/examples/pyramidsong.js b/examples/pyramidsong.js new file mode 100644 index 0000000..d570f48 --- /dev/null +++ b/examples/pyramidsong.js @@ -0,0 +1,40 @@ +// "Pyramid Song (wip)" +// song @by Radiohead +// script @by eefano +setcps(104/60/4) +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i/8".pickRestart( + {i1:`<[[X:.6 X:.8]@3 Y:.5@2 [Z:.5 Z:.5]@3]>/2`, i2: `<[[Z:.4 Y:.4]@3 Y:.3@2 [J:.6 J:.9]@3]>/2`, + i3:`<[[K:.8 X:.6]@3 Y:.5@2 [Z:.5 Z:.5]@3]>/2`, i4: `<[[Z:.4 Y:.4]@3 Y:.4@2 [Y:.4 Y:.7]@3]>/2`, + ooooh:`<[[X X]@3 Y@2 [Z Z]@3] [[Z Y]@3 Y@2 [X X]@3] [[X X]@3 Y@2 [Z Z]@3] [[Z Y]@3 Y@2 [Y Y]@3]>/2`, + v1:`<[[X X]@3 Y@2 [Z Z]@3] [[Z Y]@3 Y@2 [X X]@3]>/2`, + v2:`<[[V V]@3 W@2 [W W]@3] [[Y Y]@3 Y@2 [Y Y]@3]>/2`, + v3:`<[[V V]@3 W@2 [W W]@3] [[Y Y]@3 X@2 [X X]@3]>/2`, + end:`/8`, + }).split([0,.5],(x)=>x[0].pickOut(chr).velocity(x[1])).note().piano().gain(0.8).room(.6) + +ooooh: "<~ 0 ~@4 0@2 ~@8>/8".pickRestart([ + "*4" + ]).split([0,0],(x)=>x[0].penv(x[1])).patt(0.04).s("triangle").attack(.08).release(.08).note().vmod(.1).vib(5).gain(0.3).lpf(2000).room(1.5) + +drums: "<~@6 [~@15 0@15 1@2] [2,3]@8 3>/8".pick([ + "<[bd,rd] ~ [~ sf*3] [bd,rd] ~ [~ sf*3] [bd,rd] ~ ~ [~ sf*3] [bd,rd] ~ [~ sf*3] [bd,rd] ~ [~ sf*3]>*8", + "<[sd sf bd] [sf sd sd]>*4", + "<[rd*4],[<~ ~ ~ bd ~ bd ~ ~ bd ~ bd ~ ~ bd ~ bd> <~!14 sf!2> <~ sd bd ~ sd ~ sd bd ~ sd ~ ~ sd ~ sd sd>]*4>", + "/8", +]).pickOut({ + bd: s('bd').bank('Linn9000').lpf(1000), + sd: s('sd').bank('RolandMT32').velocity(.5), + sf: s('sd').bank('RolandMT32').velocity(.2), + rd: s('rd').bank('Linn9000').velocity(0.3).hpf(8000), + mt: s('mt').bank('RolandMT32'), + lt: s('lt').bank('RolandMT32'), + cr: s('cr').bank('Linn9000').speed(0.4).velocity(0.3).hpf(4000), +}).room(.2).gain(0.5) diff --git a/examples/rhythmofthenight.js b/examples/rhythmofthenight.js new file mode 100755 index 0000000..68fb9e4 --- /dev/null +++ b/examples/rhythmofthenight.js @@ -0,0 +1,40 @@ +// "The Rhythm Of The Night" - Work In Progress +// song @by Corona +// script @by eeefano +setDefaultVoicings('legacy') +const as = register('as', (mapping, pat) => { mapping = Array.isArray(mapping) ? mapping : [mapping]; + return pat.fmap((v) => { v = Array.isArray(v) ? v : [v, 0]; + return Object.fromEntries(mapping.map((prop, i) => [prop, v[i]])); }); }); + +const crdpart = "<~ 0@10 1@24 0@19>".pickRestart( +["Ab Cm Bb F@2".slow(5) +,"Bb@3 Ab@3 Cm@2".slow(8) +]); +stack +("<0 1@4 0 1@4 ~@8 2 3@7 2 3@7 0 1@4 0 1@4 0 1@4 0 1@4>".pickRestart( + ["~ [4@3 ~]!3 7:5 6 4 3" + ,"2:-1 0:-2 ~@4 6:1 4:-1 6 4:2 ~@4 [4:2 3]@3 ~@6 4 7:5 6 [4@2 ~] [3:-1 2@3]@2 0 ~@2".slow(4) + ,"~@6 [6 ~]!2" + ,"6 5@0.5 [5 ~] [4 ~]!2 [3 ~] 3:2@1.5 ~@7 6@2 6:2 [5 ~ ]!2 4 3@2 4 2 0:-2 ~@7 [0 2]@3 3@2 4 6:4 4:-4 ~ 0 2 0 4 ~ 0 0:2@2 ~@7".slow(7) +]).as("n:penv").scale("c4:minor").patt("0.07").s("gm_lead_1_square").room(0.4).delay(0.3).dfb(0.35).dt(60/128).gain(0.85) + +,crdpart.chord().anchor("F4").voicing().s("gm_synth_strings_1").color("blue").gain(0.4) + +,"<~@11 1@23 ~ 0@19>".pickRestart( + ["2 ~@2 2 ~@2 2 ~@3 2 ~@3 2 ~" + ,"[2 ~@2 2 ~@2 2 ~]!2" +]).n().chord(crdpart).anchor(crdpart.rootNotes(2)).voicing().s("gm_synth_bass_1").lpf(1500).room(0.5).color("green").gain(0.9) + +,"<~@11 1@8 ~@16 0@19>".pickRestart( + ["<5 7 6 3!2> ~ 9 ~ 10 ~ ~ 12 ~ 11 ~ 10 ~ 11 9 ~" + ,"<6!3 5!3 7!2> ~ 9 ~ 10 ~ ~ 12 ~ 11 ~ 10 ~ 11 9 ~" +]).scale("c3:minor").note().s("gm_lead_2_sawtooth").room(0.3).delay(0.3).dfb(0.5).dt(60/128*2).color("red").gain(0.6) + +,"<[2,3] ~@10 0@6 [0,1]@2 [0,2] 0@5 [0,1]@2 [0,2] 0@6 [2,3] 0@8 [0,1]@2 [0,2] 0@8>".pickRestart( + [stack(s("bd*4").gain(0.8),s("[~ oh]*4").gain(0.14),s("hh*16").gain(0.09),s("[~ cp]*2").gain(0.4)) + ,s("[~ sd!3]!4 [sd*4]!4").slow(2).gain(run(32).slow(2).mul(1/31).add(0.1).mul(0.4)) + ,s("cr").gain(0.2) + ,s("bd").gain(0.8) + ]).bank("RolandTR909").room(0.2).color("yellow").velocity(1) + +).cpm(128/4) diff --git a/examples/shanghai.js b/examples/shanghai.js new file mode 100644 index 0000000..fde237d --- /dev/null +++ b/examples/shanghai.js @@ -0,0 +1,15 @@ +// "Shanghai" (work in progress) +// composed @by King Gizzard +// script @by eefano + +setcps(81 / 60) + +shangai: n("<0 1 2 ~ 4 5 5 ~ 4 2 1 5 8 7 9!2 7 8 5 1 2 4 ~ 5!2 4 ~ 2 1 0 -7!8>*4").scale('ab4:major').clip(.5).s("triangle").room(.8) + +chords: n("<[0,2,4]!4>".add("<0 1 0 1 -2 0>/8")).scale("/8").piano().gain(.5) + +bass: n("<0@7 -4 0@6 0@4 -4 0@9 3@2 4@2>*4".add("<0 1 0 1 5 1>/8")).scale('ab1:major').clip(.95).s("gm_electric_bass_finger").lpf(800) + +hh: s("").bank('9000').speed(1.5).gain(.2) +bd: s("<[bd@3 <~ bd>] ~>").bank('9000').gain(.7) +sd: s("<~ sd>").bank('9000').gain(.7) \ No newline at end of file diff --git a/examples/shedontusejelly.js b/examples/shedontusejelly.js new file mode 100644 index 0000000..b4f4c7d --- /dev/null +++ b/examples/shedontusejelly.js @@ -0,0 +1,62 @@ +// "She don't use jelly" (work in progress) +// composed @by The Flaming Lips +// script @by eefano +const gString = register('gString', (n,tuning, pat) => + (pat.fmap((v) => { if(v[n]=='x') return note(0).velocity(0); + return note(v[n]+tuning[n]); } + ).innerJoin())); +const guitar = (strums,fingers,tuning=[40,45,50,55,59,64]) => (strums.pickOut( + [fingers.pickOut(fingering).gString(0,tuning),fingers.pickOut(fingering).gString(1,tuning),fingers.pickOut(fingering).gString(2,tuning) + ,fingers.pickOut(fingering).gString(3,tuning),fingers.pickOut(fingering).gString(4,tuning),fingers.pickOut(fingering).gString(5,tuning)])); +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i" + ,"" + ,"" + ]).as("note:penv:patt").release(song.pickRestart([0,0,2])) + .s("gm_overdriven_guitar:11").color('magenta').gain(.55).hpf(400).lpf(5000).pan(.5) + +rthm: song.pickRestart( + ["~" + ,"" + ,"" + ]).split([0,0],s=>guitar(s[1].pickRestart(strumming),s[0]).transpose(-12) + .release(song.pickRestart([.1,.1,2])) + .s("gm_overdriven_guitar:6").color('cyan').hpf(700).lpf(6000)).gain(1.5).pan(.4) + +bass: song.pickRestart( + ["~" + ,note("") + ,"~" + ]).s("gm_electric_bass_finger").color('green').lpf(500).dist("4:.25") + +drum: song.pickRestart( + ["~" + ,"/8" + ,"/4" +]).pickOut({ + bd:s('linndrum_bd').hpf(50).lpf(2000).velocity(.8), + sd:s('linndrum_sd').hpf(200).velocity(.7), + hh:s('linndrum_hh').hpf(7000).speed(1.5).velocity(.3), + oh:s('linndrum_oh').hpf(7000).speed(1.1).velocity(.3), + cr:s('linndrum_cr').hpf(7000).speed(1.2).velocity(.3), +}).color('yellow').gain(1.2) + +all(x=>x.rsize(.8).room(1.3) + // .ribbon(1*4,2*4) + ) diff --git a/examples/sparky.js b/examples/sparky.js new file mode 100644 index 0000000..2765f05 --- /dev/null +++ b/examples/sparky.js @@ -0,0 +1,17 @@ +await samples({'gtr': 'gtr/0001_cleanC.wav'}, 'github:tidalcycles/Dirt-Samples/master/'); + +const melodia = x => x.note().s("ocarina").gain(0.6).clip(1).release(0.1).color(2) +const guitar = x => x.note().s("gtr").room(1).gain(0.20).clip(1).release(0.3) +const accordi = x => x.note().s("recorder_bass_sus").gain(1.5).clip(1).release(0.5) +const basso = x => x.note().s("gm_electric_bass_pick").gain(0.8).clip(1).sustain(0.8) +const ritmo = x => x.bank("AlesisHR16").clip(1).gain(0.08) + +const scala = "" + stack( + "<[0,2,4]*2>".struct("[x ~]*4").scale(scala).apply(accordi), + "<[4 2 0 4]*2 >".scale(scala).transpose(-12).apply(guitar), + "-3".struct("[x ~]*4").scale(scala).transpose(-12).apply(basso), +s("[sd,hh*2]!4").apply(ritmo), +).cpm(120/4) + + diff --git a/examples/stacktricks.js b/examples/stacktricks.js new file mode 100755 index 0000000..0c43e63 --- /dev/null +++ b/examples/stacktricks.js @@ -0,0 +1,17 @@ + +stack("c","e","g") + + .withHap((hap)=>{ + hap.context.tempvalue=hap.value; + hap.value=hap.context.stacking===undefined?0:hap.context.stacking[0]; + return hap;}) + + .eq("<0 1 2>").filterValues((val) => val) + + .withHap((hap)=>{ + hap.value=hap.context.tempvalue; + delete hap.tempvalue; + return hap;}) + + .note().piano() + diff --git a/examples/strangerthings.js b/examples/strangerthings.js new file mode 100644 index 0000000..a64713d --- /dev/null +++ b/examples/strangerthings.js @@ -0,0 +1,11 @@ +setcps(0.7); + +p1: n("0 2 4 6 7 6 4 2") + .scale("/2") + .s("supersaw") + .distort(0.7) + .superimpose((x) => x.detune("<0.5>")) + .lpenv(perlin.slow(3).range(1, 4)) + .lpf(perlin.slow(2).range(100, 2000)) + .gain(0.3); +p2: "/8".clip(0.8).struct("x*8").s("supersaw").note(); diff --git a/examples/strudelman.js b/examples/strudelman.js new file mode 100644 index 0000000..ac5ee01 --- /dev/null +++ b/examples/strudelman.js @@ -0,0 +1,23 @@ +// "Strudelman will eat you" +// @by eefano +setcps(1) + +die: s("cr/16").late(666) + .bank(rand.range(0,3).pick(["RolandTR707","RolandS50","SequentialCircuitsDrumtracks","Linn9000"])) + .clip(rand.range(1,3)) + .loop(1).loopBegin(.1) + .loopEnd(rand.range(.18,.3)) + .speed(rand.range(.06,.10)) + .pan(rand.range(.3,.7)) + .gain(.2).attack(.5).release(3).color('black') + +doom: note("a1/8").late(333) + .s(rand.range(0,40).pick(["numbers:0","numbers:1","numbers:2","numbers:3","numbers:4", + "numbers:5","numbers:6","numbers:7","numbers:8","numbers:9","~"])) + .speed(rand.range(.2,.3)) + .gain(.9).color('black') + +pain: s(`<[RolandTR707_cr,RolandS50_cr,SequentialCircuitsDrumtracks_cr,Linn9000_cr, + numbers:0,numbers:1,numbers:2,numbers:3,numbers:4, + numbers:5,numbers:6,numbers:7,numbers:8,numbers:9] ~@666>`).gain(0).color('black') + diff --git a/examples/strudelwall.js b/examples/strudelwall.js new file mode 100644 index 0000000..dfe74e9 --- /dev/null +++ b/examples/strudelwall.js @@ -0,0 +1,30 @@ +// "Strudelwall" +// guitar prototype @by eefano +const standardtuning = [40,45,50,55,59,64]; + +const fingering = +{C:"x:3:2:0:1:0",A:"x:0:2:2:2:0",G:"3:2:0:0:0:3",E:"0:2:2:1:0:0",D:"x:0:0:2:3:2" +,Am:"0:0:2:2:1:0",Em:"0:2:2:0:0:0",Dm:"x:0:0:2:3:1",Em7:"0:2:2:0:3:3", G_:"3:2:0:0:3:3" +,Dsus4:"x:x:0:2:3:3",A7sus4:"x:0:2:0:3:3" +}; +const sk = 300, sh = silence, strumming = +{d: stack(0,timeCat([1,sh],[sk,1]),timeCat([2,sh],[sk,2]),timeCat([3,sh],[sk,3]),timeCat([4,sh],[sk,4]),timeCat([5,sh],[sk,5])) +,u: stack(5,timeCat([1,sh],[sk,4]),timeCat([2,sh],[sk,3]),timeCat([3,sh],[sk,2]),timeCat([4,sh],[sk,1]),timeCat([5,sh],[sk,0])) +//{d: "[~@0 0@300],[~@1 1@300],[~@2 2@300],[~@3 3@300],[~@4 4@300],[~@5 5@300]" +//,u: "[~@5 0@300],[~@4 1@300],[~@3 2@300],[~@2 3@300],[~@1 4@300],[~@0 5@300]" +}; + +const gString = register('gString', (n, pat) => + (pat.fmap((v) => { if(v[n]=='x') return note(0).velocity(0); + return note(v[n]+standardtuning[n]); } + ).innerJoin())); +const guitar = (strums,fingers,tuning=standardtuning) => + (strums.pickRestart(strumming).pickOut( + [fingers.pickOut(fingering).gString(0),fingers.pickOut(fingering).gString(1),fingers.pickOut(fingering).gString(2) + ,fingers.pickOut(fingering).gString(3),fingers.pickOut(fingering).gString(4),fingers.pickOut(fingering).gString(5)])); + +stack( + guitar("[d@4 d@3 u d u d@2 d@3 u d u d@2 d@2 d u@2 u@2 u d u d u]/4","[Em7@9 G_@8 Dsus4@6 A7sus4@7 G_@2]/4") + .s("gm_acoustic_guitar_steel:2").clip(1).release(0.4).gain(0.6) + +).cpm(174/4)//.pianoroll() diff --git a/examples/strumtest1.js b/examples/strumtest1.js new file mode 100644 index 0000000..6e785ce --- /dev/null +++ b/examples/strumtest1.js @@ -0,0 +1,19 @@ + +const k = 0.02; + +function tablature(te,tB,tG,tD,tA,tE) + { return stack(tE.add(64).late(k*5), + tA.add(59).late(k*4), + tD.add(55).late(k*3), + tG.add(50).late(k*2), + tB.add(45).late(k), + te.add(40)); } + +const guitar = seq(tablature("0","2","2","1","0","0"), + tablature("0","3","2","0","1","0"), + "~"); + +stack( + guitar.note().s("gm_electric_guitar_jazz").clip(1).release(0.4).gain(0.5), + +).cpm(110/4/2).pianoroll() diff --git a/examples/strumtest2.js b/examples/strumtest2.js new file mode 100644 index 0000000..1c808ae --- /dev/null +++ b/examples/strumtest2.js @@ -0,0 +1,9 @@ +setDefaultVoicings('legacy') +const k = 0.01; + +stack( + n(stack("~ -1","~@0.5 0@1.5","1 1".late(k),"~ 2".late(k*2),"~ 3".late(k*3))) + .chord("G!2 Bm E ".slow(4)).anchor("G4!2 F#4 E4".slow(4)).voicing() + .s("gm_electric_guitar_jazz").clip(1).release(0.4).gain(0.5), + +).cpm(140/4).pianoroll() \ No newline at end of file diff --git a/examples/strumtest3.js b/examples/strumtest3.js new file mode 100644 index 0000000..fae00ca --- /dev/null +++ b/examples/strumtest3.js @@ -0,0 +1,13 @@ +setDefaultVoicings('legacy') + +const k = 0.01; + +stack( + n(stack("0@2 0 3@2 3 0 3", + "1@2 1 2@2 2 1 2".late(k), + "2@2 2 1@2 1 2 1".late(k*2), + "3@2 3 0@2 0 3 0".late(k*3))) + .chord("G!2 Bm E ".slow(4)).anchor("G4!2 F#4 A4".slow(4)).voicing() + .s("gm_electric_guitar_jazz").clip(1).release(0.2).gain(0.5), + +).cpm(140/4).pianoroll() diff --git a/examples/swimandsleep.js b/examples/swimandsleep.js new file mode 100644 index 0000000..fcec843 --- /dev/null +++ b/examples/swimandsleep.js @@ -0,0 +1,102 @@ +// "Swim And Sleep Like A Shark" (Work In Progress) +// song @by Unknown Mortal Orchestra +// script @by eefano +setCps(123/60) +Pattern.prototype.enumerate = function () { + const pat = this.sortHapsByPart() + return new Pattern(state => { + const haps = pat.query(state.withSpan(span => span.begin.wholeCycle())) + const chunks = haps.length + return haps.map((hap, i) => new Hap(hap.whole, hap.part.intersection(state.span), [hap.value, i, chunks]) + ).filter(hap => hap.part != undefined) + }).splitQueries() +} +Pattern.prototype.warp = function (tpat) { + const pat = this; + return tpat.enumerate().withValue(v => pat.zoom(Fraction(v[1]).div(v[2]), + Fraction(v[1]).add(1).div(v[2])) ).outerJoin()} +function tablature(te,tB,tG,tD,tA,tE) + { return stack(te.add(64),tB.add(59),tG.add(55),tD.add(50),tA.add(45),tE.add(40)); } + +const parts = +{theme: tablature( +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 11 ~", +"9 ~ 9 ~ 10 9 7 ~ 9 6 ~ 10 ~ 10 ~ 12 14 14 ~ 13", +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 6 ~ ~ ~ ~ ~ ~ ~ ~ ~", +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~", +"7 7 ~ 7 ~ 7 5 5 ~ 4 ~ 9 9 ~ 9 ~ ~ 11 ~ 11", +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~", +).warp("t@2 t!4 [t!2]@4 t!2 [t!3]@6 t!4 t@2 t@3 t t@4").slow(16) +,arp1: tablature( +"~ ~ ~ 0 ~ ~ ~ 0 ~ ~ ~ 0", +"~ ~ ~ ~ ~ ~ ~ ~ ~ 0 ~ ~", +"~ 6 ~ ~ ~ 4 ~ ~ ~ ~ 2 ~", +"~ ~ 6 ~ ~ ~ 4 ~ ~ ~ ~ ~", +"4 ~ ~ ~ 2 ~ ~ ~ 0 ~ ~ ~", +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~",).slow(6) +,chords: tablature( +"~ ~ ~", +"0 2 0", +"1 2 1", +"2 2 2", +"2 0 2", +"0 ~ 0",).warp("t@3 t t@4").slow(8) +,arp2: tablature( +"~ ~ ~ 4 ~ ~ ~ ~ ~ 4 ~ ~ ~", +"~ ~ 2 ~ 2 ~ ~ 4 ~ ~ 4 ~ ~", +"~ 3 ~ ~ ~ 3 ~ ~ 4 ~ ~ 4 ~", +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 4", +"~ ~ ~ ~ ~ ~ 2 ~ ~ ~ ~ ~ ~", +"2 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~",).warp("t!3 t@2 t t@2 t!6 t@2").slow(8) +,arp3: tablature( +"~ ~ ~ 0 ~ ~ ~ ~ ~ ~ 0 ~ ~ ~ ~", +"~ ~ ~ ~ ~ ~ ~ ~ 0 ~ ~ 0 ~ ~ ~", +"~ 4 ~ ~ 4 ~ ~ ~ ~ 2 ~ ~ 2 ~ ~", +"~ ~ 4 ~ ~ 4 ~ ~ ~ ~ ~ ~ ~ ~ ~", +"2 ~ ~ ~ ~ ~ 2 0 ~ ~ ~ ~ ~ 0 2", +"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 0",).warp("t!3 t@2 t!11").slow(8) +,lick1: tablature( +" ~ ~ ~ ~ 17 ~", +"17 ~ 17 ~ ~ 17", +" ~ ~ ~ ~ ~ ~", +" ~ ~ ~ ~ ~ ~", +"16 16 ~ 16 ~ ~", +" ~ ~ ~ ~ ~ ~",).warp("t@2 t!4 t@2").slow(4) +,lick2: tablature( +" ~ ~ ~ ~ 16 ~", +"16 ~ 16 ~ ~ 16", +" ~ ~ ~ ~ ~ ~", +" ~ ~ ~ ~ ~ ~", +"14 14 ~ 14 ~ ~", +" ~ ~ ~ ~ ~ ~",).warp("t@2 t!4 t@2").slow(4) +,coda: tablature( +"~ ~ ~ ~ ~ ~ ~ ~", +"7 5 7 9 10 10 12 9", +"~ ~ ~ ~ ~ ~ ~ ~", +"~ ~ ~ ~ ~ ~ ~ ~", +"5 4 5 7 9 9 11 7", +"~ ~ ~ ~ ~ ~ ~ ~",).warp("t@3 t!3 t@2 t@3 t t@4").slow(8) +}; // end of parts + +const split = register('split', (deflt, callback, pat) => + callback(deflt.map((d,i)=>pat.withValue((v)=>Array.isArray(v)?(i".pickRestart( + {intro: "", + verse: "", + solo: "/4"}).split([0,0],(x)=>x[0].pickRestart(parts).transpose(x[1])) + .note().s("gm_electric_guitar_jazz:0").clip(1).release(0.4).gain(0.6).color('yellow'), + + "<~@2 ~@16 0@66 ~@16 0@66 ~@48 0@66 ~@48 ~@4>".pickRestart([ + `<7@2 9 7 6@2 8@2 5@2 7@2 7@2 6 5 4@2 2@6 ~@2 + 4@2 4b@5 4 5 6 4@5 4 6@2 7@4 6@4 5@3 4 2@6 ~@8 + 8@2 9@4 8@4 7@4 7@6 ~@7 + 5@3 [4@4 5 4]@8 [3 4 5 7 5 3]@8 2@6 ~@10>*2`]).scale("e:major").transpose(12) + .note().s("gm_ocarina").gain(0.6).color('green'), + + "<0@2 1@16 1@66 1@16 1@66 1@48 1@66 1@48 ~@4>".pickRestart([ + "*2", + ",sd,hh*2"]) + .s().bank("Linn9000").clip(1).gain(0.08).color('cyan') +).room(0.3) \ No newline at end of file diff --git a/examples/swimmingsnake.js b/examples/swimmingsnake.js new file mode 100644 index 0000000..a51ef76 --- /dev/null +++ b/examples/swimmingsnake.js @@ -0,0 +1,37 @@ +// "Swimming With The Snake" - Work In Progress +// song @by Tim Smith of Cardiacs +// script @by eefano +setCps(95/60) +const rando1 = `4 5 6 3 5 6 5 2 3 4 5 2 6 ~ 7 6 +4 2 5 3 6 5 3 7 4 5 6 3 7 ~ 9 4 6 7 3 5 3 6 5 1 4 5 3 4 2 3 4 5 +7 8 9 7 8 9 10 6 3 7 6 4 5 6 7 8 9 3 5 6 7 8 3 5 6 7 5 6 7 9 8@2` +const rando2 = `0 1 2 -1 0 1 -2 2 1 5 4 -3 0 1 2 -2 +2 1 0 1 2 0 1 0 1 -1 0 -2 0 -1 -2 -1 -2 -3 -2 -1 0 -1 0 -2 -1 -2 1 0 ~ 0 -2 0 +1 3 0 1 -1 2 1 0 -1 -2 -1 0 1 -3 -1 0 1 -2@2 -1 0 1 -1 -2 1 3 4 5 -1 2 3 1` +const halo = x => + x.slow(20).scale("c#:minor").add(12).note() +const part = stack(rando1.apply(halo).gain(0.2), rando2.apply(halo).gain(0.1)) +const pats = +{ba1: "[0@8 -1@4 -2@2 -3@2 -2@8]/24" +,ba2: "[-2 -1 0]/6" +,ba4: "[-1 -2 -3 2 -2 -5 [-4 -3 -2 -1 0 2 -4 -3]@12 -2@8]/26" +,al2: "[[5,2] ~ [5,2] [3,0] ~ [3,0] [4,1] ~ [4,1] [0,-3] ~ [0,-3]]/6" +,vr1: "[~@0.5 11 13!2 11@4 ~ 11 13!2 11 9 10 11 <[ 9@2.5 8@2 7@3 ~] [~@0.5 9@3 ~@5]>@8.5 ]/24" +,vr4: "[10 13 11 9 10 11 [9!2]@3 [7!2]@3 ~@14]/26" +,tr1: "[0 3 1 4 2 5 -1 2 0 3 1 4 2 5 3 6 4 1 2 -1 3 0 4 1]/6" +} +stack(part.layer(x=>x.pan(0.2),x=>x.pan(0.8).late(3/4)).s("gm_pad_warm").release(0.05).room(0.5).color("white") + +,"" + .pickRestart(pats).scale("c#:minor").sub(12).note().s("gm_synth_strings_2").gain(1).color("green") +,"<~@48 al2@24 ~@24 ~@22 ~@26 ~@46 ~@26>".pickRestart(pats).scale("c#:minor").add(24).note() + .s("gm_recorder").superimpose(x=>x.late(1/2).velocity(.5)).release(0.2).gain(0.4).color("red") +,stack("<~@48 ~@24 vr1@46 vr4@26 vr1@46 vr4@26>".pickRestart(pats), + "<~@48 ~@24 ~@46 ~@26 vr1@46 vr4@26>".pickRestart(pats).sub(2)) + .scale("c#:minor").transpose(0).note().s("triangle").hpf(900).attack(.05).release(.05).clip(.97).gain(1.2).color("yellow") +,"<~@48 ~@24 ~@46 ~@26 ~@46 tr1@26>".pickRestart(pats).scale("c#4:minor") + .superimpose(x=>x.transpose(12)).note().s("supersaw").gain(0.20).lpf(2000).color("red") +,s("shaker_small").struct("[x ~ ~ x]").gain("4.0 ~ ~ 2.0").color("brown") +,s("handbells").struct("x*2 x").gain(rand.range(0.1,0.4)).color("brown") + +)//.pianoroll() diff --git a/examples/tablaturetest.js b/examples/tablaturetest.js new file mode 100755 index 0000000..f4bf086 --- /dev/null +++ b/examples/tablaturetest.js @@ -0,0 +1,21 @@ +// NOT WORKING UNTIL mixJoin is implemented + +const k = 2; + +const tablature = (pat) => reify(pat) + .fmap(([te,tB,tG,tD,tA,tE]) => stack( + pure(tE+64).late(k*5).color("#FFF0F0"), + pure(tA+59).late(k*4).color("#FFE0E0"), + pure(tD+55).late(k*3).color("#FFD000"), + pure(tG+50).late(k*2).color("#FFD8D8"), + pure(tB+45).late(k*1).color("#FFD0D0"), + pure(te+40).late(k*0).color("#FFE8E8")) + ).outerJoin() + +const guitar = tablature("0:2:2:1:0:0!2 0:3:2:0:1:0 ~"); + +stack( + "E3 C3 ~".s("triangle"), + guitar.note().s("gm_electric_guitar_jazz").clip(1).release(0.4).gain(0.5), + +).slow(5).pianoroll() \ No newline at end of file diff --git a/examples/tarantella.js b/examples/tarantella.js new file mode 100644 index 0000000..2d63b32 --- /dev/null +++ b/examples/tarantella.js @@ -0,0 +1,19 @@ +// "Endless Tarantella" +// script @by eefano +setcps(140/60) + +//let pizza = run(16).slow(16) +let pizza = rand.range(0,16).segment(16).slow(16) + +iamme: pizza.pick(["4 ~ 4","7 ~ 7","4","4 ~ 4","5 ~ 5","5 6 5","4","4 ~ 5","4@2 3","3 ~ 4","3@2 2","2 ~ 3","4 5 4","3 2 1","0","7 ~ 7"]) + .scale("a:minor").s('gm_clarinet').note() + +let pasta = pizza.pick([0,0,0,0,1,1,0,0,2,2,0,0,2,2,0,0]).fast(2) + +funiculi: pasta.pick(["[0 ~] [-3 ~]","[3 ~] [-2 ~]","[1 ~] [-3 ~]"]).slow(2) + .scale("a2:minor").s('gm_tuba').note().lpf(800) + +funicula: pasta.pick(["[~@2 [0,2,4]]!2","[~@2 [1,3,5]]!2","[~@2 [4,-1,1]]!2"]).slow(2) + .scale("a3:minor").s('gm_harmonica').note() + +uagliu: s("tambourine") diff --git a/examples/ventocaldo.js b/examples/ventocaldo.js new file mode 100644 index 0000000..f872103 --- /dev/null +++ b/examples/ventocaldo.js @@ -0,0 +1,55 @@ +// "Il Vento Caldo Dell'Estate (wip)" +// song @by Alice +// script @by eefano +const split = register('split', (deflt, callback, pat) => callback(deflt.map((d,i)=> pat.withValue((v)=>{ + const isobj = v.value !== undefined; const value = isobj ? v.value : v; + const result = Array.isArray(value)?(i".pickRestart({ + a: "<0@6 0@6 0@7 0@7 0@8 0@10 0@10>*2", + b: "<0@6 0@6 0@6 0@7 0@7 0@6 0@6 0@6 0@6 0@7 0@7 0@6 0@8 0@10 0@8 0@10 0@8 0@10 0@10 0@10>*2" + +}).pickRestart(["<0 4 7 8 10 11 9 12 14 12>*2"]) + .scale("c#4:major").note().s("gm_drawbar_organ:4").room(.3).lpf(1200).gain(0.7).color('yellow') + +bass: "".pickRestart({ + a: "<[ ]>".s("gm_electric_bass_finger:2"), + b: "<~@2 c#2:1@4 c2:1@2 a#1:1@6 c2:1@2 g#1:1@8 d#2:1@8 c2:1@8 f2:1@8 c#2:1@8>".s("triangle"), + c: "<~@2 [[c#2!6 a#1!8 g#1!6 d#2!8 c2!8 f2!8 c#2!8]!2]@104>".fast(1.2).s("gm_electric_bass_finger:2"), +}).split([0,.6],s=>note(s[0]).clip(s[1])).lpf(400).gain(1.5).color('cyan') + +wind: "<~@172 a@56 ~@145 a@56 b@87 ~@8>".pickRestart({ + a: "<~@2 C#:g#2@4 G#:g#2@2 A#m:g#2@6 C#:g#2@2 G#:g#2@8 D#:d#2@8 Cm:d#2@8 F7:d#2@8 C#:d#2@8>", + b: "<~@2 [[C#:g#2:1@6 A#m:g#2:1@8 G#:g#2:1@6 D#:a#2:1@8 Cm:a#2:1@8 F7:a#2:1@8 C#:a#2:1@8]!2]@104>".fast(1.2) + +}).split([0,0,0],s=> + n(s[2].pickRestart(["<0,1,2,3>/8","<[0,1,2,3]*3>/2"])) + .chord(s[0]).anchor(s[1]).mode('above').voicing().s("gm_church_organ").gain(0.7) + .superimpose(u=>u.when(s[2],w=> + n("<4 5 6 7 8 7 6 5 4>*8").chord(s[0]).anchor(s[1])).mode('above').voicing().s("sawtooth").gain(0.65)) + ).room(.7).color('green') + +voic: "<~@172 a@56 ~@145 a@56 b@87 ~@8>".pickRestart({ + a: note(`<~ c#4 d#4@2 c#4@2 [c4 c#4] [d#4 f4] c#4@2 d#4@2 ~ [~ c#4] [c4 c#4] [d#4 f4] d#4 g#3@5 + ~ [~ d#4] f4@2 d#4@2 d4 d#4 ~ [~ d#4] f4@2 [g4 f4] [d#4 f4] d#4@2 + ~ [~ d#4] f4@2 d#4@2 [f4@3 d#4@3]@3 f4@9 >`) + .s("gm_oboe").gain(1.7).lpf(3000).release(.1), + b: note(`<~@2 [[d#4@2 c#4@2 [c4 c#4] [d#4 f4] c#4@2 [d#4@6 ~ c#4]@4 [c4 c#4] [d#4 f4] d#4 + [g#3@8 ~ d#4]@5 f4@2 d#4@2 d4 [d#4@4 ~ d#4]@3 f4@2 g4@2 d#4@3 + [~ d#4] f4@2 d#4@2 f4@2 d#4 f4@8 [~ ]]!2]@104 >`).fast(1.2) + .s("gm_distortion_guitar:2").gain(1).lpf(3000).release(.1) +}).color('purple').room(.2) + +drums: ``.pickRestart({ + a: "", b: "<~ ~ sd ~>", c:"<[~ sd*2] ~@4>", d:"<~ sd>", e:"<~ [~ sd*2]>", + f:"<~ [[~ sd] [sd ~]]>", g:"<~ [~ sd]>", + h:"<[[[sd,[~ sd@15]] sd] sd]@2 [[bd sd [~ bd] sd]!24]@96 bd@8>".fast(1.2) +}).pickOut({ + bd: s('bd').lpf(800).velocity(1.1), + sd: s('sd').velocity(.7), + hh: s('hh').velocity(0.1).hpf(8000), + cr: s('cr').speed(0.7).velocity(0.1).hpf(6000), +}).bank("Linn9000").room(0.2).gain(0.8).rsize(4) diff --git a/examples/verminmangle.js b/examples/verminmangle.js new file mode 100644 index 0000000..0ed1928 --- /dev/null +++ b/examples/verminmangle.js @@ -0,0 +1,31 @@ +// "Vermin Mangle" (work in progress) +// song @by Tim Smith (Cardiacs) +// script @by eefano +setcps(52 / 60) +const song = `< i@8 j@27 >` +const melody = { + i: "*6", + j: ``, +} +const ch0rds = { + i: "", + j: "", +} + +$: note(song.pickRestart(melody)).clip(.98) + .apply(song.pickRestart( + { i: x=>x.s("gm_trumpet").pan(.3).gain(.6), + j: x=>x.s("gm_vibraphone:4").vib(10).vibmod(.09).delay(.4).dt(.2).dfb(.10).gain(.7).dec(2) + })) + +$: chord(song.pickRestart(ch0rds)).anchor('E4').voicing() + .layer(x=>x.s("gm_accordion:2").struct("[~ x x]").clip(.6).pan(.40).gain(.4), + x=>x.transpose(12).s("gm_string_ensemble_2:2").pan(.5).gain(.4)) + +$: n("[0 ~ ~]").chord(song.pickRestart(ch0rds)).mode('root').anchor('f#2').voicing() + .s("gm_tuba:3").gain(1) + +$: s("bassdrum2:2,tambourine:0").clip(1.5).gain(1.5) + +all(x => x.room(.8)) diff --git a/examples/veronicainecstasy.js b/examples/veronicainecstasy.js new file mode 100644 index 0000000..945a25d --- /dev/null +++ b/examples/veronicainecstasy.js @@ -0,0 +1,18 @@ +// "Veronica In Ecstasy" (Chorus) +// song @by Tim Smith (of Cardiacs) +// script @by eefano +setDefaultVoicings('legacy') +const chrds = ""; +const meldy = `[[f#6]*3 [f#6 [~ ~ f#6]]] [[f#6]*3 [[f#6 e6 ~] e6]] + [[e6 e6 [e6 f#6]] [[g6 ~ d6] d6]] [[d6 d6 [e6 f#6]] [g#6 f6 c#6]] + [[g#5 [ ~ ~ g#5]] [[a5 b5] c#6 c#6]] [[f#6]*3 [f6 c#6 g#5]] + [[g#5 [ ~ ~ g#5]] [[a#5 c6] d6 a#5]] [[g#5 a5 b5] [c#6 d6 e6]] + [[d6 a#5 f5] [[g#5 ~] g#5]] ~ [~@3 [~ ~ f#6]]`.slow(11); +stack( + meldy.clip(0.9).note(), + //meldy.transpose("-12").note(), + chord(chrds).anchor("G4").voicing().struct("<[[~ x x] [x@2 x] [~ x ~] x]!8 [x!4] [~ x ~ x]!2>").gain(0.6), + chrds.rootNotes(2).note().struct("<[x@2 ~]*2!9 [x ~ [~ ~ x] ~]!2>").gain(0.6), +).cpm(120/4).room(0.4).piano()//.pianoroll() + .room( slider(1.93,0,10)) + .rsize( slider(2,0,8,1)) \ No newline at end of file diff --git a/examples/veronicazigzag.js b/examples/veronicazigzag.js new file mode 100755 index 0000000..9f2bef4 --- /dev/null +++ b/examples/veronicazigzag.js @@ -0,0 +1,16 @@ + +setDefaultVoicings('legacy') +const chrds = "".rev(); +const meldy = `[[f#6]*3 [f#6 [~ ~ f#6]]] [[f#6]*3 [[f#6 e6 ~] e6]] + [[e6 e6 [e6 f#6]] [[g6 ~ d6] d6]] [[d6 d6 [e6 f#6]] [g#6 f6 c#6]] + [[g#5 [ ~ ~ g#5]] [[a5 b5] c#6 c#6]] [[f#6]*3 [f6 c#6 g#5]] + [[g#5 [ ~ ~ g#5]] [[a#5 c6] d6 a#5]] [[g#5 a5 b5] [c#6 d6 e6]] + [[d6 a#5 f5] [[g#5 ~] g#5]] ~ [~@3 [~ ~ f#6]]`.slow(11).rev(); +stack( + meldy.clip(0.9).note(), + chord(chrds).anchor("G4").voicing().struct("<[[~ x x] [x@2 x] [~ x ~] x]!8 [x!4] [~ x ~ x]!2>").gain(0.55), + n("0").chord(chrds).mode("root:c3").voicing().struct("<[x@2 ~]*2!9 [x ~ [~ ~ x] ~]!2>").gain(0.7), +).cpm(105/4).piano() +.room( slider(1.93,0,10)) +.rsize( slider(2,0,8,1)) + diff --git a/examples/vine.js b/examples/vine.js new file mode 100644 index 0000000..b5c3a11 --- /dev/null +++ b/examples/vine.js @@ -0,0 +1,48 @@ +// "Vine" (work in progress) +// composed @by Tim Smith of Spratleys Japs +// script @by eefano +setCps(143 / 60 / 4) +const song = "<0@8 1@28 2@24 3@24 1@25 1@28 2@36 3@24 4@16 5@12 6@66 7@66 8@66 ~@8>*4" +const chordseq = song.pickRestart(["~", +"*2", // verse +"*2", // chorus +"/2", "~", // post-chorus +"*8", // interlude +"*8", //snare +"*8", //handclaps +"*8"]); //triangle + +voice: song.pickRestart(["~", + note("*4"), + note("<[g#4@2 ~ f#4] [f#4@2 ~ f4] [f4@2 ~ d#4] [d#4@2 ~ d4] [d4@2 ~ c4] [c4 a4@3]>*2").gain(1.4), + "~" +]).s('gm_oboe').clip(.95).color('yellow') + +bass: n(song.pickRestart(["~","0*4","[0@2 ~ 0]*2","0*8"])).chord(chordseq).mode("root:e2").voicing() + .s("gm_electric_bass_pick").clip(.90).lpf(300).gain(1).color('green') +guitar: n(song.pickRestart(["~","[0,2,3]*2","[[0,2,3]@3 [0,2,3]]*2","~"])).chord(chordseq).mode("root:e3").voicing() + .s(song.pick(["~","gm_acoustic_guitar_steel:2","gm_overdriven_guitar:2","~"])).color('red') +organ: n(song.pick(["~","~","~","~","[2 1]*4"])).anchor("g5").chord(chordseq).voicing() + .s("sawtooth").clip(.6).color('cyan') + +drums: song.pickRestart([ + " sd]>*2", + "*2", + "*2", + "~","","", + " sd]>*2", + " [sd,cp]]>*2", + " [sd,cp]]>*2", +]).pickOut({ + bd:s('linndrum_bd').lpf(3000).room(.2).velocity(.8), + sd:s('linndrum_sd').room(.2).velocity(.65), + hh:s('linndrum_hh').hpf(7000).speed(1.5).velocity(.3), + oh:s('linndrum_oh'), + sl:s('sleighbells'), + tr:s('anvil').speed(1.15).velocity(30), + cp:s('cp') +}) + +all(x=>x.room(.1) + // .ribbon(2*4,1*8) + ) diff --git a/examples/waltzno2.js b/examples/waltzno2.js new file mode 100644 index 0000000..559991d --- /dev/null +++ b/examples/waltzno2.js @@ -0,0 +1,22 @@ +// "Waltz #2" (cps function demo) +// composed @by Dmitri Shostakovich +// script @by eefano +setDefaultVoicings('legacy') + +melody: "<~@4 0@16 1@7 2@11.5 ~@3.5>".pickRestart([ + `<4 [2@2 1] [0@4 0 1]@2 [2 0 2] [4@2 5] 4 3 + 3 [1@2 0] [0b@4 -3 0b]@2 [1 0b 1] [3 4 5] 4b 4>`, + "<[9,7] [[8,6]@2 [7,5]] [[6,4]@2 [5,3]] [3,0] [8,6] [[7,5]@2 [6,4]] [6,4]>", + "<[~ [2 ~] [3 ~]] [[4 ~] [4 3] [4 5]] [[3 ~] [3 2] [3 4]] [[2 ~] ~ [4 ~]] > ".sub("<0 0 [0,2]>/4") ]) + .scale("c4:minor").note().s("gm_oboe:2").gain(0.7)._pianoroll({minMidi:10}) + +piano: "<0@28 1@10 0@4>".pickRestart([ + n("<<0 -1> [4,5]!2>*3").chord(""), + n("<3 <[4,5] > ~>*3").chord("") + ]).anchor('f2').mode('root').voicing().piano()._pianoroll() + +tempochanges: cps(sine.segment(32).slow(16).mul(30).add(160).div(60*3)).gain(0) + +all(x=>x + //.ribbon(24,16) + .room(0.6)) \ No newline at end of file diff --git a/examples/woodeneye.js b/examples/woodeneye.js new file mode 100644 index 0000000..7622ed2 --- /dev/null +++ b/examples/woodeneye.js @@ -0,0 +1,29 @@ +// "Woodeneye" (wip) +// song @by Cardiacs +// script @by eefano +setCps(200 / 60 / 2) +const song = "<1@16 2@16 3@7 4@4>" +const chordseq = song.pickRestart([ + "~", + "<[~ A:f4:.6:0!15]>/4", + "<[~ A:g4:.6!7] [F:f4:.6!8]>/2", + "", + "<[~ D:g4:.6!3] [D:g4 A:d4]>"]) + +mello: chordseq.as("chord:anchor:clip:n").voicing().speed(0.97).begin(.03).s('gm_synth_bass_1').lpf(2000).gain(.7).color('cyan') + +drums: song.pickRestart([ + " [sd <~!3 [sd,oh]>]>*2", + " [sd <~!3 bd ~!3 [sd,oh]>]>*2", + " [sd <~!3 [sd,oh]>]>*2", + "] sd>*2", +]).pickOut({ + bd: s('linndrum_bd').lpf(2000).room(.2).velocity(.8), + sd: s('linndrum_sd').room(.2).velocity(.75), + hh: s('linndrum_hh').hpf(7000).speed(1.5).velocity(.4), + oh: s('linndrum_oh').speed(1.3).hpf(3000).velocity(.3).clip(1.2), +}) + +all(x => x.room(.1) + // .ribbon(2*4,1*8) +)