' ******************************************************* ' * namuda_hybr * ' * namuda studies for the hybr robot * ' ******************************************************* ' This is suitable demo code for interactive demonstrations of Hybr. ' other robots used here are: Balmec and Temblo. These are not really required. ' the displays are usefull as communications tools for the dancers. ' 17.12.2014: Demo performed with RoboHybr (gwr) ' 27.12.2014: Bom-Open composition adapted for use with Hybr ' 01.01.2015: Speedup property mapping adapted from Links, added ' 08.01.2015: debug session ' 10.01.2015: coding and testing ' displays added in open and theacol ' 11.01.2015: rehearsal session with Dominica Eyckmans. ' 07.02.2015: Procedures added for the seduction concert, 17.02.2015 ' 08.02.2015: Rehearsal session with Dominica Eyckmans ' Occurences of Hybr.hightes changed to constant 72, as we will implement HybrHi as the same ' instrument as Hybr. ' Code reorganized after rehearsal. Some bugs removed (Rodo-Hybr duett). To be checked again now. ' 15.05.2016: Second performance rehearsal with Dominica Eyckmans ' 13.09.2016: Extented with HybrLo ' 14.09.2016: specific proc. added for HybrLo ' 14.10.2016: HybrLo fully finished now... %RoboHybr = 48 %Hybr_Open = 49 %Hybr_Speedup = 50 %Hybr_Slowdown = 51 %Hybr_Clusters = 52 %Hybr_Triads = 53 %Hybr_Deriv_5 = 54 %Hybr_Collision = 55 %Hybr_Theacol = 56 %Balmec_P1 = 58 ' propeller - interaktief %Balmec_man = 59 ' manual propeller control %Hybr_Deriv_Em = 62 %Hybr_Slowdown_gw = 63 ' utilities for finding good parameter values, ' once found the data should be added to the task initialisation coding (start cptr) %Hybr_Adsr = 18 '32 %Hybr_f1f2 = 19 '33 ' crashes the ARM's (f1's) %Hybr_ctrl = 20 '34 ' for Seduction: %Seduc_1 = 36'32 'in order of performance %Seduc_2 = 32'33 %Seduc_3 = 35'34 %Seduc_4 = 33'35 %Seduc_5 = 34'36 %HybrLo_0 = 38 ' 17.10.2016 intro %HybrLo_6 = 39 ' 14.09.2016 for hybrLo DECLARE SUB Hybr_adsr () DECLARE SUB Hybr_f1f2 () DECLARE SUB Hybr_ctrl () DECLARE FUNCTION Init_RoboHybr () AS LONG FUNCTION Init_RoboHybr AS LONG ClearTasks Task(%Hybr_Adsr).naam = "Adsr" Task(%Hybr_Adsr).cptr = CODEPTR(Hybr_Adsr) Task(%Hybr_Adsr).freq = 5 Task(%Hybr_Adsr).flags = %False Task(%Hybr_f1f2).naam = "f1f2" Task(%Hybr_f1f2).cptr = CODEPTR(Hybr_f1f2) Task(%Hybr_f1f2).freq = 5 Task(%Hybr_f1f2).flags = %False Task(%Hybr_ctrl).naam = "ctrl" Task(%Hybr_ctrl).cptr = CODEPTR(Hybr_ctrl) Task(%Hybr_ctrl).freq = 10 Task(%Hybr_ctrl).flags = %False '---------------------------------------------------------------------------------- Task(%RoboHybr).naam = "Hybr" 'for the serial music production Task(%RoboHybr).cptr = CODEPTR(Robo_Hybr) Task(%RoboHybr).freq = 8 Task(%RoboHybr).flags = %False TaskEX(%RoboHybr).startcptr = CODEPTR(MM_Hybr_1_On) ' controllers TaskEX(%RoboHybr).stopcptr = CODEPTR(MM_Hybr_Off) Task(%Hybr_Open).naam = "Open" Task(%Hybr_Open).cptr = CODEPTR(Hybr_Open) Task(%Hybr_Open).freq = 50 Task(%Hybr_Open).flags = %False TaskEX(%Hybr_Open).startcptr = CODEPTR(Hybr_Open_On) TaskEX(%Hybr_Open).stopcptr = CODEPTR(Hybr_Open_Off) Task(%Hybr_Speedup).naam = "SpeedUp" Task(%Hybr_Speedup).cptr = CODEPTR(Hybr_Speedup) Task(%Hybr_Speedup).freq = 132 Task(%Hybr_Speedup).flags = %False TaskEX(%Hybr_Speedup).startcptr = CODEPTR(Hybr_Speedup_On) TaskEX(%Hybr_Speedup).stopcptr = CODEPTR(MM_Hybr_Off) Task(%Hybr_Slowdown).naam = "Slowing" Task(%Hybr_Slowdown).cptr = CODEPTR(Hybr_Slowdown) Task(%Hybr_Slowdown).freq = 130 Task(%Hybr_Slowdown).flags = %False TaskEX(%Hybr_Slowdown).startcptr = CODEPTR(Hybr_Slowdown_On) TaskEX(%Hybr_Slowdown).stopcptr = CODEPTR(MM_Hybr_Off) Task(%Hybr_Clusters).naam = "Clusters" Task(%Hybr_Clusters).cptr = CODEPTR(Hybr_Clusters) Task(%Hybr_Clusters).freq = 100 Task(%Hybr_Clusters).flags = %False TaskEX(%Hybr_Clusters).startcptr = CODEPTR(Hybr_Clusters_On) TaskEX(%Hybr_Clusters).stopcptr = CODEPTR(MM_Hybr_Off) Task(%Hybr_triads).naam = "Edg_Tri" Task(%Hybr_triads).cptr = CODEPTR(Hybr_Triads) Task(%Hybr_triads).freq = 8 Task(%Hybr_triads).flags = %False TaskEX(%Hybr_triads).startcptr = CODEPTR(Hybr_Triads_On) TaskEX(%Hybr_triads).stopcptr = CODEPTR(Hybr_Triads_Off) Task(%Hybr_deriv_5).naam = "Derivs" ' derivatives of surface Task(%Hybr_deriv_5).cptr = CODEPTR(Hybr_Deriv_5) Task(%Hybr_deriv_5).freq = 64 Task(%Hybr_deriv_5).flags = %False TaskEX(%Hybr_deriv_5).startcptr = CODEPTR(Hybr_Deriv_5_On) TaskEX(%Hybr_deriv_5).stopcptr = CODEPTR(MM_Hybr_Off) Task(%Hybr_Collision).naam = "Collis" Task(%Hybr_Collision).cptr = CODEPTR(Hybr_Collision) Task(%Hybr_Collision).freq = 12 Task(%Hybr_Collision).flags = %False TaskEX(%Hybr_Collision).startcptr = CODEPTR(Hybr_Collision_On) TaskEX(%Hybr_Collision).stopcptr = CODEPTR(Hybr_Collision_Off) Task(%Hybr_Theacol).naam = "Theacol" Task(%Hybr_Theacol).cptr = CODEPTR(Hybr_Theacol) Task(%Hybr_Theacol).freq = 100 Task(%Hybr_Theacol).flags = %PERTIM_TASK TaskEX(%Hybr_Theacol).startcptr = CODEPTR(Hybr_Theacol_On) TaskEX(%Hybr_Theacol).stopcptr = CODEPTR(Hybr_Theacol_Off) Task(%Balmec_P1).naam = "Propell" Task(%Balmec_p1).cptr = CODEPTR(Balmec_P1) Task(%Balmec_P1).freq = 100 Task(%Balmec_P1).flags = %False TaskEX(%Balmec_P1).startcptr = CODEPTR(Balmec_P1_On) TaskEX(%Balmec_P1).stopcptr = CODEPTR(Balmec_P1_Off) Task(%Balmec_man).naam = "PropMan" Task(%Balmec_man).cptr = CODEPTR(Balmec_Man) Task(%Balmec_man).freq = 10 Task(%Balmec_man).flags = %False TaskEX(%Balmec_man).startcptr = CODEPTR(Balmec_P1_On) TaskEX(%Balmec_man).stopcptr = CODEPTR(Balmec_P1_Off) Task(%Hybr_deriv_Em).naam = "Deri_Em" ' derivatives of surface Task(%Hybr_deriv_Em).cptr = CODEPTR(Hybr_Deriv_Em) ' copy with different slider settings Task(%Hybr_deriv_Em).freq = 64 Task(%Hybr_deriv_Em).flags = %False TaskEX(%Hybr_deriv_Em).startcptr = CODEPTR(Hybr_Deriv_5_On) TaskEX(%Hybr_deriv_Em).stopcptr = CODEPTR(MM_Hybr_Off) Task(%Hybr_Slowdown_gw).naam = "Slow_gw" Task(%Hybr_Slowdown_gw).cptr = CODEPTR(Hybr_Slowdown_gw) Task(%Hybr_Slowdown_gw).freq = 150 Task(%Hybr_Slowdown_gw).flags = %False TaskEX(%Hybr_Slowdown_gw).startcptr = CODEPTR(Hybr_Slowdown_GW_On) TaskEX(%Hybr_Slowdown_gw).stopcptr = CODEPTR(MM_Hybr_Off) ' for seduction: ------------------------------------------------------------------------------------- Task(%Seduc_1).naam = "Sedu_1" Task(%Seduc_1).cptr = CODEPTR(Seduc_1) Task(%Seduc_1).freq = 256 Task(%Seduc_1).flags = %False TaskEX(%Seduc_1).stopCptr = CODEPTR(Seduc_1_stop) Task(%Seduc_2).naam = "Sedu_2" Task(%Seduc_2).cptr = CODEPTR(Seduc_2) Task(%Seduc_2).freq = 256 Task(%Seduc_2).flags = %False TaskEX(%Seduc_2).stopcptr = CODEPTR(Seduc_2_stop) Task(%Seduc_3).naam = "Sedu_3" ' rodo Task(%Seduc_3).cptr = CODEPTR(Seduc_3) Task(%Seduc_3).freq = 1 Task(%Seduc_3).flags = %False Taskex(%Seduc_3).stopcptr = CODEPTR(Seduc_3_Stop) Task(%Seduc_4).naam = "Sedu_4" ' ds3 third derivative of surface Task(%Seduc_4).cptr = CODEPTR(Seduc_4) ' test kode on Puff en Tubi Task(%Seduc_4).freq = 100 Task(%Seduc_4).flags = %False Task(%Seduc_5).naam = "Sedu_5" Task(%Seduc_5).cptr = CODEPTR(Seduc_5) Task(%Seduc_5).freq = 64 Task(%Seduc_5).flags = %False TaskEX(%Seduc_5).stopcptr = CODEPTR(Seduc_5_Stop) Task(%HybrLo_6).naam = "HybrLo6" Task(%HybrLo_6).cptr = CODEPTR(HybrLo_6) Task(%HybrLo_6).freq = 64 Task(%HybrLo_6).flags = %False TaskEX(%HybrLo_6).stopcptr = CODEPTR(HybrLo_6_Stop) Task(%HybrLo_0).naam = "HybrLo0" ' 17.10.2016 Task(%HybrLo_0).cptr = CODEPTR(HybrLo_0) Task(%HybrLo_0).freq = 24 Task(%HybrLo_0).flags = %False TaskEX(%HybrLo_0).stopcptr = CODEPTR(HybrLo_0_Stop) ' ------------------------------------------------------ Controller Hybr.channel, 66, 127 Controller HybrLo.channel , 66, 127 MM_Hybr_On %MM_WHITE MM_HybrLo_On %MM_White Controller Hybr.channel, 66, 127 ProgChange mDisp_A.channel, 0 ProgChange mDisp_B.channel,0 mPlay mDisp_A.channel, 1, 16 mPlay mDisp_A.channel, 2, 16 mPlay mDisp_A.channel, 3, 16 mPlay mDisp_A.channel, 4, 16 Controller mDisp_A.channel, 123, 0 Controller mDisp_B.channel, 123, 0 END FUNCTION SUB Robo_Hybr () 'we define a series for the notes and let the permutations depend on gesture 'first version 04.09.2010 - RoboBomi 'code re-used in Namuda Study #32 'adapted for use with Hybr, 12.2014 '17.12.2014: first testing. '10.01.2015: works o.k. STATIC cnt, i, ix, iy, iz, it, okt AS LONG STATIC xtrig, ytrig, ztrig, xnoot, ynoot,znoot AS LONG STATIC divx, divy,divz AS LONG 'for scaling autoregulation STATIC sens AS SINGLE LOCAL klep, lowest, transposition, interval AS LONG IF ISFALSE Task(%RoboHybr).tog THEN DIM Ser_norm(11) AS STATIC INTEGER DIM Ser_krebs(11) AS STATIC INTEGER DIM Ser_inv(11) AS STATIC INTEGER DIM ser_invkrebs(11) AS STATIC INTEGER 'basisreeks: (origineel voor Bomi) Ser_Norm(0) = 55 : Ser_Norm(1) = 61 : Ser_Norm(2) = 65 : Ser_Norm(3) = 64 Ser_Norm(4) = 59 : Ser_Norm(5) = 62 : Ser_Norm(6) = 56 : Ser_Norm(7) = 57 Ser_Norm(8) = 66 : Ser_Norm(9) = 63 : Ser_Norm(10) = 58 : Ser_Norm(11) = 60 ' transpositie voor : FOR i = 0 TO 11 Ser_Norm(i) -= 22 NEXT i 'afgeleide reeksen: FOR i = 0 TO 11 Ser_Krebs(i) = Ser_Norm(11-i) 'kreeft NEXT i 'inversion: Ser_inv(0) = Ser_Norm(0) FOR i = 1 TO 11 interval = Ser_Norm(i-1) - Ser_Norm(i) 'stijgend: negatief, dalend = positief Ser_inv(i) = Ser_inv(i-1) + interval NEXT i 'find now the lowest note in the inversion: lowest = 1000 FOR i = 0 TO 11 IF Ser_inv(i) < lowest THEN lowest = Ser_inv(i) NEXT i IF lowest < Hybr.lowtes THEN transposition = Hybr.lowtes - lowest END IF FOR i = 0 TO 11 Ser_inv(i) = Ser_inv(i) + transposition 'transpose the inversion NEXT i 'kreeft van de omkering: FOR i = 0 TO 11 Ser_Invkrebs(i) = Ser_inv(11-i) 'get the krebs NEXT i 'to do: add durational series and use PlayDur ' notes squared gives: 3025 to 4356 - no good ' sqr gives: 7.416 to 8.124 ' ^4 gives: 9150625 to 18974736, or about an octave sens = 18 'in Hz units RESET ix, iy, iz, it divx = 12 divy = 12 divz = 12 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%RoboHybr).tog = %True ' for i = 0 to 11 ' logfile "Norm=" & STR$(Ser_Norm(i)) & " Kr= " & STR$(Ser_Krebs(i)) & " Inv="& STR$(Ser_Inv(i)) & " InKr=" & STR$(Ser_InvKrebs(i)) ' next i EXIT SUB END IF ' on accelerating body speed, do something... ' X-vektor: ' frequency is unipolar data, not normalized IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF ISFALSE xtrig THEN 'note off: IF xnoot THEN NoteOff Hybr.channel, xnoot delNote2Har Task(%RoboHybr).Har, xnoot ' added 09.03.2013 RESET xnoot INCR ix ix = ix MOD 12 END IF xnoot = Ser_Norm(ix) + (((gesture.speedup(0) - sens)\divx) * 12) 'range to be checked!!! IF xnoot > 72 THEN 'Hybr.hightes THEN 'autoregulator for scaling: DO INCR divx 'divx = divx + 12 xnoot = Ser_Norm(ix) + (((gesture.speedup(0) - sens)\divx) * 12) 'logfile "divx= " & STR$(divx) divx gets up to 36 (shadow by aeio in the setup) LOOP UNTIL xnoot <= 72 ' Hybr.hightes END IF mPlay Hybr.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) addNote2Har Task(%RoboHybr).Har, xnoot, MIN(gesture.speedup_val(0) * 2, 127) ' 09.03.2013 xtrig = %True END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN mPlay Hybr.channel, xnoot, %False delNote2Har Task(%RoboHybr).Har, xnoot ' added 09.03.2013 RESET xnoot INCR ix ix = ix MOD 12 END IF END IF END IF IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN ' ynoot = MIN(34 - sens + (gesture.speedup(1)* 1.5), Autosax.Hightes) ' mPlay Autosax.channel,ynoot , MIN(gesture.speedup_val(1) * 2, 127) IF ynoot THEN NoteOff Hybr.channel, ynoot delNote2Har Task(%RoboHybr).Har, ynoot ' added 09.03.2013 RESET ynoot INCR iy iy = iy MOD 12 END IF ynoot = Ser_Krebs(iy) + (((gesture.speedup(1) - sens)\divy) * 12) 'range to be checked!!! IF ynoot > 72 THEN 'Hybr.hightes THEN DO INCR divy 'autoregulation ynoot = Ser_Krebs(iy) + (((gesture.speedup(1) - sens)\divy) * 12) 'logfile "divy= " & STR$(divy) divy gets as high as 46 LOOP UNTIL ynoot <= 72 'Hybr.hightes END IF mPlay Hybr.channel, ynoot, MIN(Gesture.speedup_val(1) * 2, 127) addNote2Har Task(%RoboHybr).Har, ynoot, MIN(gesture.speedup_val(1) * 2, 127) ' 09.03.2013 ytrig = %true END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN mPlay Hybr.channel, ynoot, %False delNote2Har Task(%RoboHybr).Har, ynoot ' added 09.03.2013 RESET ynoot INCR iy iy = iy MOD 12 END IF END IF RESET ytrig END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN IF ISFALSE ztrig THEN IF znoot THEN NoteOff Hybr.channel, znoot delNote2Har Task(%RoboHybr).Har, znoot ' added 09.03.2013 RESET znoot INCR iz iz = iz MOD 12 END IF znoot = Ser_Inv(iz) + (((gesture.speedup(2) - sens)\divz) * 12) 'range to be checked!!! IF znoot > 72 THEN 'Hybr.hightes THEN DO INCR divz znoot = Ser_Inv(iz) + (((gesture.speedup(2) - sens)\divz) * 12) 'logfile "divz= " & STR$(divz) divz gets as high as 43 LOOP UNTIL znoot <= 72 'Hybr.hightes END IF mPlay Hybr.channel, znoot, MIN(gesture.speedup_val(2) * 3, 127) addNote2Har Task(%RoboHybr).Har, znoot, MIN(gesture.speedup_val(2) * 3, 127) ' 09.03.2013 ztrig = %True END IF ELSE IF znoot THEN IF ISFALSE gesture.speedup_dur(2) THEN mPlay Hybr.channel, znoot, %False delNote2Har Task(%RoboHybr).Har, znoot ' added 09.03.2013 RESET znoot INCR iz iz = iz MOD 12 END IF END IF RESET ztrig END IF 'controllers sturing: (to be done...) ' should have edgy on vibrato ' collision of fast tremolo IF Gesture.speedup(3) > sens THEN Controller Hybr.channel, 3,MIN(gesture.speedup_val(3) * 3, 127) ' modulatiediepte Hybr.ctrl(3) =MIN(gesture.speedup_val(3) * 3, 127) IF gesture.speedup(3) > (gesture.slowdown(3) + sens) THEN klep = MIN(gesture.speedup_val(3) * 3, 127) '0-127 klep = 127 - klep '127 - 0 IF klep <> Hybr.ctrl(4) THEN Controller Hybr.channel, 4, klep Hybr.ctrl(4) = klep END IF ELSE IF Hybr.ctrl(4) <> 0 THEN Controller Hybr.channel, 4, %False RESET Hybr.ctrl(4) END IF END IF ELSE IF Hybr.ctrl(3) <> 0 THEN Controller Hybr.channel, 3, 0 Hybr.ctrl(3) = %False END IF END IF 'reeksmatige sturing van het tempo: IF Gesture.slowdown(3) > sens THEN Task(%RoboHybr).freq = Ser_InvKrebs(it) * 0.1333 'take it as MM tempo 8/60 = 0.133 INCR it it = it MOD 12 END IF END SUB SUB MM_Hybr_1_On () ' sends the controllers required: Controller Hybr.channel, 66, 127 MM_Hybr_On %MM_Lights IF Hybr.ctrl(7) <> 120 THEN Controller Hybr.channel, 7, 120 ' volume Hybr.ctrl(7) = 120 END IF IF Hybr.ctrl(1) <> 4 THEN Controller Hybr.channel, 1, 4 ' wind Hybr.ctrl(1) = 4 END IF IF hybr.ctrl(3) THEN Controller Hybr.channel, 3, 0 Hybr.ctrl(3) = 0 END IF IF hybr.ctrl(4) THEN Controller Hybr.channel, 4, 0 Hybr.ctrl(4) = 0 END IF IF hybr.ctrl(5) THEN Controller Hybr.channel, 5, 0 Hybr.ctrl(5) = 0 END IF IF hybr.ctrl(6) THEN Controller Hybr.channel, 6, 0 Hybr.ctrl(6) = 0 END IF IF hybr.ctrl(16) <> 2 THEN Controller Hybr.channel, 16, 2 ' attack Hybr.ctrl(16) = 2 END IF IF hybr.ctrl(17) <> 80 THEN Controller Hybr.channel, 17, 80 Hybr.ctrl(17) = 80 END IF IF hybr.ctrl(18) <> 1 THEN Controller Hybr.channel, 18, 1 ' decay Hybr.ctrl(18) = 1 END IF IF hybr.ctrl(19) <> 4 THEN Controller Hybr.channel, 19, 4 ' release Hybr.ctrl(19) = 4 END IF IF Hybr.ctrl(20) <> 64 THEN Controller Hybr.channel, 20, 64 ' tuning to 440Hz Hybr.ctrl(20) = 64 END IF ' Controller Hybr.channel, 120, 0 ' input volume 0 ' is this 120 or rather 67? END SUB SUB Hybr_Open () 'derived from in 'A book of moves' '27.12.2014: a recoding for Hybr. We didn't implement this code on any ' earlier robot, as only Hybr is capable of dealing with the wide dynamic range ' required here. ' Recoding using the gesture.freeze property. '31.12.2014: Tested: never stops... '10.01.2015: we do not seem to get it to work again... ' works a bit. Further improvement needed. '12.01.2015: First rehearsal with Emilie De Vlam ' effort slider added. STATIC cnt , n, k , velo, effort AS INTEGER ' STATIC Jumpval AS BYTE STATIC t, noise, duur, m, lites, slnr AS LONG IF ISFALSE Task(%Hybr_Open).tog THEN IF ISFALSE Task(%Hybr_Open).hParam THEN DIM TaskParamLabels(0) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "effort" MakeTaskParameterDialog %Hybr_Open,1,Slider(),0,UDctrl(),TaskParamLabels() ' 1 slider END IF IF ISFALSE slnr THEN slnr = TaskEX(%Hybr_Open).SliderNumbers(0) Slider(slnr).value = 126 effort = 126 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value END IF Task(%Hybr_Open).tog = %True Task(%Hybr_Open).channel = Hybr.channel DIM Notes(15) AS STATIC BYTE ' set 1 notes(0) =40 notes(1) =47 notes(2) =50 notes(3) = 55 notes(4) = 62 notes(5) = 66 notes(6) = 37 ' was 73 in Bom notes(7) = 33 ' was 81 in Bom ' set 2 notes(8) = 44 ' was 32 in Bom notes(9) = 36 ' was 24 in Bom notes(10) = 40 notes(11) = 47 notes(12) = 52 notes(13) = 55 notes(14) = 67 notes(15) = 65 ' was 89 in Bom velo = 127 RESET cnt, n, k, m noise = 1 ' to be tested. Value changed 01.01.2015 App.tempo = 120 '100 t = timegettime / 1000 ' starttijd ProgChange mDisp_A.channel, 0 ProgChange mDisp_B.channel,0 mPlay mDisp_A.channel, 1, 16 mPlay mDisp_A.channel, 2, 16 mPlay mDisp_A.channel, 3, 16 mPlay mDisp_A.channel, 4, 16 mPlay mDisp_B.channel, 1, 16 mPlay mDisp_B.channel, 2, 16 mPlay mDisp_B.channel, 3, 16 mPlay mDisp_B.channel, 4, 16 ProgChange mDisp_A.channel,4 ' stopwatch mode ProgChange mDisp_B.channel,4 MM_AllLightsOn %MM_Red lites = 0 Task(%Hybr_Open).freq = App.tempo / 60! END IF duur = (TimegetTime / 1000) - t ' in seconds IF duur < 60 THEN IF ISFALSE duur MOD 2 THEN IF duur < 16 THEN FOR k = 0 TO duur '7 AddNote2Har Hybr.har(1), Notes(k), velo NEXT k ELSE FOR k = 0 TO 7 AddNote2Har Hybr.har(1),Notes(k), velo NEXT k FOR k = 7 TO 8 + (duur MOD 8) AddNote2Har Hybr.har(1),Notes(RND (7,15)), velo NEXT k END IF InstrumPlay Hybr n = %True ELSE InstrumPlay Hybr RESET n END IF EXIT SUB END IF ' na de eerste minuut: IF ISFALSE lites THEN MM_AllLightsOff %MM_Red lites = 1 END IF IF ISFALSE n THEN IF Gesture.flue_val(3) * 127 <= noise THEN ' geen beweging... het akkoord wordt gespeeld FOR k = 0 TO 15 '7 AddNote2Har Hybr.har(1), Notes(k), velo NEXT k InstrumPlay Hybr n = %True 'SELECT CASE cnt ' CASE < 7 ' Task(%Hybr_Open).freq = (App.tempo/0.4)/ 60 ' CASE ELSE ' Task(%Hybr_Open).freq = (App.tempo*2) / 60 'END SELECT IF lites <> 2 THEN MM_AllLightsOn %MM_White lites = 2 END IF EXIT SUB END IF ELSE Instrumplay Hybr ' notes off RESET n IF lites <> 3 THEN MM_AllLightsOff %MM_White lites = 3 END IF END IF effort = Slider(slnr).value IF gesture.flue_val(3) * 127 > noise THEN ' bij beweging wordt het akkoord uitgeschakeld Instrumplay Hybr ' notes off RESET n INCR cnt ' elke beweging incrementeerd de teller velo = velo - 2 ' diminuendo INCR noise ' make it harder, increase effort noise = MIN(noise, effort) ' but do not make it impossible... - value to be checked again. ' so, if the performer does not succeed to silence hybr, the slider can be moved down IF lites <> 3 THEN MM_AllLightsOff %MM_White lites = 3 END IF IF velo <= 0 THEN velo = 0 Controller mDisp_A.channel, 28, 1 ' stop stopwatch Controller mDisp_B.channel, 28, 1 'ProgChange mDisp_A.channel, 0 'ProgChange mDisp_B.channel, 0 StopTask %Hybr_Open EXIT SUB END IF END IF END SUB SUB Hybr_Open_On () ' sends the controllers required: Controller Hybr.channel, 66, 127 MM_Hybr_On %MM_Lights IF Hybr.ctrl(7) <> 127 THEN Controller Hybr.channel, 7, 127 ' volume Hybr.ctrl(7) = 127 END IF Controller Hybr.channel, 1, 0 ' wind Controller Hybr.channel, 3, 0 ' fm depth Controller Hybr.channel, 4, 0 ' fm freq RESET Hybr.ctrl(1), Hybr.ctrl(3), Hybr.ctrl(4) IF Hybr.ctrl(5) <> 50 THEN Controller Hybr.channel, 5, 50 ' AM depth Hybr.ctrl(5) = 50 END IF IF Hybr.ctrl(6) <> 20 THEN Controller Hybr.channel, 6, 20 ' AM freq Hybr.ctrl(6) = 20 END IF IF Hybr.ctrl(16) <> 2 THEN Controller Hybr.channel, 16, 2 ' attack Hybr.ctrl(16) = 2 END IF IF Hybr.ctrl(17) <> 22 THEN Controller Hybr.channel, 17, 22 ' hold Hybr.ctrl(17) = 22 END IF IF Hybr.ctrl(18) <> 8 THEN Controller Hybr.channel, 18, 8 ' decay Hybr.ctrl(18) = 8 '10 END IF IF Hybr.ctrl(19) <> 75 THEN Controller Hybr.channel, 19, 75 ' release Hybr.ctrl(19) = 75 '30 END IF IF Hybr.ctrl(20) <> 64 THEN Controller Hybr.channel, 20, 64 ' tuning to 440Hz Hybr.ctrl(20) = 64 END IF END SUB SUB Hybr_Open_Off () MM_Hybr_Off Controller mDisp_A.channel, 66 , 0 Controller mDisp_B.channel, 66, 0 Controller MDisp_A.channel, 123, 0 Controller mDisp_B.channel, 123, 0 ' blank displays ProgChange mDisp_A.channel, 0 ProgChange mDisp_B.channel, 0 mPlay mDisp_A.channel, 1, 16 mPlay mDisp_A.channel, 2, 16 mPlay mDisp_A.channel, 3, 16 mPlay mDisp_A.channel, 4, 16 mPlay mDisp_B.channel, 1, 16 mPlay mDisp_B.channel, 2, 16 mPlay mDisp_B.channel, 3, 16 mPlay mDisp_B.channel, 4, 16 END SUB SUB Hybr_SpeedUp () ' here we look only into the frequency data in order to detect accelerating gesture ' this is an experiment only sofar... ' this code works but not too well. The mapping on Llor was not very good neither. (way too loud) ' code adapted to fourstep recognition 06.04.2010 ' retested, with better ambitus mapping ' rescaling done 09.04.2010 ' 13.04.2010 works very well now with algo 1, but scaling should be enlarged. ' 15.04.2010: fine tuning. ' derived from Links. ' 08.01.2015: Sticky notes for some reason... ARM crash? ' 10.01.2015: o.k. now, reduce Llor... ' Llor changed to temblo STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Hybr_Speedup).tog THEN IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser sens = 1 Task(%Hybr_Speedup).tog = %True END IF ' on accelerating body speed, do something... IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF ISFALSE xtrig THEN xnoot = MIN(Hybr.lowtes - sens + (gesture.speedup(0)* 1), 72) ' multiplier was 1.5, chaned to 1 (12.01.2015) xnoot = MAX(MIN(xnoot,72),Hybr.lowtes) mPlay Hybr.channel,xnoot, MIN(gesture.speedup_val(0), 127) xtrig = %True END IF ELSE RESET xtrig IF xnoot THEN mPlay Hybr.channel, xnoot, %False RESET xnoot END IF END IF ' IF gesture.speedup(1) > sens THEN IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN ynoot = MIN(Hybr.lowtes - sens + (gesture.speedup(1)* 1), 72) ynoot = MAX(MIN(ynoot,72),Hybr.lowtes) IF ynoot = xnoot THEN DECR ynoot END IF mPlay Hybr.channel,ynoot , MIN(gesture.speedup_val(1), 127) ytrig = %true END IF ELSE IF ynoot THEN mPlay Hybr.channel, ynoot, %False RESET ynoot END IF RESET ytrig END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN IF ISFALSE ztrig THEN znoot = MIN(Hybr.lowtes - sens + (gesture.speedup(2)* 1), 72) znoot = MAX(MIN(znoot,72),Hybr.lowtes) IF znoot = ynoot THEN DECR znoot END IF mPlay Hybr.channel, znoot, MIN(gesture.speedup_val(2), 127) ztrig = %True END IF ELSE IF znoot THEN mPlay Hybr.channel, znoot, %False RESET znoot END IF RESET ztrig END IF IF Gesture.speedup(3) > (sens * 10) THEN IF ISFALSE lites THEN MM_Hybr_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Hybr_Off %MM_Lights RESET lites END IF END IF IF Gesture.speedup(3) > (sens * 70) THEN 'was * 6 IF gesture.speedup(3) > (gesture.slowdown(3) + (sens * 5)) THEN mPlay Temblo.channel,RND(60,65),MIN(@pDoppler.zf , 127) END IF END IF END SUB SUB Hybr_Speedup_On () ' sends the controllers required: Controller Temblo.channel, 66, 127 Controller Hybr.channel, 66, 127 IF Hybr.ctrl(7) <> 127 THEN Controller Hybr.channel, 7, 127 ' volume Hybr.ctrl(7) = 127 END IF IF Hybr.ctrl(1) <> 5 THEN Controller Hybr.channel, 1, 5 ' wind Hybr.ctrl(1) = 5 END IF IF hybr.ctrl(3) <> 50 THEN Controller Hybr.channel, 3, 50 ' fm depth Hybr.ctrl(3) = 50 END IF IF hybr.ctrl(4) <> 30 THEN Controller Hybr.channel, 4, 30 ' fm speed Hybr.ctrl(4) = 30 END IF IF hybr.ctrl(5) THEN Controller Hybr.channel, 5, 0 Hybr.ctrl(5) = %False END IF IF Hybr.ctrl(6) THEN Controller Hybr.channel, 6, 0 Hybr.ctrl(6) = %False END IF IF Hybr.ctrl(16) THEN Controller Hybr.channel, 16,0 ' attack Hybr.ctrl(16) = %False END IF IF Hybr.ctrl(17) <> 40 THEN Controller Hybr.channel, 17, 40 Hybr.ctrl(17) = 40 END IF IF Hybr.ctrl(18) <> 6 THEN Controller Hybr.channel, 18, 6 ' decay Hybr.ctrl(18) = 6 END IF IF Hybr.ctrl(19) <> 20 THEN Controller Hybr.channel, 19, 20 ' release Hybr.ctrl(19) = 20 END IF IF Hybr.ctrl(20) <> 64 THEN Controller Hybr.channel, 20, 64 ' tuning to 440Hz Hybr.ctrl(20) = 64 END IF 'Controller Hybr.channel, 120, 0 ' input volume 0 END SUB SUB Hybr_Slowdown () ' here we look only into the frequency data on order to detect sudden slowdown gesture ' original version in Butoh_010.inc (was not working well anyway...) ' now using the new Gesture_Classify procedure (Fourstep) ' mapped on piperola - should give very short notes only. ' 06.04.2010 : using gesture_analyser ' 09.04.2010: rescaled ' 15.04.2010: extended testing under algo1: FIR. Works very reliably now ' 01.01.2015: copied from Links and adapted to Hybr ' 08.01.2014: seems to work reasonably well, not really good though STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, lites AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%Hybr_Slowdown).tog THEN sens = 10 Task(%Hybr_Slowdown).tog = %True END IF IF Gesture.slowdown(0) > sens THEN ' frequency is unipolar data! - under algo1, can go up to 230 IF ISFALSE xtrig THEN xnoot = MIN(Hybr.lowtes - sens + 2+ (gesture.slowdown_val(0)/2),72) 'independent from sens 15.04 ' midi overflow? xnoot = MAX(MIN(xnoot,72),Hybr.lowtes) mPlay Hybr.channel, xnoot, @pDoppler.xa * 120 xtrig = %True END IF ELSE IF xtrig THEN IF xnoot THEN mPlay Hybr.channel, xnoot, %False RESET xnoot END IF END IF RESET xtrig END IF IF Gesture.slowdown(1) > sens THEN IF ISFALSE ytrig THEN ynoot = MIN(Hybr.lowtes - sens + 2+ (gesture.slowdown_val(1)/2), 72) ynoot = MAX(MIN(ynoot,72),Hybr.lowtes) mPlay Hybr.channel, ynoot, @pDoppler.ya * 120 ytrig = %true END IF ELSE IF ytrig THEN IF ynoot THEN mPlay Hybr.channel, ynoot, %False RESET ynoot END IF END IF RESET ytrig END IF IF Gesture.slowdown(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers znoot = MIN(Hybr.lowtes - sens + 2+(gesture.slowdown_val(2)/2), 72) znoot = MAX(MIN(znoot,72),Hybr.lowtes) mPlay Hybr.channel, znoot, @pDoppler.za * 120 ztrig = %True END IF ELSE IF ztrig THEN IF znoot THEN mPlay Hybr.channel, znoot , %False RESET znoot END IF END IF RESET ztrig END IF IF (gesture.slowdown(3) > sens) AND (gesture.slowdown(3) > gesture.speedup(3)) THEN IF ISFALSE lites THEN MM_Hybr_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Hybr_Off %MM_Lights RESET lites END IF END IF END SUB SUB Hybr_Slowdown_On () ' sends the controllers required: Controller Hybr.channel, 66, 127 IF Hybr.ctrl(7) <> 127 THEN Controller Hybr.channel, 7, 127 ' volume Hybr.ctrl(7) = 127 END IF IF Hybr.ctrl(1) <> 10 THEN Controller Hybr.channel, 1, 10 ' wind Hybr.ctrl(1) = 10 END IF Controller Hybr.channel, 3, 0 Controller Hybr.channel, 4, 0 Controller Hybr.channel, 5, 0 Controller Hybr.channel, 6, 0 RESET Hybr.ctrl(3), Hybr.ctrl(4), Hybr.ctrl(5), Hybr.ctrl(6) IF hybr.ctrl(16) <> 20 THEN Controller Hybr.channel, 16,20 ' attack Hybr.ctrl(16) = 20 END IF IF Hybr.ctrl(17) <> 10 THEN Controller Hybr.channel, 17, 10 Hybr.ctrl(17) = 10 END IF IF Hybr.ctrl(18) <> 20 THEN Controller Hybr.channel, 18, 20 ' decay Hybr.ctrl(18) = 20 END IF IF Hybr.ctrl(19) <> 30 THEN Controller Hybr.channel, 19, 30 ' release Hybr.ctrl(19) = 30 END IF ' Controller Hybr.channel, 20, 64 ' tuning to 440Hz ' Controller Hybr.channel, 120, 0 ' input volume 0 END SUB SUB Hybr_Clusters () ' 04.01.2014 ' explosive cluster test ' 08.01.2015: works reasonably STATIC slnr, cnt, note, i, lites AS LONG IF ISFALSE Task(%Hybr_clusters).tog THEN Task(%Hybr_clusters).tog = %True ' RESET cnt END IF IF (ISFALSE gesture.implo(0)) AND (gesture.explo(0)> @pDoppler.noise * 3) THEN ' cluster width depending on movement speed: FOR i = 33 TO 33 + (@pDoppler.xf * 0.07) ' 0.07 = 14 / 200 AddNote2Har Hybr.Har(1),i, gesture.explo_val(0) * 127 NEXT i END IF IF (ISFALSE gesture.implo(1)) AND (gesture.explo(1) > @pDoppler.noise * 3) THEN FOR i = 48 TO 48 + (@pDoppler.yf * 0.06) ' 0.06 = 12/ 200 AddNote2Har Hybr.Har(1),i, gesture.explo_val(1) * 127 NEXT i END IF IF (ISFALSE gesture.implo(2)) AND (gesture.explo(2)> @pDoppler.noise * 3) THEN FOR i = 61 TO 61 + (@pDoppler.zf * 0.055) ' 0.05 = 11/ 200 AddNote2Har Hybr.Har(1),i, gesture.explo_val(2) * 127 NEXT i END IF InstrumPlay Hybr IF (ISFALSE gesture.implo(3)) AND (gesture.explo(3) > 0.0) THEN IF ISFALSE lites THEN MM_Hybr_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Hybr_Off %MM_Lights RESET lites END IF END IF END SUB SUB Hybr_Clusters_On () ' sends the controllers required: Controller Hybr.channel, 66, 127 MM_Hybr_On %MM_Lights Controller Hybr.channel, 7, 127 ' volume Controller Hybr.channel, 1, 0 ' wind Controller Hybr.channel, 3, 100 ' fm depth Controller Hybr.channel, 4, 30 ' fm speed Controller Hybr.channel, 5, 0 Controller Hybr.channel, 6, 0 Controller Hybr.channel, 16,2 ' attack Controller Hybr.channel, 17, 100 Controller Hybr.channel, 18, 2 ' decay Controller Hybr.channel, 19, 30 ' release Controller Hybr.channel, 20, 64 ' tuning to 440Hz Controller Hybr.channel, 120, 0 ' input volume 0 END SUB SUB HYBR_Triads () ' interactive triad test for HYBR , on edgy ' 08.01.2015: works a bit... STATIC oldnote, noot1, noot2, noot3 AS INTEGER STATIC slnr AS LONG IF ISFALSE Task(%HYBR_Triads).tog THEN ' create a parameter window: ' DIM TaskParamLabels(1) AS STATIC ASCIIZ * 8 ' TaskParamLabels(0) = "Tempo" ' TaskParamlabels(1) = "Velo" ' ' IF ISFALSE Task(%HYBR_Triads).hParam THEN ' MakeTaskParameterDialog %HYBR__Triads,2,Slider(),0,UDctrl(),TaskParamLabels() ' END IF ' IF ISFALSE slnr THEN ' slnr = TaskEX(%HYBR_Triads).SliderNumbers(1) ' velo ' END IF Task(%HYBR_Triads).tog = %True END IF IF gesture.edgy(3) THEN noot1 = MIN(hybr.lowtes + (gesture.edgy(0) * 50), 72) noot2 = MIN(hybr.lowtes + (gesture.edgy(1) * 50), 72) IF noot1 = noot2 THEN INCR noot2 noot3 = MIN(hybr.lowtes + (gesture.edgy(2) * 50), 72) IF noot2 = noot3 THEN INCR noot3 IF noot1 = noot3 THEN DECR noot1 addnote2har Hybr.har(1), noot1, (@pDoppler.xa * 100) addnote2har Hybr.har(1), noot2, (@pDoppler.ya * 100) addnote2har Hybr.har(1), noot3, (@pDoppler.za * 100) InstrumPlay Hybr ELSE InstrumPlay Hybr END IF Task(%HYBR_Triads).freq = MAX(@pDoppler.xf, @pDoppler.yf, @pDoppler.zf) /10 IF Task(%HYBR_Triads).freq < 1 THEN Task(%HYBR_Triads).freq = 1 END SUB SUB Hybr_Triads_On () LOCAL i AS LONG ' sends the controllers required: Controller Hybr.channel, 66, 127 'MM_Hybr_On %MM_Lights Controller Hybr.channel, 7, 110 ' volume Hybr.ctrl(7) = 110 Controller Hybr.channel, 1, 1 ' wind Hybr.ctrl(1) = 1 Controller Hybr.channel, 3, 0 Controller Hybr.channel, 4, 0 Controller Hybr.channel, 5, 0 Controller Hybr.channel, 6, 0 RESET Hybr.ctrl(3), Hybr.ctrl(4), Hybr.ctrl(5), Hybr.ctrl(6) Controller Hybr.channel, 16,3 ' attack Hybr.ctrl(16) = 3 Controller Hybr.channel, 17, 90 Hybr.ctrl(17) = 90 Controller Hybr.channel, 18, 5 ' decay Hybr.ctrl(18) = 5 Controller Hybr.channel, 19, 5 ' release Hybr.ctrl(19) = 5 ' Controller Hybr.channel, 20, 64 ' tuning to 440Hz ' Controller Hybr.channel, 120, 0 ' input volume 0 ' add second inharmonic: FOR i = 73 TO 112 IF Hybr.ctrl(i) <> 120 THEN Controller Hybr.channel, i, 120 Hybr.ctrl(i) = 120 END IF NEXT i END SUB SUB Hybr_Triads_Off () LOCAL i AS LONG Controller Hybr.channel, 123, 0 FOR i = 73 TO 112 IF Hybr.ctrl(i) <> %False THEN Controller Hybr.channel, i, %False Hybr.ctrl(i) = %False END IF NEXT i END SUB SUB Hybr_Adsr () ' test for HYBR enveloppe ' controllers 16-19 ' last update 18.12.2014 gwr. STATIC slnr AS BYTE IF ISFALSE Task(%HYBR_adsr).tog THEN ' create a parameter window: DIM TaskParamLabels(3) AS ASCIIZ * 8 TaskParamLabels(0) = "Attack" ' #16 TaskParamlabels(1) = "Hold" ' #17 hold TaskParamLabels(2) = "Decay" ' #18 TaskParamlabels(3) = "Release" ' #19 IF ISFALSE Task(%HYBR_adsr).hParam THEN MakeTaskParameterDialog %HYBR_adsr,4,Slider(),0,UDctrl(),TaskParamLabels() END IF IF ISFALSE slnr THEN slnr = TaskEX(%HYBR_adsr).SliderNumbers(0) Slider(slnr).value = 1 ' attack time SendMessage Slider(Slnr).h, %TBM_SETPOS,%True, Slider(Slnr).value Controller Hybr.channel, 16, Slider(slnr).value Hybr.ctrl(16) = Slider(slnr).value Slider(slnr+1).value = 127 ' hold level SendMessage Slider(Slnr+1).h, %TBM_SETPOS,%True, Slider(Slnr+1).value Controller Hybr.channel, 17, Slider(slnr+1).value Hybr.ctrl(17) = Slider(slnr+1).value Slider(slnr+2).value = 2 ' decay time SendMessage Slider(Slnr+2).h, %TBM_SETPOS,%True, Slider(Slnr+2).value Controller Hybr.channel, 18, Slider(slnr+2).value Hybr.ctrl(18) = Slider(slnr+2).value Slider(slnr+3).value = 1 ' release time SendMessage Slider(Slnr+3).h, %TBM_SETPOS,%True, Slider(Slnr+3).value Controller Hybr.channel, 19, Slider(slnr+3).value Hybr.ctrl(19) = Slider(slnr+3).value END IF Task(%HYBR_adsr).freq = 34 Task(%HYBR_adsr).tog = %True END IF IF Slider(slnr).value <> HYBR.ctrl(16) THEN HYBR.ctrl(16) = Slider(slnr).value ' 0-127 Controller HYBR.channel, 16, HYBR.ctrl(16) ' attack END IF IF Slider(slnr+1).value <> HYBR.ctrl(17) THEN HYBR.ctrl(17) = Slider(slnr+1).value ' 0-127 Controller HYBR.channel, 17, HYBR.ctrl(17) ' hold END IF IF Slider(slnr+2).value <> HYBR.ctrl(18) THEN HYBR.ctrl(18) = Slider(slnr+2).value ' 0-127 Controller HYBR.channel, 18, HYBR.ctrl(18) ' decay END IF IF Slider(slnr+3).value <> HYBR.ctrl(19) THEN HYBR.ctrl(19) = Slider(slnr+3).value ' 0-127 Controller HYBR.channel, 19, HYBR.ctrl(19) ' release END IF END SUB SUB Hybr_f1f2 () ' test for HYBR overtones ' seems to crash the ARM's... STATIC slnr, udnr, f1ctrl, f2ctrl AS BYTE LOCAL i AS LONG IF ISFALSE Task(%HYBR_f1f2).tog THEN ' create a parameter window: DIM TaskParamLabels(1) AS ASCIIZ * 8 TaskParamLabels(0) = "f1" ' f1 volume setting TaskParamLabels(1) = "f2" ' f2 volume IF ISFALSE Task(%HYBR_f1f2).hParam THEN MakeTaskParameterDialog %HYBR_f1f2,2,Slider(),0,UDctrl(),TaskParamLabels() END IF IF ISFALSE slnr THEN slnr = TaskEX(%HYBR_f1f2).SliderNumbers(0) Slider(slnr).value = 0 SendMessage Slider(Slnr).h, %TBM_SETPOS,%True, Slider(Slnr).value Slider(slnr+1).value = 0 SendMessage Slider(Slnr+1).h, %TBM_SETPOS,%True, Slider(Slnr+1).value END IF Task(%HYBR_f1f2).freq = 10 Task(%HYBR_f1f2).tog = %True FOR i = 23 TO 62 Hybr.ctrl(i) = %False Controller Hybr.channel, i, %False NEXT i FOR i = 73 TO 122 Hybr.ctrl(i) = %False Controller Hybr.channel, i, %False NEXT i f1ctrl = 23 f2ctrl = 73 END IF ' f1ctrl = UDctrl(TaskEX(%HYBR_f1f2).UpDownNumbers(0)).value ' 23-62 ' f2ctrl = UDctrl(TaskEX(%HYBR_f1f2).UpDownNumbers(1)).value ' 73-112 ' may need pacing, as the ARM's react too slowly... IF Slider(slnr).value <> HYBR.ctrl(f1ctrl) THEN FOR f1ctrl = 23 TO 62 HYBR.ctrl(f1ctrl) = Slider(slnr).value ' 0-127 Controller HYBR.channel, f1ctrl, HYBR.ctrl(f1ctrl) ' volume of first overtone NEXT f1ctrl END IF IF Slider(slnr+1).value <> HYBR.ctrl(f2ctrl) THEN FOR f2ctrl = 73 TO 122 HYBR.ctrl(f2ctrl) = Slider(slnr+1).value ' 0-127 Controller HYBR.channel, f2ctrl, HYBR.ctrl(f2ctrl) ' volume of second overtone NEXT f2ctrl END IF END SUB SUB Hybr_ctrl() ' test for HYBR volume control cc7 and cc1 ' seems working. STATIC slnr AS BYTE IF ISFALSE Task(%HYBR_ctrl).tog THEN ' create a parameter window: DIM TaskParamLabels(1) AS ASCIIZ * 8 TaskParamLabels(0) = "Volume" ' controller 7 Taskparamlabels(1) = "Noise" IF ISFALSE Task(%HYBR_Ctrl).hParam THEN MakeTaskParameterDialog %HYBR_Ctrl,2,Slider(),0,UDctrl(),TaskParamLabels() END IF IF ISFALSE slnr THEN slnr = TaskEX(%HYBR_Ctrl).SliderNumbers(0) Slider(slnr).value = 64 HYBR.ctrl(7) = 64 SendMessage Slider(Slnr).h, %TBM_SETPOS,%True, Slider(Slnr).value Slider(slnr+1).value = 0 HYBR.ctrl(1) = 0 SendMessage Slider(Slnr+1).h, %TBM_SETPOS,%True, Slider(Slnr+1).value END IF Task(%HYBR_Ctrl).freq = 20 Task(%HYBR_Ctrl).tog = %True END IF IF Slider(slnr).value <> HYBR.ctrl(7) THEN HYBR.ctrl(7) = Slider(slnr).value ' 0-127 Controller HYBR.channel, 7, HYBR.ctrl(7) ' volume END IF IF Slider(slnr+1).value <> HYBR.ctrl(1) THEN HYBR.ctrl(1) = Slider(slnr+1).value ' 0-127 Controller HYBR.channel, 1, HYBR.ctrl(1) ' noise END IF END SUB SUB Hybr_Deriv_5 () ' also used to test the scaling factors for gesture analysis based on the derivatives of surface vectors ' copied from derivatives and adapted to Hybr ' 10.01.2015: Works nicely. STATIC noot1, noot2, noot3, slnr, cnt1, cnt2, cnt3 AS INTEGER STATIC d1max, d2max,d3max AS SINGLE IF ISFALSE Task(%Hybr_Deriv_5).tog THEN IF ISFALSE Task(%Hybr_Deriv_5).hParam THEN DIM TaskParamLabels(0 TO 2) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "dS1" ' sensit. TaskParamLabels(1) = "dS2" ' sensit. TaskParamLabels(2) = "dS3" ' sensit MakeTaskParameterDialog %Hybr_Deriv_5,3,Slider(),0,UDctrl(),TaskParamLabels() ' 3 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Hybr_Deriv_5).SliderNumbers(0) Slider(slnr).value = 10 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 20 SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value slider(slnr+2).value = 20 SendMessage Slider(slnr+2).h, %TBM_SETPOS,%True, Slider(slnr+2).value END IF logfile "Testing hybr_deriv_5" Task(%Hybr_Deriv_5).tog = %True END IF ' first derivative mapped on Bomi IF gesture.dS1(3) > slider(slnr).value / 128 THEN IF gesture.dS1(3) >= 1 THEN INCR cnt1 'gesture.dS1Scalefactor = gesture.dS1Scalefactor * 0.9 - do not change this anymore. Now set at 24 ' was 22.5 logfile "d1 scaling = " & STR$(gesture.dS1Scalefactor) & " clipping to 1 " & STR$(cnt1) & "th time" RESET d1max END IF IF gesture.dS1(3) > d1max THEN logfile "gesture.dS1(3)= " & STR$(gesture.dS1(3)) & " scaling= " & STR$(gesture.dS1Scalefactor) d1max = gesture.dS1(3) END IF IF noot1 THEN NoteOff Hybr.channel, noot1 noot1 = %False END IF noot1 = Hybr.lowtes + (SQR(gesture.dS1(3)- (slider(slnr).value/ 128)) * 36) mPlay Hybr.channel, noot1, @pDoppler.xa * 127 ELSE IF noot1 THEN NoteOff Hybr.channel, noot1 RESET noot1 END IF END IF ' second derivative IF gesture.dS2(3) > slider(slnr+1).value / 128 THEN IF gesture.dS2(3) >= 1 THEN INCR cnt2 logfile "d2 scaling = " & STR$(gesture.dS2Scalefactor) & " clipping to 1 " & STR$(cnt2) & "th time" 'gesture.dS2Scalefactor *= 0.9 'logfile "d2 scaling = " & STR$(gesture.dS2Scalefactor) RESET d2max END IF IF gesture.dS2(3) > d2max THEN logfile "gesture.dS2(3)= " & STR$(gesture.dS2(3)) & " scaling= " & STR$(gesture.dS2Scalefactor) d2max = gesture.dS2(3) END IF IF noot2 THEN NoteOff Hybr.channel, noot2 noot2 = %False END IF noot2 = Hybr.lowtes + (SQR(gesture.dS2(3)- (slider(slnr+1).value/128)) * 36) mPlay Hybr.channel, noot2, @pDoppler.ya * 127 ELSE IF noot2 THEN mPlay Hybr.channel, noot2, %False RESET noot2 END IF END IF ' third derivative IF gesture.dS3(3) > slider(slnr+2).value / 128 THEN IF gesture.dS3(3) >= 1 THEN INCR cnt3 logfile "d3 scaling = " & STR$(gesture.dS3Scalefactor) & " clipping to 1 " & STR$(cnt3) & "th time" 'gesture.dS3Scalefactor *= 0.9 'logfile "d3 scaling = " & str$(gesture.dS3Scalefactor) RESET d3max END IF IF gesture.dS3(3) > d3max THEN logfile "gesture.dS3(3)= " & STR$(gesture.dS3(3)) & " scaling= " & STR$(gesture.dS3Scalefactor) d3max = gesture.dS3(3) END IF IF noot3 THEN mPlay Hybr.channel, noot3, %False noot3 = %False END IF noot3 = Hybr.lowtes + (SQR(gesture.dS3(3) - (slider(slnr+2).value / 128)) * 60) mPlay Hybr.channel, noot3, 36 ELSE IF noot3 THEN mPlay Hybr.channel, noot3, %False RESET noot3 END IF END IF END SUB SUB Hybr_Deriv_5_On () ' sends the controllers required: Controller Hybr.channel, 66, 127 Controller Hybr.channel, 7, 110 ' volume Controller Hybr.channel, 1, 1 ' wind Controller Hybr.channel, 3, 0 Controller Hybr.channel, 4, 0 Controller Hybr.channel, 5, 0 Controller Hybr.channel, 6, 0 Controller Hybr.channel, 16, 3 ' attack Controller Hybr.channel, 17, 8 Controller Hybr.channel, 18, 20 ' decay Controller Hybr.channel, 19, 25 ' release 'Controller Hybr.channel, 20, 64 ' tuning to 440Hz END SUB SUB Hybr_Deriv_Em () ' also used to test the scaling factors for gesture analysis based on the derivatives of surface vectors ' copied from derivatives and adapted to Hybr ' 10.01.2015: Works nicely. ' 13.01.2015: unsensitive copy for emilie STATIC noot1, noot2, noot3, slnr, cnt1, cnt2, cnt3 AS INTEGER STATIC d1max, d2max,d3max AS SINGLE IF ISFALSE Task(%Hybr_Deriv_Em).tog THEN IF ISFALSE Task(%Hybr_Deriv_Em).hParam THEN DIM TaskParamLabels(0 TO 2) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "dS1" ' sensit. TaskParamLabels(1) = "dS2" ' sensit. TaskParamLabels(2) = "dS3" ' sensit MakeTaskParameterDialog %Hybr_Deriv_Em,3,Slider(),0,UDctrl(),TaskParamLabels() ' 3 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Hybr_Deriv_Em).SliderNumbers(0) Slider(slnr).value = 90 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 90 SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value slider(slnr+2).value = 90 SendMessage Slider(slnr+2).h, %TBM_SETPOS,%True, Slider(slnr+2).value END IF Task(%Hybr_Deriv_Em).tog = %True END IF ' first derivative mapped on Bomi IF gesture.dS1(3) > slider(slnr).value / 128 THEN IF gesture.dS1(3) >= 1 THEN INCR cnt1 RESET d1max END IF IF gesture.dS1(3) > d1max THEN d1max = gesture.dS1(3) END IF IF noot1 THEN NoteOff Hybr.channel, noot1 noot1 = %False END IF noot1 = Hybr.lowtes + (SQR(gesture.dS1(3)- (slider(slnr).value/ 128)) * 36) mPlay Hybr.channel, noot1, @pDoppler.xa * 127 ELSE IF noot1 THEN NoteOff Hybr.channel, noot1 RESET noot1 END IF END IF ' second derivative IF gesture.dS2(3) > slider(slnr+1).value / 128 THEN IF gesture.dS2(3) >= 1 THEN INCR cnt2 RESET d2max END IF IF gesture.dS2(3) > d2max THEN d2max = gesture.dS2(3) END IF IF noot2 THEN NoteOff Hybr.channel, noot2 noot2 = %False END IF noot2 = Hybr.lowtes + (SQR(gesture.dS2(3)- (slider(slnr+1).value/128)) * 36) mPlay Hybr.channel, noot2, @pDoppler.ya * 127 ELSE IF noot2 THEN mPlay Hybr.channel, noot2, %False RESET noot2 END IF END IF ' third derivative IF gesture.dS3(3) > slider(slnr+2).value / 128 THEN IF gesture.dS3(3) >= 1 THEN INCR cnt3 RESET d3max END IF IF gesture.dS3(3) > d3max THEN d3max = gesture.dS3(3) END IF IF noot3 THEN mPlay Hybr.channel, noot3, %False noot3 = %False END IF noot3 = Hybr.lowtes + (SQR(gesture.dS3(3) - (slider(slnr+2).value / 128)) * 60) mPlay Hybr.channel, noot3, 36 ELSE IF noot3 THEN mPlay Hybr.channel, noot3, %False RESET noot3 END IF END IF END SUB SUB Hybr_Collision () '10.01.2015: velo's must be higher STATIC sens AS SINGLE STATIC lite1, lite2, lite3 AS INTEGER LOCAL i AS CURRENCY IF ISFALSE sens THEN sens = 1.4 END IF IF MAX(gesture.collision(0), gesture.collision(1), gesture.collision(2)) > sens THEN FOR i = 1 TO 13 * (@pDoppler.xa + @pDoppler.ya + @pDoppler.za) AddNote2Har Hybr.Har(1), Hybr.LowTes + i, MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 NEXT controller Hybr.channel, 7, 36 + ( 30 * (SQR(@pDoppler.xa) + SQR(@pDoppler.ya) + SQR(@pDoppler.za))) END IF InstrumPlay Hybr IF gesture.collision(0) THEN mPlay Hybr.channel, 122, gesture.impact(0) * 127 lite1 = %True ELSE IF lite1 THEN NoteOff Hybr.channel, 122 RESET lite1 END IF IF gesture.collision(1) THEN mPlay Hybr.channel, 123, gesture.impact(1) * 127 lite2 = %True ELSE IF lite2 THEN Noteoff Hybr.channel, 123 RESET lite2 END IF IF gesture.collision(2) THEN mPlay Hybr.channel, 124, gesture.impact(2) * 127 lite3 = %True ELSE IF lite3 THEN NoteOff Hybr.channel, 124 RESET lite3 END IF END SUB SUB Hybr_Collision_On () ' sends the controllers required: LOCAL i AS LONG Controller Hybr.channel, 66, 127 Controller Hybr.channel, 7, 127 ' volume Controller Hybr.channel, 1, 48 ' wind Controller Hybr.channel, 3, 0 Controller Hybr.channel, 4, 0 Controller Hybr.channel, 5, 0 Controller Hybr.channel, 6, 0 Controller Hybr.channel, 16, 0 ' attack Controller Hybr.channel, 17, 100 Controller Hybr.channel, 18, 25 ' decay Controller Hybr.channel, 19, 100 ' release ' Controller Hybr.channel, 20, 64 ' tuning to 440Hz ' Controller Hybr.channel, 120, 0 ' input volume 0 ' second inharmonic: FOR i = 73 TO 112 IF Hybr.ctrl(i) <> 100 THEN Controller Hybr.channel, i, 100 Hybr.ctrl(i) = 100 END IF NEXT i END SUB SUB Hybr_Collision_Off () LOCAL i AS LONG MM_Hybr_Off %MM_Lights Controller Hybr.channel, 123, 0 FOR i = 73 TO 112 IF Hybr.ctrl(i) <> %False THEN Controller Hybr.channel, i, %False Hybr.ctrl(i) = %False END IF NEXT i END SUB SUB Hybr_Theacol () ' based on Domi_Theacol_Trig () in Links.inc ' this is the inverse of the collision detection code ' here we look only into the acceleration data on order to detect theatrical collisions. ' these collisions have decelleration until standstill, followed by acceleration. ' we may want to make the timeframe adjustable (now 100) ' the task frequency is 256Hz ' modified 5.04.2010: velo's added on the moment of the detected collision ' timewindow can now be set with slider ' nu mapping op: Puff ' 05.04.2010: works reasonably well. ' 06.04.2010: recoded using Gesture_Analyser. ' 09.04.2010: velo's rescaled and sens increased. ' 04.01.2014: reused for Happy Robots (on Puff) ' 10.01.2015: recoding for use on Hybr. ' This version had a serious bug in that it did not switch notes off ' However, the sound result is quite mysterious, and so we decided to preserve the effect for the first 2 minutes ' It makes a nice composition this way. Duration should be mimimum 4 minutes. STATIC slnr, lites AS DWORD STATIC xtrig, ytrig, ztrig, duur, starttim, noot1, noot2, noot3 AS LONG LOCAL i AS DWORD STATIC sens AS SINGLE IF ISFALSE Task(%Hybr_Theacol).tog THEN sens = 1 starttim = TimeGetTime / 1000 '(in ms) 'start gesture_analyser IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Progchange mDisp_A.channel, 4 ' stopwatch start Progchange mDisp_B.channel, 4 Task(%Hybr_Theacol).tog = %True END IF duur = (TimeGetTime / 1000) - starttim ' so duur will be in seconds ' on theatrical collision, do something... ' sens = Slider(slnr).value / 10 SELECT CASE duur CASE < 180 ' was 120 IF gesture.theacol(0) > sens THEN IF ISFALSE xtrig THEN mPlay Hybr.channel, MIN(Hybr.Lowtes + ((gesture.theacol(0))*8),72), MIN(gesture.impact(0) * 127,127) xtrig = %True END IF ELSE RESET xtrig END IF IF gesture.theacol(1) > sens THEN IF ISFALSE ytrig THEN mPlay Hybr.channel, MIN(Hybr.lowtes + ((gesture.theacol(1))*8),72), MIN(gesture.impact(1) * 127,127) ytrig = %true END IF ELSE RESET ytrig END IF IF gesture.theacol(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers on the same collision mPlay Hybr.channel, MIN(Hybr.Lowtes + ((gesture.theacol(2))*8),72), MIN(gesture.impact(2) * 127,127) ztrig = %True END IF ELSE RESET ztrig END IF CASE < 200 ' was 135 ' switch off all sounding notes - thinning IF gesture.theacol(0) > sens THEN NoteOff Hybr.channel, MIN(Hybr.Lowtes + ((gesture.theacol(0))*8),72) ', MIN(gesture.impact(0) * 127,127) END IF IF gesture.theacol(1) > sens THEN NoteOff Hybr.channel, MIN(Hybr.Lowtes + ((gesture.theacol(1))*8),72) ', MIN(gesture.impact(1) * 127,127) END IF IF gesture.theacol(2) > sens THEN NoteOff Hybr.channel, MIN(Hybr.Lowtes + ((gesture.theacol(2))*8),72) ', MIN(gesture.impact(0) * 127,127) END IF RESET xtrig, ytrig, ztrig CASE 200 '135 InstrumPlay Hybr ' notes off = seems one of the ARM's crashed here... Controller Hybr.channel, 123, 0 Hybr_Theacol_2 ' send controllers CASE ELSE ' normal working, with note-off's IF gesture.theacol(0) > sens THEN IF ISFALSE xtrig THEN IF noot1 THEN NoteOff Hybr.channel, noot1 noot1 = MIN(Hybr.Lowtes + ((gesture.theacol(0))*8),72) mPlay Hybr.channel,noot1 , MIN(gesture.impact(0) * 127,127) xtrig = %True END IF ELSE IF noot1 THEN NoteOff Hybr.channel, noot1 RESET noot1 RESET xtrig END IF IF gesture.theacol(1) > sens THEN IF ISFALSE ytrig THEN IF noot2 THEN NoteOff Hybr.channel, noot2 noot2 = MIN(Hybr.lowtes + ((gesture.theacol(1))*8),72) mPlay Hybr.channel,noot2, MIN(gesture.impact(1) * 127,127) ytrig = %true END IF ELSE IF noot2 THEN noteOff Hybr.channel, noot2 RESET noot2 END IF RESET ytrig END IF IF gesture.theacol(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers on the same collision IF noot3 THEN NoteOff Hybr.channel, noot3 noot3 = MIN(Hybr.Lowtes + ((gesture.theacol(2))*8),72) mPlay Hybr.channel, noot3 , MIN(gesture.impact(2) * 127,127) ztrig = %True END IF ELSE IF noot3 THEN NoteOff Hybr.channel, noot3 RESET noot3 END IF RESET ztrig END IF END SELECT IF gesture.theacol(3) THEN IF ISFALSE lites THEN MM_Hybr_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Hybr_Off %MM_Lights RESET lites END IF END IF END SUB SUB Hybr_Theacol_On () ' sends the controllers required: LOCAL i AS LONG Controller Hybr.channel, 66, 127 Controller Hybr.channel, 7, 120 ' volume Hybr.ctrl(7) = 120 Controller Hybr.channel, 1, 2 ' wind Hybr.ctrl(2) = 2 Controller Hybr.channel, 3, 100 Hybr.ctrl(3) = 100 Controller Hybr.channel, 4, 80 Hybr.ctrl(4) = 80 Controller Hybr.channel, 5, 90 Hybr.ctrl(5) = 90 Controller Hybr.channel, 6, 20 Hybr.ctrl(6) = 20 Controller Hybr.channel, 16, 10 ' attack Hybr.ctrl(16) = 10 Controller Hybr.channel, 17, 40 Hybr.ctrl(17) = 40 Controller Hybr.channel, 18, 10 ' decay \ Hybr.ctrl(18) = 10 Controller Hybr.channel, 19, 30 ' release Hybr.ctrl(19) = 30 ' Controller Hybr.channel, 20, 64 ' tuning to 440Hz ' Controller Hybr.channel, 120, 0 ' input volume 0 ' second inharmonic: FOR i = 73 TO 112 IF Hybr.ctrl(i) <> 20 THEN Controller Hybr.channel, i, 20 Hybr.ctrl(i) = 20 END IF NEXT i ' reset displays on startup Controller mDisp_A.channel, 66, 127 Controller mDisp_B.Channel, 66, 127 ProgChange mDisp_A.channel, 0 ProgChange mDisp_B.channel, 0 mPlay mDisp_A.channel, 1, 16 mPlay mDisp_A.channel, 2, 16 mPlay mDisp_A.channel, 3, 16 mPlay mDisp_A.channel, 4, 16 mPlay mDisp_B.channel, 1, 16 mPlay mDisp_B.channel, 2, 16 mPlay mDisp_B.channel, 3, 16 mPlay mDisp_B.channel, 4, 16 Controller mDisp_A.channel, 123, 0 Controller mDisp_B.channel, 123, 0 END SUB SUB Hybr_Theacol_2 () 'send only controllers that need to be changed Controller Hybr.channel, 7, 127 ' volume Hybr.ctrl(7) = 127 ' Controller Hybr.channel, 1, 2 ' wind ' Hybr.ctrl(2) = 2 ' Controller Hybr.channel, 3, 100 ' Hybr.ctrl(3) = 100 ' Controller Hybr.channel, 4, 80 ' Hybr.ctrl(4) = 80 ' Controller Hybr.channel, 5, 90 ' Hybr.ctrl(5) = 90 ' Controller Hybr.channel, 6, 20 ' Hybr.ctrl(6) = 20 ' Controller Hybr.channel, 16, 10 ' attack ' Hybr.ctrl(16) = 10 Controller Hybr.channel, 17, 127 Hybr.ctrl(17) = 127 ' Controller Hybr.channel, 18, 10 ' decay \ ' Hybr.ctrl(18) = 10 Controller Hybr.channel, 19, 67 ' release Hybr.ctrl(19) = 67 END SUB SUB Hybr_Theacol_Off () LOCAL i AS LONG MM_Hybr_Off %MM_Lights Controller Hybr.channel, 123, 0 FOR i = 73 TO 112 IF Hybr.ctrl(i) <> %False THEN Controller Hybr.channel, i, %False Hybr.ctrl(i) = %False END IF NEXT i Controller mDisp_A.channel, 66, 0 Controller mDisp_B.channel, 66, 0 ProgChange mDisp_A.channel, 0 ProgChange mDisp_B.channel, 0 mPlay mDisp_A.channel, 1, 16 mPlay mDisp_A.channel, 2, 16 mPlay mDisp_A.channel, 3, 16 mPlay mDisp_A.channel, 4, 16 mPlay mDisp_B.channel, 1, 16 mPlay mDisp_B.channel, 2, 16 mPlay mDisp_B.channel, 3, 16 mPlay mDisp_B.channel, 4, 16 END SUB SUB Balmec_P1 () ' propeller 1 = note 40 ' to be checked: the wind may interfere with the gesture sensing engine. '10.01.2015: works fine. STATIC flag AS LONG IF ISFALSE Task(%Balmec_P1).tog THEN Task(%Balmec_P1).tog = %True END IF IF gesture.smooth(3) THEN mPlay Balmec.channel, 40, SQR(gesture.flue_val(3)) * 127 ' with the sqr we can hit the resonant frequency. flag = %True Task(%Balmec_P1).freq = 2 ELSE IF flag THEN NoteOff Balmec.channel, 40 Task(%Balmec_P1).freq = 0.4 ' allow slowdown RESET flag EXIT SUB END IF Task(%Balmec_P1).freq = 50 ' make is responsive again END IF END SUB SUB Balmec_P1_On () Controller Balmec.channel, 66, 127 END SUB SUB Balmec_P1_Off () Noteoff Balmec.channel, 40 Controller Balmec.channel, 66, 0 END SUB SUB Balmec_Man () ' manual propeller control STATIC slnr, rpm AS LONG IF ISFALSE Task(%Balmec_man).tog THEN IF ISFALSE Task(%Balmec_man).hParam THEN DIM TaskParamLabels(0) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "speed" MakeTaskParameterDialog %Balmec_man,1,Slider(),0,UDctrl(),TaskParamLabels() END IF IF ISFALSE slnr THEN slnr = TaskEX(%Balmec_man).SliderNumbers(0) END IF RESET rpm Slider(slnr).value = rpm SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value Task(%Balmec_man).tog = %True END IF IF slider(slnr).value <> rpm THEN rpm = Slider(slnr).value mPlay Balmec.channel, 40, rpm END IF END SUB SUB Hybr_Slowdown_GW () ' alternative version of above code, including , for namuda #30: Forces ' here we look only into the frequency data on order to detect sudden slowdown gesture ' 15.04.2010: extended testing under algo1: FIR. Works very reliably now ' 13.01.2013: version for Forces. ' 12.02.2015: reused for seduction, with HybrHi ' 10.10.2016: HybrLo added. STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, lites AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%hybr_slowdown_gw).tog THEN sens = 12 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%hybr_slowdown_gw).tog = %True END IF IF Gesture.slowdown(0) > sens THEN ' frequency is unipolar data! - under algo1, can go up to 230 IF ISFALSE xtrig THEN xnoot = MIN(HybrLo.lowtes - sens + 2+ (gesture.slowdown_val(0)/2), 108) 'independent from sens 15.04 IF xnoot < 36 THEN mPlay HybrLo.channel, xnoot, @pDoppler.xa * 127 ELSE mPlay Hybr.Channel, xnoot, @pDoppler.xa * 127 END IF xtrig = %True END IF ELSE IF xtrig THEN IF xnoot THEN IF xnoot < 36 THEN Release HybrLo.channel, xnoot, 36 ELSE mPlay Hybr.channel, xnoot, %False END IF RESET xnoot END IF END IF RESET xtrig END IF IF Gesture.slowdown(1) > sens THEN IF ISFALSE ytrig THEN ynoot = MIN(Hybr.lowtes - sens + 2+ (gesture.slowdown_val(1)/2), 108) IF ynoot = xnoot THEN INCR ynoot IF ynoot > 35 THEN mPlay Hybr.channel, ynoot, @pDoppler.ya * 127 ELSE mPlay HybrLo.channel, ynoot,@pDoppler.ya * 127 END IF ytrig = %true END IF ELSE IF ytrig THEN IF ynoot THEN IF ynoot < 36 THEN release HybrLo.channel, ynoot, 36 ELSE mPlay Hybr.channel, ynoot, %False END IF RESET ynoot END IF END IF RESET ytrig END IF IF Gesture.slowdown(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers znoot = MIN(Hybr.lowtes - sens + 2+(gesture.slowdown_val(2)/2),108) IF znoot = ynoot THEN INCR znoot IF znoot < 36 THEN mPlay HybrLo.channel, znoot, @pDoppler.za ELSE mPlay Hybr.channel, znoot, @pDoppler.za END IF ztrig = %True END IF ELSE IF ztrig THEN IF znoot THEN IF znoot > 35 THEN mPlay Hybr.channel, znoot , %False ELSE Release HybrLo.channel, znoot, 36 END IF RESET znoot END IF END IF RESET ztrig END IF IF (gesture.slowdown(3) > sens) AND (gesture.slowdown(3) > gesture.speedup(3)) THEN 'add piperola percussion here... 'mPlay Piperola.channel, 120 + (gesture.slowdown(3) MOD 8), MIN(@pDoppler.xf, 127) ' is this the culprit? 'bug goes away when we rem this.. pic error on piperola?? IF ISFALSE lites THEN MM_Hybr_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Hybr_Off %MM_Lights RESET lites END IF END IF END SUB SUB Hybr_Slowdown_GW_On () LOCAL i AS LONG ' sends the controllers required: Controller Hybr.channel, 66, 127 IF Hybr.ctrl(7) <> 127 THEN Controller Hybr.channel, 7, 127 ' volume Hybr.ctrl(7) = 127 END IF IF Hybr.ctrl(1) <> 40 THEN Controller Hybr.channel, 1, 40 ' wind Hybr.ctrl(1) = 10 END IF Controller Hybr.channel, 3, 0 Controller Hybr.channel, 4, 0 Controller Hybr.channel, 5, 40 Controller Hybr.channel, 6, 20 RESET Hybr.ctrl(3), Hybr.ctrl(4), Hybr.ctrl(5), Hybr.ctrl(6) IF hybr.ctrl(16) <> 10 THEN Controller Hybr.channel, 16,10 ' attack Hybr.ctrl(16) = 10 END IF IF Hybr.ctrl(17) <> 40 THEN Controller Hybr.channel, 17, 40 Hybr.ctrl(17) = 40 END IF IF Hybr.ctrl(18) <> 20 THEN Controller Hybr.channel, 18, 20 ' decay Hybr.ctrl(18) = 20 END IF IF Hybr.ctrl(19) <> 40 THEN Controller Hybr.channel, 19, 40 ' release Hybr.ctrl(19) = 40 END IF FOR i = 73 TO 122 HYBR.ctrl(i) = 110 'Slider(slnr+1).value ' 0-127 Controller HYBR.channel, i, HYBR.ctrl(i) ' volume of second overtone NEXT i ' controllers for HybrLo: Controller HybrLo.channel, 66, 127 Controller HybrLo.channel, 7, 82 Controller HybrLo.channel, 15, 28 Controller HybrLo.channel, 17, 4 Controller HybrLo.channel, 18, 6 END SUB ' ********************************************************** ' code for seduction 02/2015 ' ********************************************************** SUB Seduc_1 () ' 13.02.2014: rewritten for gesturetype derivatives d1S and d2S ' used in #43.1 ' 07.02.2015: Rewritten for seduction STATIC oldnoot, noot, cnt, slnr AS INTEGER LOCAL expantie, kontraktie AS SINGLE IF ISFALSE Task(%Seduc_1).tog THEN IF ISFALSE Task(%Seduc_1).hParam THEN DIM TaskParamLabels(0 TO 2) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "dS1+hy" ' sensit. for Hybr TaskParamLabels(1) = "ds1-xy" ' sensit. for Xy TaskParamLabels(2) = "dS2-Tr" ' sensit. voor Troms MakeTaskParameterDialog %Seduc_1,3,Slider(),0,UDctrl(),TaskParamLabels() ' 3 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Seduc_1).SliderNumbers(0) Slider(slnr).value = 17 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 100 ' lower in the course of this section. SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value slider(slnr+2).value = 64 SendMessage Slider(slnr+2).h, %TBM_SETPOS,%True, Slider(slnr+2).value END IF MM_Xy_On Task(%Seduc_1).tog = %True END IF ' genormaliseerde expantie: expantie = gesture.dS1(3) ' genormaliseerde kontraktie kontraktie =gesture.ds1(4) ' always positive 0-1 INCR cnt IF expantie > (Slider(slnr).value / 127) THEN IF noot < Hybr.lowtes + (expantie * 88) THEN noot = Hybr.lowtes + (expantie * 88) ' met HybrHi ' try to map on something musical: IF oldnoot THEN NoteOff Hybr.channel, oldnoot : RESET oldnoot IF noot THEN mPlay Hybr.channel, noot, MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 90 oldnoot =noot RESET noot END IF END IF IF kontraktie > (Slider(slnr+1).value / 127) THEN mPlay Xy.channel, xy.lowtes + (kontraktie * 36),MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 48 END IF ' try to do something with the second derivative now: IF gesture.dS2(3) > slider(slnr+2).value / 128 THEN ' scaling to be checked mPlay Troms.channel, MIN(24 + (gesture.ds2(3)* 24),127), 30 ' should track movement very well END IF END SUB SUB Seduc_1_stop () MM_Hybr_Off MM_Xy_Off MM_Troms_Off END SUB SUB Seduc_2 () ' using only the second derivative of the surface vectors ' to be remapped to use Rodo instead of Vibi STATIC noot, oldnoot, Tnoot, oldTnoot, slnr AS INTEGER IF ISFALSE Task(%Seduc_2).tog THEN IF ISFALSE Task(%Seduc_2).hParam THEN DIM TaskParamLabels(0 TO 1) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "Vib" ' sensit. for vibi ' lower slider in the course of the section TaskParamLabels(1) = "Toy" ' sensit. for Toypi ' lower slider in the course of the section MakeTaskParameterDialog %Seduc_2,2,Slider(),0,UDctrl(),TaskParamLabels() ' 2 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Seduc_2).SliderNumbers(0) Slider(slnr).value = 20 'vibi SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 39 '18 ' toypi SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value END IF MM_Vibi_On IF ISFALSE Task(%Hybr_Slowdown_gw).tog THEN starttask %Hybr_Slowdown_gw ' added 08.02.2015 Task(%Seduc_2).tog = %True END IF ' mapping: IF gesture.dS2(3) > Slider(slnr).value / 128 THEN 'if oldnoot then ' mPlay Vibi.channel, oldnoot, %False 'end if noot = Vibi.lowtes + ( SQR(gesture.dS2(3)) * 36) IF noot <> oldnoot THEN mPlay Vibi.channel, noot, 60 * MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) oldnoot = noot END IF ELSE IF oldnoot THEN mPlay Vibi.channel, oldnoot, %False oldnoot = %False END IF END IF ' negative peaks: IF gesture.ds2(4) > Slider(slnr+1).value / 128 THEN Tnoot = Toypi.lowtes + (SQR(gesture.ds2(4)) * 36) IF Tnoot <> oldTnoot THEN mPlay Toypi.channel, Tnoot, 30 * MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) oldTnoot = Tnoot END IF ELSE IF oldTnoot THEN oldTnoot = %False END IF END IF END SUB SUB Seduc_2_Stop () IF Task(%Hybr_Slowdown_gw).tog THEN stoptask %Hybr_Slowdown_gw MM_Vibi_Off END SUB SUB Seduc_3 () ' 05.04.2014: Rewritten for use with rodo ' we may have to add ctrl.11 for volume control here. ' Singing Rods. ' 13.04.2013: Tested o.k. ' 07.02.2015: Reused for seduction ' Hybr added. STATIC oldnoot, noot, cnt, slnr, noot2, oldnoot2 AS INTEGER LOCAL expantie, kontraktie AS SINGLE IF ISFALSE Task(%Seduc_3).tog THEN IF ISFALSE Task(%Seduc_3).hParam THEN DIM TaskParamLabels(0) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "dS1rodo" ' sensit. for rodo MakeTaskParameterDialog %Seduc_3,1,Slider(),0,UDctrl(),TaskParamLabels() ' 1 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Seduc_3).SliderNumbers(0) Slider(slnr).value = 1 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value END IF MM_Rodo_On MM_Hybr_On MM_Spiro_On ' added 15.05.2016 Controller Rodo.channel, 11, 127 Rodo.ctrl(11) = 127 Controller Rodo.channel, 13, 1 ' note injection ON Rodo.ctrl(13) = 1 mPlay Rodo.channel, 126, 127 ' rotating red light Task(%Seduc_3).tog = %True END IF ' genormaliseerde expantie: expantie = gesture.dS1(3) ' genormaliseerde kontraktie kontraktie =gesture.ds1(4) ' always positive 0-1 ' logfile "exp" + STR$(expantie) INCR cnt IF expantie > (Slider(slnr).value / 127) THEN ' IF noot < rodo.lowtes + (expantie * 62) THEN noot = rodo.lowtes + (expantie * 62) '62 was 31, in welk geval de range te klein bleef ' try to map on something lyrical: IF Rodo.ctrl(11) < 127 THEN Rodo.ctrl(11) = 127 Controller Rodo.channel, 11, 127 END IF IF oldnoot THEN NoteOff Spiro.channel, oldnoot ' 15.05.2016 NoteOff Rodo.channel, oldnoot RESET oldnoot END IF IF noot THEN mPlay Rodo.channel, noot, MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 mPlay Spiro.channel, noot, MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 '15.05.2016 oldnoot =noot RESET noot END IF ELSEIF Rodo.ctrl(11)> 60 THEN 'gebeurt alleen als slider op max staat?? Rodo.ctrl(11) = MAX(0, Rodo.ctrl(11) - 4) logfile "decr" + STR$(rodo.ctrl(11)) controller Rodo.channel, 11, Rodo.ctrl(11) IF Rodo.ctrl(11) < 60 THEN NoteOff Rodo.channel, oldnoot END IF ' hier kunnen we een noot voor Hybr toevoegen... ' in funktie van kontraktie IF kontraktie > (Slider(slnr).value / 127) THEN ' 'IF noot2 < hybr.lowtes + (expantie * 62) THEN noot2 = hybr.lowtes + (expantie * 62) '62 was 31, in welk geval de range te klein bleef ' above is bug: must be kontraktie. Must be tested!!! IF noot2 < hybr.lowtes + (kontraktie * 62) THEN noot2 = hybr.lowtes + (kontraktie * 62) IF Hybr.ctrl(7) < 72 THEN Hybr.ctrl(7) = 72 Controller Hybr.channel, 7, 72 END IF IF oldnoot2 THEN NoteOff Hybr.channel, oldnoot2 : RESET oldnoot2 IF noot2 THEN mPlay Hybr.channel, noot2, MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 oldnoot2 =noot2 RESET noot2 END IF ELSEIF Hybr.ctrl(7)> 60 THEN 'gebeurt alleen als slider op max staat?? Hybr.ctrl(7) = MAX(0, Hybr.ctrl(7) - 4) controller Hybr.channel, 7, Hybr.ctrl(7) IF Hybr.ctrl(7) < 20 THEN NoteOff Hybr.channel, oldnoot2 END IF ' tempo modulatie: Task(%Seduc_3).freq = 1 + (MAX(@pDoppler.xf, @pDoppler.yf, @pDoppler.zf) / 100) ' this works fine. END SUB SUB Seduc_3_Stop () MM_Rodo_Off MM_Hybr_Off MM_Spiro_Off Controller Rodo.channel, 13, %False Controller Hybr.channel, 7, 64 RESET Rodo.ctrl(13) END SUB SUB Seduc_4 () ' using only the third derivative of the surface vectors ' this works very well and is extremely responsive and fast. ' 13.02.2014: Rehearsal with dominica eyckmans ' 07.02.2015: adapted for seduction STATIC noot1, oldnoot1, noot2, oldnoot2, slnr, udnr AS INTEGER IF ISFALSE Task(%Seduc_4).tog THEN IF ISFALSE Task(%Seduc_4).hParam THEN DIM TaskParamLabels(0 TO 3) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "dS3+" ' sensit. for puff TaskParamLabels(1) = "dS3-" ' sensit. for Tubi TaskParamLabels(2) = "0/1" ' on of for puff TaskParamLabels(3) = "0/1" ' on off for tubi MakeTaskParameterDialog %Seduc_4,2,Slider(),2,UDctrl(),TaskParamLabels() ' 2 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Seduc_4).SliderNumbers(0) Slider(slnr).value = 10 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 10 SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value END IF IF ISFALSE udnr THEN udnr = TaskEX(%Seduc_4).UpDownNumbers(0) UDctrl(udnr).cPtr = CODEPTR(Deriv4_Puff_UD) ' proc. in the deriv module! UDctrl(udnr).value = 0 ' off at the start UDctrl(udnr).maxval = 1 UDctrl(udnr).minval = 0 UDctrl(udnr).resetval = 0 UDctrl(udnr+1).cPtr = CODEPTR(Deriv4_Tubi_UD) UDctrl(udnr+1).value = 1 ' on at the start UDctrl(udnr+1).maxval = 1 UDctrl(udnr+1).minval = 0 UDctrl(udnr+1).resetval = 1 END IF MM_Tubi_On MM_Puff_On %MM_Lights Task(%Seduc_4).tog = %True END IF ' test mapping: IF UDctrl(udnr).value THEN IF gesture.ds3(3) > Slider(slnr).value / 128 THEN noot1 = 55 + ( SQR(gesture.ds3(3)) * 36) ' puff IF noot1 <> oldnoot1 THEN IF noot1 < 127 THEN mPlay Puff.channel, noot1, 48 * MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) oldnoot1 = noot1 ELSE logfile "Seduc_4: Midi overflow bug on Puff" END IF END IF ELSE IF oldnoot1 THEN oldnoot1 = %False noot1 = %False END IF END IF END IF IF UDctrl(udnr+1).value THEN ' negative peaks: IF gesture.ds3(4) > Slider(slnr+1).value / 128 THEN noot2 = 72 + (SQR(gesture.ds3(4)) * 36) IF noot2 <> oldnoot2 THEN IF noot2 < 127 THEN mPlay Tubi.channel, noot2, 64 * MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) oldnoot2 = noot2 ELSE logfile "Seduc_4: Midi overflow bug on Tubi" END IF END IF ELSE IF oldnoot2 THEN oldnoot2 = %False noot2 = %False END IF END IF END IF END SUB SUB Seduc_5 () ' based on the derivatives of surface vectors STATIC noot1, noot2, noot3, slnr, cnt1, cnt2, cnt3 AS INTEGER STATIC d1max, d2max,d3max AS SINGLE IF ISFALSE Task(%Seduc_5).tog THEN IF ISFALSE Task(%Seduc_5).hParam THEN DIM TaskParamLabels(0 TO 2) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "dS1" ' sensit. Bomi TaskParamLabels(1) = "dS2" ' sensit. for Piperola TaskParamLabels(2) = "dS3" ' sensit for Hybr MakeTaskParameterDialog %Seduc_5,3,Slider(),0,UDctrl(),TaskParamLabels() ' 3 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Seduc_5).SliderNumbers(0) Slider(slnr).value = 10 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 20 SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value slider(slnr+2).value = 20 SendMessage Slider(slnr+2).h, %TBM_SETPOS,%True, Slider(slnr+2).value END IF 'logfile "Testing gesture derivatives" 'MM_Qt_On MM_Hybr_On MM_Piperola_On MM_Bomi_On Task(%Seduc_5).tog = %True END IF ' first derivative mapped on Bomi IF gesture.dS1(3) > slider(slnr).value / 128 THEN IF gesture.dS1(3) >= 1 THEN INCR cnt1 'gesture.dS1Scalefactor = gesture.dS1Scalefactor * 0.9 - do not change this anymore. Now set at 24 ' was 22.5 'logfile "d1 scaling = " & STR$(gesture.dS1Scalefactor) & " clipping to 1 " & STR$(cnt1) & "th time" RESET d1max END IF IF gesture.dS1(3) > d1max THEN 'logfile "gesture.dS1(3)= " & STR$(gesture.dS1(3)) & " scaling= " & STR$(gesture.dS1Scalefactor) d1max = gesture.dS1(3) END IF IF noot1 THEN NoteOff Bomi.channel, noot1 noot1 = %False END IF noot1 = bomi.lowtes + (SQR(gesture.dS1(3)- (slider(slnr).value/ 128)) * 36) mPlay Bomi.channel, noot1, 36 ELSE IF noot1 THEN NoteOff Bomi.channel, noot1 RESET noot1 END IF END IF ' second derivative mapped on Piperola (On HybrHi, when ready...) IF gesture.dS2(3) > slider(slnr+1).value / 128 THEN IF gesture.dS2(3) >= 1 THEN INCR cnt2 'logfile "d2 scaling = " & STR$(gesture.dS2Scalefactor) & " clipping to 1 " & STR$(cnt2) & "th time" 'gesture.dS2Scalefactor *= 0.9 'logfile "d2 scaling = " & STR$(gesture.dS2Scalefactor) RESET d2max END IF IF gesture.dS2(3) > d2max THEN 'logfile "gesture.dS2(3)= " & STR$(gesture.dS2(3)) & " scaling= " & STR$(gesture.dS2Scalefactor) d2max = gesture.dS2(3) END IF IF noot2 THEN NoteOff Piperola.channel, noot2 noot2 = %False END IF noot2 = Piperola.lowtes + (SQR(gesture.dS2(3)- (slider(slnr+1).value/128)) * 36) mPlay Piperola.channel, noot2, 64 ELSE IF noot2 THEN mPlay Piperola.channel, noot2, %False RESET noot2 END IF END IF ' third derivative mapped op Hybr IF gesture.dS3(3) > slider(slnr+2).value / 128 THEN IF gesture.dS3(3) >= 1 THEN INCR cnt3 'logfile "d3 scaling = " & STR$(gesture.dS3Scalefactor) & " clipping to 1 " & STR$(cnt3) & "th time" RESET d3max END IF IF gesture.dS3(3) > d3max THEN 'logfile "gesture.dS3(3)= " & STR$(gesture.dS3(3)) & " scaling= " & STR$(gesture.dS3Scalefactor) d3max = gesture.dS3(3) END IF IF noot3 THEN mPlay Hybr.channel, noot3, %False noot3 = %False END IF noot3 = Hybr.lowtes + (SQR(gesture.dS3(3) - (slider(slnr+2).value / 128)) * 60) mPlay Hybr.channel, noot3, 127 * MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) ELSE IF noot3 THEN mPlay Hybr.channel, noot3, %False RESET noot3 END IF END IF END SUB SUB Seduc_5_stop () MM_Hybr_Off %MM_Notes ' also services HybrHi MM_Bomi_Off %MM_Notes OR %MM_Wind MM_Piperola_Off %MM_Notes OR %MM_Wind END SUB SUB HybrLo_6 () ' 14.09.2016: adapted for use on HybrLo ' 16.10.2016: Controllers added. ' 17.10.2016: Rehearsal with Dominica STATIC xtrig, xnoot, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%HybrLo_6).tog THEN IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser sens = 1 ' send controllers for HybrLo: Controller Hybrlo.channel, 66, 64 Controller HybrLo.channel, 7, 78 Controller HybrLo.channel, 17, 5 Controller HybrLo.channel, 18, 6 Controller HybrLo.channel, 15, 30 Controller HybrLo.channel, 1, 25 MM_HybrLo_On %MM_White Task(%HybrLo_6).tog = %True END IF ' we map edgyness/ smoothness on the waveform IF gesture.edgy(3) THEN Controller HybrLo.channel, 15, 64 - (gesture.edgy(3) * 63) ' hoe mee edgy hoe scherper de klank... ELSEIF gesture.smooth(3) THEN Controller HybrLo.channel, 15, 64 + (gesture.smooth(3) * 63) END IF ' and sustain on body surface Controller HybrLo.channel, 7, 20 + (gesture.flue_val(3) * 100) ' on accelerating body speed, do hybrlo... IF gesture.speedup(3) > gesture.slowdown(3) + sens THEN IF ISFALSE xtrig THEN xnoot = MIN(HybrLo.lowtes - sens + (gesture.speedup(3)* .50), 69) ' multiplier was 1.5, changed to 1 (12.01.2015) xnoot = MAX(MIN(xnoot,69),HybrLo.lowtes) mPlay HybrLo.channel,xnoot, MIN(gesture.speedup_val(3) , 127) xtrig = %True END IF ELSE RESET xtrig IF xnoot THEN Release HybrLo.channel, xnoot, (@pDoppler.xa + @pDoppler.ya + @pDoppler.za) * 42 ' 0-126 RESET xnoot END IF END IF IF Gesture.speedup(3) > (sens * 10) THEN IF ISFALSE lites THEN MM_HybrLo_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_HybrLo_Off %MM_Lights RESET lites END IF END IF END SUB SUB HybrLo_6_Stop () Controller HybrLo.channel, 123, 83 END SUB SUB HybrLo_0 () ' 17.10.2016: added as an intro for the HybrLo namuda study STATIC xnoot, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%HybrLo_0).tog THEN IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser sens = 1 ' send controllers for HybrLo: Controller Hybrlo.channel, 66, 64 ProgChange Hybrlo.channel, 0 ' Controller HybrLo.channel, 7, 78 ' Controller HybrLo.channel, 17, 5 ' Controller HybrLo.channel, 18, 6 ' Controller HybrLo.channel, 15, 30 ' Controller HybrLo.channel, 1, 25 ' MM_HybrLo_On %MM_White Task(%HybrLo_0).tog = %True END IF ' we map edgyness/ smoothness on the waveform ' If gesture.flue_val(3) > sens then IF ISFALSE xnoot THEN mPlay HybrLo.channel, 22, 64 xnoot = 22 END IF ' else ' Release HybrLo.channel, 22, 120 ' reset xnoot ' end if IF xnoot THEN ' and sustain on body surface Controller HybrLo.channel, 70, MIN(127,SQR(gesture.flue_val(3)) * 160) END IF IF Gesture.speedup(3) > (sens * 3) THEN IF ISFALSE lites THEN MM_HybrLo_On %MM_White lites = %True END IF ELSE IF lites THEN MM_HybrLo_Off %MM_White RESET lites END IF END IF END SUB SUB HybrLo_0_Stop () 'Controller HybrLo.channel, 123, 83 - hoeft niet IF ISFALSE Task(%HybrLo_6).tog THEN StartTask %HybrLo_6 END SUB