From cf7c081f02aa0a8982333f48969badee88cf87af Mon Sep 17 00:00:00 2001 From: Menno Knevel Date: Thu, 20 Jul 2023 15:07:09 +0200 Subject: [PATCH] Add files via upload --- dynamics/TiedNotesExpADSR.binstr | 853 +++++++++++++++++++++++++++++++ 1 file changed, 853 insertions(+) create mode 100644 dynamics/TiedNotesExpADSR.binstr diff --git a/dynamics/TiedNotesExpADSR.binstr b/dynamics/TiedNotesExpADSR.binstr new file mode 100644 index 0000000..cf90d83 --- /dev/null +++ b/dynamics/TiedNotesExpADSR.binstr @@ -0,0 +1,853 @@ + + expADSRModule + +DESCRIPTION: + +** 3 Control signals, 1 is optional** + +expADSR Module uses the xadsr opcode to produce the amplitude envelope. The release portion will be done inside the note duration. All 4 parameters A D S R are +relative to the duration of the note; the shorter the note, the shorter A D S R will be. And the opposite. +It may happen that a short note will not sound because it is just to short and it has never reached the long attack time over that note. + +In total, 3 enevelopes are happening: +1. amplitude = kampline +2. pitch = kpchline +3. cutoff frequency of a filter (optional) = kcutline + +note example: +instr start duration pitch ampl. filter cutoff freq. +i1.1 2 -1.8142857143 527 0.97 2659.0379061788 ; next 3 notes make their own cluster +i1.1 3 -0.5142857143 114 0.3 143.7976273858 ; consisting of 3 notes tied to each other +i1.1 4 1 306 0.6 14945.5509730192 ; this is the last note of the cluster +i1.2 6 2 306 0.5 4945.5509730192 ; standalone note, is its own fractional i1.2 stream + +Check the article https://github.com/kunstmusik/blue/wiki/a-Blue-Tie + + +CONTROLLERS: + +see the help balloon when hovering over the controllers in the instrument. Help can be turned off by pressing the 'I' button next to the play bar. + +--- + +version 1, July 2023 +- initial version + + + idur = abs(p3) ; be sure idur is always positive, but collect info on a negative duration or not +ipitch = p4 ; here in frequency +iamp = p5 ; range 0 - 1 +icutoff = p6 ; (optional) cutoff frequency of filter + +;================================tied note system=============================== + +itiestatus tieStatus +iskip tival +tigoto skipInit + +ioldpch init ipitch ; copy pitch +ioldamp init iamp ; copy amplitude +ioldfrq init ipitch ; copy freq for filter value + +skipInit: +inewpch = ipitch ; takes care of pitch jumps +kpchline transeg ioldpch, i(<TiedNotes_pitch>)*idur, -(i(<TiedNotes_pitchenvtype>)), inewpch, idur - i(<TiedNotes_pitch>)*idur, i(<TiedNotes_pitchenvtype>), inewpch + +inewamp = iamp ; takes care of amplitude jumps +kampline transeg ioldamp, i(<TiedNotes_amplitude>)*idur, -(i(<TiedNotes_ampenvtype>)), inewamp, idur - i(<TiedNotes_amplitude>)*idur, i(<TiedNotes_ampenvtype>), inewamp +ioldamp = inewamp + +inewfrq = icutoff ; takes care of cutoff frequency of filter jumps +kcutline transeg ioldfrq, i(<TiedNotes_filter>)*idur, -(i(<TiedNotes_filterenvtype>)), inewfrq, idur - i(<TiedNotes_filter>)*idur, i(<TiedNotes_filterenvtype>), inewfrq +ioldfrq = inewfrq + + +if (itiestatus == -1) then ; envelope for normal notes + aampdsr xadsr i(<expADSR_attack>)+0.00001, i(<expADSR_decay>)+0.00001, i(<expADSR_sustain>)+0.00001, i(<expADSR_release>)*2 +0.00001 + aampdsr -= 0.00001 ; be sure to get envelope to zero +elseif (itiestatus == 0) then ; envelope for first tied note + aampdsr expsega 0.00001, i(<expADSR_attack>)+0.00001, 1, i(<expADSR_decay>)+0.00001, 1 + aampdsr -= 0.00001 + prints "\n--> first tied note\n" +elseif (itiestatus == 1) then ; envelope for tied middle notes + aampdsr = 1+0.00001 + aampdsr -= 0.00001 + prints "\n--> tied middle note\n" +elseif (itiestatus == 2) then ; release for last tied note + aampdsr linseg 1, 1-i(<expADSR_release>), 1, idur * i(<expADSR_release>), 0.00001 + aampdsr -= 0.00001 + prints "\n--> last tied note\n" +endif + +if (<TiedNotes_sync> == 0) then +; ; no syncing +elseif (<TiedNotes_sync> == 1) then + <TiedNotes_amplitude> = <TiedNotes_pitch> ; sync amp time with pitch time + <TiedNotes_ampenvtype> = <TiedNotes_pitchenvtype> ; and pitch envelope type +elseif (<TiedNotes_sync> == 2) then + <TiedNotes_amplitude> = <TiedNotes_pitch> ; sync amp time with pitch time + <TiedNotes_filter> = <TiedNotes_pitch> ; sync filter time with pitch time + <TiedNotes_ampenvtype> = <TiedNotes_pitchenvtype> ; and pitch envelope type + <TiedNotes_filterenvtype> = <TiedNotes_pitchenvtype> +endif + + +ain vco2 kampline*2, kpchline, iskip ; example of oscillator + +asig moogladder2 ain, kcutline, .5, iskip ; example of filter + + +;==================outs======================================= +blueMixerOut asig * aampdsr, asig * aampdsr + + + + 10 + 10 + DOT + true + + + + 0 + 0 + Group + 0x00000033 + 0x000000ff + 0xffffffff + true + 20 + 20 + + Roboto + 12.0 + + + + + 0 + 0 + 4 envelopes for amplitude + tied notes + 0x282828ff + 0x000000ff + 0xffffffff + true + 160 + 117 + + Roboto + 12.0 + + + + + 10 + 10 + 4 envelopes for amplitude + note + 0x282828ff + 0x000000ff + 0xffffffff + true + 152 + 99 + + Roboto + 12.0 + + + + + 120 + 60 + + + Roboto + 12.0 + + + + + TiedNotes_amplitude + 10 + 90 + true + 1.0E-5 + 1.0 + 0.6999086578265624 + 50 + true + false + + true + + Roboto + 12.0 + + + + + + 70 + 140 + + + Roboto + 12.0 + + + + + TiedNotes_ampenvtype + 80 + 90 + true + -2.0 + 2.0 + -2.0 + 50 + true + false + + true + + Roboto + 12.0 + + + + + + 70 + 60 + + + Roboto + 12.0 + + + + + TiedNotes_pitch + 10 + 10 + true + 0.001 + 1.0 + 0.6286674658200878 + 50 + true + false + + true + + Roboto + 12.0 + + + + + + 120 + 140 + + + Roboto + 12.0 + + + + + TiedNotes_pitchenvtype + 80 + 10 + true + -2.0 + 2.0 + -0.7423351785022367 + 50 + true + false + + true + + Roboto + 12.0 + + + + + + + 10 + 200 + 4 envelopes for amplitude + filter + 0x282828ff + 0x000000ff + 0xffffffff + true + 152 + 85 + + Roboto + 12.0 + + + + TiedNotes_filterenvtype + 80 + 10 + true + -2.0 + 2.0 + -1.3897256712496135 + 50 + true + false + + true + + Roboto + 12.0 + + + + + + 70 + 60 + + + Roboto + 12.0 + + + + + TiedNotes_filter + 10 + 10 + true + 1.0E-5 + 1.0 + 0.5653974032636714 + 50 + true + false + + true + + Roboto + 12.0 + + + + + + 120 + 60 + + + Roboto + 12.0 + + + + + + + 10 + 320 + + + Roboto + 12.0 + + + + + + 120 + 320 + + + Roboto + 12.0 + + + + + TiedNotes_sync + 20 + 305 + true + 0.0 + 2.0 + 1 + 0.0 + 130 + true + false + + + + 75 + 320 + + + Roboto + 12.0 + + + + + + + 410 + 0 + Score Module - use this to add extra P-fields in Score and instrumentcode + Score Module + 0x66666600 + 0x000000ff + 0xff0000ff + false + 137 + 20 + + Roboto + 12.0 + + + + + 6 + 263 + + + Roboto + 14.0 + + + + + + 12 + 10 + + + Roboto + 14.0 + + + + + + 14 + 97 + + + Roboto + 14.0 + + + + + + 28 + 197 + + 100 + + + + 28 + 71 + cutoff filter + 100 + + + + 14 + 117 + + + Roboto + 14.0 + + + + + + 28 + 219 + + 100 + + + + 28 + 260 + + 100 + + + + 36 + 34 + + + Roboto + 12.0 + + + + + + 28 + 113 + + 100 + + + + 6 + 179 + + + Roboto + 14.0 + + + + + + 28 + 93 + + 100 + + + + 6 + 159 + + + Roboto + 14.0 + + + + + + 14 + 53 + + + Roboto + 14.0 + + + + + + 6 + 199 + + + Roboto + 14.0 + + + + + + 6 + 222 + + + Roboto + 14.0 + + + + + + 14 + 138 + + + Roboto + 14.0 + + + + + + 28 + 156 + + 100 + + + + 14 + 34 + + + Roboto + 14.0 + + + + + + 36 + 53 + + + Roboto + 12.0 + + + + + + 28 + 134 + + 100 + + + + 6 + 243 + + + Roboto + 14.0 + + + + + + 28 + 239 + + 100 + + + + 14 + 74 + + + Roboto + 14.0 + + + + + + 28 + 178 + + 100 + + + + + 180 + 0 + 4 envelopes for amplitude + expADSR + 0x282828ff + 0x000000ff + 0xffffffff + true + 20 + 99 + + Roboto + 12.0 + + + + expADSR_attack + 10 + 5 + true + 0.0 + 1.0 + 0.001 + 0.155 + 150 + true + false + + + + 180 + 145 + + + Roboto + 12.0 + + + + + expADSR_release + 160 + 5 + true + 0.0 + 1.0 + 0.001 + 0.419 + 150 + true + false + + + expADSR_sustain + 110 + 5 + true + 0.0 + 1.0 + 0.001 + 0.271 + 150 + true + false + + + + 80 + 145 + + + Roboto + 12.0 + + + + + + 30 + 145 + + + Roboto + 12.0 + + + + + expADSR_decay + 60 + 5 + true + 0.0 + 1.0 + 0.001 + 0.659 + 150 + true + false + + + + 130 + 145 + + + Roboto + 12.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tieStatus + i + 0 + itie tival +if (itie == 0 && p3 < 0) ithen ; this is an initial note within a group of tied notes + itiestatus = 0 +elseif (p3 < 0 && itie == 1) ithen ; this is a middle note within a group of tied notes + itiestatus = 1 +elseif (p3 > 0 && itie == 1) ithen ; this is an end note out of a group of tied notes + itiestatus = 2 +elseif (p3 > 0 && itie == 0) ithen ; this note is a standalone note + itiestatus = -1 +endif + xout itiestatus + + + + + \ No newline at end of file