From f7354554425e17757f31d81e26789ad20df852bf Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 21 Oct 2022 01:48:24 +0100 Subject: debugged, CPU usage reduced, progression formulated --- include/sequence_sections.inc | 269 ++++++++++++++++++++++++++---------------- 1 file changed, 169 insertions(+), 100 deletions(-) (limited to 'include/sequence_sections.inc') diff --git a/include/sequence_sections.inc b/include/sequence_sections.inc index 5bc4041..c88500c 100755 --- a/include/sequence_sections.inc +++ b/include/sequence_sections.inc @@ -17,78 +17,116 @@ #include "include/instruments_synthesis.inc" -instr sequencer_s0 - schedule("play_musicbox1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) - if (gkmel_section_change == 1) then - schedulek "play_musicbox1", 0, mel_length:k(), 1 ; single note only +/* + Pause the melodic progression for the duration of the calling instrumnet +*/ +opcode pause_melprogression, 0, 0 + gkmel_pause = 1 + if (lastcycle() == 1) then + gkmel_pause = 0 endif - +endop + + +/* + Call an instrument for outward transition; p4 is passed as the rise ratio of total duration +*/ +opcode transition_out, 0, S + Sinstrument xin + iduration = random(4, min(12, p3*0.5)) + iriseratio = random(0.5, 0.9) + schedule(Sinstrument, p3 - (iduration * iriseratio), iduration, iriseratio) +endop + + +/* + Call an instrument for inward transition; p4 is passed as short duration for an almost immediate attack +*/ +opcode transition_in, 0, S + Sinstrument xin + iduration = random(3, min(10, p3*0.25)) + schedule(Sinstrument, 0, iduration, 0.03) +endop + + +instr sequencer_s0 + transition_in("transition_idiophone_randtime") + imaxlen = p3 + itime = 0 + while (itime < imaxlen) do + idur = random(5, 10) + idur = (idur + itime > imaxlen) ? imaxlen - itime : idur + schedule("phrase_idiophone1", itime, idur, 1) + itime += random(idur*0.6, idur*0.8) + od + transition_out("transition_idiophone_stretch1") endin instr sequencer_s1 - schedule("play_musicboxstretch1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 0) - schedule("play_musicbox1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) + schedule("phrase_idiophone_stretch1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 0) + schedule("phrase_idiophone1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) kdo init 0 if (gkmel_section_change == 1) then klen = mel_length:k() - schedulek("play_musicboxstretch1", 0, klen*random:k(1, 1.5), 0) + schedulek("phrase_idiophone_stretch1", 0, klen*random:k(1, 1.5), 0) if (kdo == 0) then - schedulek("play_musicbox1", 0, klen*random:k(1, 1.3), 0) ; chords + schedulek("phrase_idiophone1", 0, klen*random:k(1, 1.3), 0) ; chords kdo = 1 else kdo = 0 endif endif - + transition_out("transition_idiophone_randtime") endin instr sequencer_s2 - schedule("fms_playnote", 0, p3, 0) - schedule("play_musicbox1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) + schedule("note_bass1", 0, p3, 0) + schedule("phrase_idiophone1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) if (gkmel_section_change == 1) then klen = mel_length:k() - schedulek("play_musicbox1", 0, klen, 1) ; single note only - schedulek("play_musicboxstretch1", 0, klen*1.3, 0) + schedulek("phrase_idiophone1", 0, klen, 1) ; single note only + schedulek("phrase_idiophone_stretch1", 0, klen*1.3, 0) endif if (lastcycle:k() == 1) then - turnoff2("fms_playnote", 0, 1) + turnoff2("note_bass1", 0, 1) endif endin instr sequencer_s3 - schedule("fms_playnote", 0, p3, 0) - schedule("play_musicboxstretch1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) + schedule("note_bass1", 0, p3, 0) + schedule("phrase_idiophone_stretch1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1) if (gkmel_section_change == 1) then klen = mel_length:k() - schedulek("play_musicbox1", 0, klen, 0) ; chords - schedulek("play_musicboxstretch1", 0, klen*0.8, 1) + schedulek("phrase_idiophone1", 0, klen, 0) ; chords + schedulek("phrase_idiophone_stretch1", 0, klen*0.8, 1) endif if (lastcycle:k() == 1) then - turnoff2("fms_playnote", 0, 1) + turnoff2("note_bass1", 0, 1) endif endin instr sequencer_s4 - idiophone_change - schedule("playdropstretch", 0, i(gkseq_beattime) * 2 * i(gkmel_section_change_due), random(0.5, 1.5), 1, 1, 0.5) + idiophone_change() + schedule("phrase_dropstretch1", 0, i(gkseq_beattime) * 2 * i(gkmel_section_change_due), random(0.5, 1.5), 1, 1, 0.5) if (gkmel_section_change == 1) then klen = mel_length:k() - schedulek("play_musicbox1", 0, klen, 1) ; single note only - schedulek("play_musicboxstretch1", 0, klen*1.3, 1) + schedulek("phrase_idiophone1", 0, klen, 1) ; single note only + schedulek("phrase_idiophone_stretch1", 0, klen*1.3, 1) endif + transition_out("transition_waterbubbler1") endin @@ -96,18 +134,18 @@ instr sequencer_s5 imaxlen = p3 itime = 0 while (itime < imaxlen) do - idur = random(10, 40) - schedule("playdropstretch", itime, idur, random(0.5, 1.5), 1, 1, 1) + idur = random(5, 20) + schedule("phrase_dropstretch1", itime, idur, random(0.5, 1.5), 1, 1, 1) if (random(0, 1) > 0.5) then - schedule("playdropstretch", itime + random(0, 5), idur, random(0.5, 1.5), 1, 1, 2) + schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 1, 1, 2) endif if (random(0, 1) > 0.5) then ; no reson - schedule("playdropstretch", itime + random(0, 5), idur, random(0.5, 1.5), 0, 1, 1) + schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 0, 1, 1) endif if (random(0, 1) > 0.5) then - schedule("waterbubbler", itime, idur, 1) + schedule("phrase_waterbubbler1", itime, idur, 1) endif if (random(0, 1) > 0.5) then @@ -120,16 +158,16 @@ endin instr sequencer_s6 - schedule("playdropstretch", 0, i(gkseq_beattime) * 1.5 * i(gkmel_section_change_due), random(0.5, 1.5), 0, 1, 1) + schedule("phrase_dropstretch1", 0, i(gkseq_beattime) * 1.5 * i(gkmel_section_change_due), random(0.5, 1.5), 0, 1, 1) if (gkmel_section_change == 1) then - ;turnoff2 "play_musicboxstretch2", 0, 1 - schedulek("play_musicboxstretch2", 0, mel_length:k()*1.3, 0) - schedulek("waterbubbler", 0, mel_length:k(), 0) + ;turnoff2 "phrase_idiophone_stretch2", 0, 1 + schedulek("phrase_idiophone_stretch2", 0, mel_length:k()*1.3, 0) + schedulek("phrase_waterbubbler1", 0, mel_length:k(), 0) endif - awL, awR bus_read "waterbubbler" - amL, amR bus_read "note_musicboxstretch2" + awL, awR bus_read "phrase_waterbubbler" + amL, amR bus_read "note_idiophonestretch2" ir = 256 irm = 2 @@ -146,95 +184,101 @@ instr sequencer_s6 endin - instr sequencer_s7 idiophone_change() - schedule("playdropstretch", 0, i(gkseq_beattime) * 1.5 * i(gkmel_section_change_due), random(0.5, 1.5), 1, 1, 8) + schedule("phrase_dropstretch1", 0, i(gkseq_beattime) * 1.5 * i(gkmel_section_change_due), random(0.5, 1.5), 1, 1, 8) if (gkmel_section_change == 1) then - schedulek("play_musicboxstretch2", 0, mel_length:k()*1.3, 0) - schedulek("waterbubbler", 0, mel_length:k(), 1) + schedulek("phrase_idiophone_stretch2", 0, mel_length:k()*1.3, 0) + schedulek("phrase_waterbubbler1", 0, mel_length:k(), 1) endif - aL, aR bus_read "note_musicboxstretch2" + aL, aR bus_read "note_idiophonestretch2" bus_mix("delay1", aL*0.2, aR*0.2) bus_mix("main", aL*0.8, aR*0.8) + transition_out("transition_idiophone_randtime") endin - instr sequencer_s8 + pause_melprogression() imaxlen = p3 itime = 0 while (itime < imaxlen) do - idur = random(5, 20) + idur = random(p3*0.1, p3*0.3) idur = (idur + itime > imaxlen) ? imaxlen - itime : idur - schedule("playdropstretch", itime, idur, random(0.5, 1.5), 1, 1, 1) + schedule("phrase_dropstretch1", itime, idur, random(0.5, 1.5), 1, 1, 0.5) if (random(0, 1) > 0.5) then - schedule("playdropstretch", itime + random(0, 5), idur, random(0.5, 1.5), 1, 1, 4) + schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 1, 1, 2) endif if (random(0, 1) > 0.5) then ; no reson - schedule("playdropstretch", itime + random(0, 5), idur, random(0.5, 1.5), 0, 1, 1) + schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 0, 1, 1) endif - if (random(0, 1) > 0.5) then - schedule("play_waterpaddling1", itime + random(0, 5), 1) + if (random(0, 1) > 0.2) then + schedule("play_waterpaddling1", itime + random(0, 5), random(0.5, 6)) + if (random(0, 1) > 0.6) then + schedule("play_waterpaddling1", itime + random(0, 5), random(0.5, 6)) + endif endif - - itime += idur * random(0.5, 0.8) + itime += idur * random(0.5, 1.2) od + transition_out("transition_idiophone_gliss1") endin instr sequencer_s9 + transition_in("transition_idiophone_stretch1") idiophone_change() - gimel_portamento_beatratio = 0.2 + gimel_portamento_beatratio = 0.4 imaxlen = p3 itime = 0 while (itime < imaxlen) do idur = random(5, 20) idur = (idur + itime > imaxlen) ? imaxlen - itime : idur - schedule("play_musicboxstretch3", itime, idur) + schedule("phrase_idiophone_stretch3", itime, idur) itime += idur od + transition_out("transition_idiophone_stretch1") endin instr sequencer_s10 + transition_in("transition_idiophone_randtime") gimel_portamento_beatratio = 0.4 - schedule("play_musicboxstretch4", 0, p3) - schedule("fms_playnote", 0, p3, 0) + schedule("phrase_idiophone_stretch4", 0, p3) + schedule("note_bass1", 0, p3, 0) kmetrofreq = abs:k(oscil:k(5, 0.01)) + 0.1 knotemetro = metro(kmetrofreq) if (knotemetro == 1) then if (random:k(0, 1) > 0.8) then kstart = random:k(0, 0.3) - schedulek("play_hybrid1", kstart, 1, mel_randomnote:k()) - ;schedulek("_note_musicbox1", kstart, 0.5, mel_randomnote:k()+12, random:k(2, 7)) - ;schedulek("play_drop1", kstart, 0.5) + schedulek("note_hybrid1", kstart, 1, mel_randomnote:k()) + ;schedulek("_note_idiophone1", kstart, 0.1, mel_randomnote:k()+12, random:k(2, 7)) + ;schedulek("note_drop1", kstart, 0.5) endif endif kdroprollmetro = metro(0.1) if (kdroprollmetro == 1 && random:k(0, 1) > 0.5) then schedulek("fnmi_sineblips", random:k(0, 2), random:k(3, 10), "reverb1") - schedulek("play_droproll1", random:k(0, 2), random:k(3, 10), 1) + schedulek("phrase_droproll1", random:k(0, 2), random:k(3, 10), 1) endif endin instr sequencer_s11 - + transition_in("transition_idiophone_gliss1") ; resonated droplets kmetrofreq = abs:k(oscil:k(3, 0.01)) + 0.1 knotemetro = metro(kmetrofreq) if (knotemetro == 1) then if (random:k(0, 1) > 0.5) then - schedulek("play_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()) + schedulek("note_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()) if (random:k(0, 1) > 0.5) then - schedulek("play_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()+12) + schedulek("note_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()+12) endif endif endif @@ -242,16 +286,16 @@ instr sequencer_s11 ; water droplets kdroprollmetro = metro(0.2) if (kdroprollmetro == 1 && random:k(0, 1) > 0.5) then - schedulek("play_droproll1", random:k(0, 2), random:k(3, 10), 0.2) + schedulek("phrase_droproll1", random:k(0, 2), random:k(3, 10), 0.2) endif ; subtle notes if (gkmel_section_change == 1) then - schedulek("note_musicboxstretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) - schedulek("note_musicboxstretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) + schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) + schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) if (random:k(0, 1) > 0.5) then - schedulek("note_musicboxstretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) - schedulek("note_musicboxstretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) + schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) + schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0) endif ; paddling stretch @@ -260,66 +304,65 @@ instr sequencer_s11 ; bass note if (random:k(0, 1) > 0.4) then klen = mel_length:k() - schedulek("fms_playnote2", random:k(0, 3), random:k(klen, klen*1.5), 0) + schedulek("note_bass2", random:k(0, 3), random:k(klen, klen*1.5), 0) endif endif endin - instr sequencer_s12 kmetrofreq = abs:k(oscil:k(3, 0.01)) + 0.1 knotemetro = metro(kmetrofreq) if (knotemetro == 1) then if (random:k(0, 1) > 0.5) then - schedulek("play_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()-12) + schedulek("note_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()-12) endif if (random:k(0, 1) > 0.5) then - schedulek("play_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()) + schedulek("note_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()) endif if (random:k(0, 1) > 0.5) then kstart = random:k(0.3, 1) - schedulek("play_hybrid1", kstart, 1, mel_randomnote:k()+24) + schedulek("note_hybrid1", kstart, 1, mel_randomnote:k()+24) if (random:k(0, 1) > 0.5) then - schedulek("play_drop1", kstart, 1) + schedulek("note_drop1", kstart, 1) endif endif if (random:k(0, 1) > 0.9) then - schedulek("playdropstretch", random:k(0, 3), random:k(4, 7), 2, round:k(random:k(0, 1)), 1, 2) - schedulek("fms_playnote2", random:k(0, 3), random:k(4, 5), 0) + schedulek("phrase_dropstretch1", random:k(0, 3), random:k(4, 7), 2, round:k(random:k(0, 1)), 1, 2) + schedulek("note_bass2", random:k(0, 3), random:k(4, 5), 0) endif endif - schedule("play_droproll1", 0, 1, 2.4) + schedule("phrase_droproll1", 0, 1, 2.4) endin instr sequencer_s13 + if (random(0, 1) >= 0.5) then + pause_melprogression() + endif idiophone_change() - iplaymusicbox = round(random(0, 1)) - kmetrofreq expseg 0.3, p3, 25 + iplayidiophone = round(random(0, 1)) + kmetrofreq expseg 0.3, p3, 20 knotemetro = metro(kmetrofreq) if (knotemetro == 1) then if (random:k(0, 1) > 0.5) then - schedulek("play_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()+12) - if (iplaymusicbox == 1 && active:k("note_musicboxstretch1") == 0) then - schedulek("note_musicboxstretch1", random:k(0, 2), random:k(1, 3), mel_randomnote:k()-12, 0) - if (random:k(0, 1) > 0.5) then - schedulek("note_musicboxstretch1", random:k(0, 2), random:k(2, 4), mel_randomnote:k()+12, 0) - endif + schedulek("note_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()+12) + if (iplayidiophone == 1 && active:k("note_idiophonestretch1") == 0) then + schedulek("note_idiophonestretch1", random:k(0, 2), random:k(1, 3), mel_randomnote:k()-12, 0) endif endif if (random:k(0, 1) > 0.5) then - schedulek("play_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()) + schedulek("note_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()) endif if (random:k(0, 1) > 0.5) then kstart = random:k(0.3, 1) - schedulek("play_hybrid1", kstart, 1, mel_randomnote:k()-12) + schedulek("note_hybrid1", kstart, 1, mel_randomnote:k()-12) if (random:k(0, 1) > 0.5) then - schedulek("play_drop1", kstart, 1) + schedulek("note_drop1", kstart, 1) endif endif endif - schedule("play_droproll1", 0, 1.3, 2.4) + schedule("phrase_droproll1", 0, 1.3, 2.4) endin @@ -331,9 +374,9 @@ instr sequencer_s14 while (itime < imaxlen) do idur = random(5, 20) idur = (idur + itime > imaxlen) ? imaxlen - itime : idur - schedule("play_hybridstretch1", itime, idur) + schedule("phrase_hybridstretch1", itime, idur) if (iplaydrops == 1) then - schedule("play_droproll1", itime, idur, 0.4) + schedule("phrase_droproll1", itime, idur, 0.4) endif itime += idur od @@ -341,30 +384,56 @@ instr sequencer_s14 ; play one music box glissando just before the next mel section change kglissset init 0 if (kglissset == 0 && gkmel_section_change == 1) then - schedulek("play_musicbox_gliss1", mel_length:k()-0.5, 1, 3) + schedulek("phrase_idiophone_gliss1", mel_length:k()-0.5, 1, 3) kglissset = 1 endif + + ; water transition out + transition_out("transition_droplets1") endin instr sequencer_s15 - - schedule("play_musicbox1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 0) - + transition_in("transition_idiophone_gliss1") idiophone_change() - if (gkmel_section_change == 1) then - klen = mel_length:k() - schedulek("play_musicbox1", 0, klen, 0) ; chords - schedulek("play_droproll1", 0, klen, 0.3) - endif + pause_melprogression() + ;schedule("phrase_idiophone1", 0, p3, 0) + schedule("phrase_hybrid2", 0, p3, 0) + transition_out("transition_waterbubbler1") endin instr sequencer_s16 - gimel_portamento_beatratio = 0.7 - schedule("play_waterpaddling1", 0, 1) - schedule("playdropstretch", 0, p3, 1, 1, 0, 1) + idiophone_change() + imaxlen = p3 + itime = 0 + while (itime < imaxlen) do + idur = random(5, 20) + idur = (idur + itime > imaxlen) ? imaxlen - itime : idur + schedule("phrase_hybrid1", itime, idur) + itime += idur + od + transition_out("transition_idiophone_gliss1") endin + +instr sequencer_s17 + pause_melprogression() + imaxlen = p3 + itime = 0 + while (itime < imaxlen) do + schedule("note_idiophone_randtime", itime+random(0, 1), random(2, 5)) + schedule("note_idiophone_randtime", itime+random(0, 4), random(2, 5)) + schedule("play_waterpaddling1", itime+random(0, 1), random(1, 2)) + itime += random(5, 20) + od + + schedule("phrase_dropstretch1", 0, p3, 1, 1, 1, 1) + schedule("phrase_dropstretch1", 0, p3, 2, 1, 1, 0.5) + transition_out("transition_droplets1") +endin + + + #end -- cgit v1.2.3