'************************************* '* Code for Namuda Study #38 * '* september 2013 * '* "Whispered Questions" * '************************************* ' 10.09.2013: Start coding and first testing ' 14.09.2013: Extensive trimming debug and adjusting session ' 15.09.2013: Rehearsal session with Dominica Eyckmans. ' some bugs removed... ' 18.09.2013: Premiere. ' 10.11.2013: still to do: add procedure for the jingle bells on whisper... ' 14.03.2015: Parts of this coding recycled for Namuda Study #52 Tumult ' 19.12.2019: Performed again with Emilie De Vlam ' robots that can be used in this piece: ' * ' * ' * ' * ' ' ' * ' ' * ' * ' * 'TYPE UniSonsType DWORD ' note AS INTEGER ' common note for all tasks in unisons (not used here) ' normbody AS SINGLE ' normspeed AS SINGLE ' wind AS SINGLE ' highly integrated normbody, for wind ctrl. ' vol AS SINGLE ' faster normbody integration for volume ctrl. on monophonic wind instruments. 'END TYPE ' 'GLOBAL Uni AS UnisonsType ' we reuse this one here!, its declared global in Uni.inc %Whispers_Meta = 32 %Whispers_Whisper = 33 %Whispers_Shakers = 34 %Whispers_Temblo = 35 %Whispers_Psch = 36 %Whispers_TW = 37 %Whispers_Dripper = 38 %Whispers_Casta = 39 %Whispers_Lotto = 40 %Whispers_Hybr = 42 ' for Namuda #52 %Whispers_Belly = 43 %Whispers_Vacca = 44 %Whispers_Jump = 45 %Whispers_Llor = 46 %Whispers_Simba = 47 DECLARE SUB Init_Whispers () DECLARE SUB Whispers_Meta () DECLARE SUB Whispers_Whisper () ' on speedup DECLARE SUB Whispers_Whisper_Stop () DECLARE SUB Whispers_Shakers () ' on slowdown DECLARE SUB Whispers_Shakers_Stop () DECLARE SUB Whispers_Temblo () ' on edgy-smooth DECLARE SUB Whispers_Psch () ' on collission DECLARE SUB Whispers_TW () ' on explosion DECLARE SUB Whispers_Dripper () ' on implosion DECLARE SUB Whispers_Lotto () DECLARE SUB Whispers_Lotto_End () DECLARE SUB Whispers_Hybr () ' on implosion DECLARE SUB Whispers_Belly () DECLARE SUB Whispers_Vacca () DECLARE SUB Whispers_Jump () DECLARE SUB Whispers_Llor () ' on collision DECLARE SUB Whispers_Simba () ' on exploding SUB Init_Whispers () ClearTasks Task(%Whispers_Meta).naam = "WhiMeta" Task(%Whispers_Meta).freq = 12 Task(%Whispers_Meta).cptr = CODEPTR(Whispers_Meta) Task(%Whispers_Meta).flags = %False TaskEX(%Whispers_Meta).StopCptr = CODEPTR(Whispers_Meta_End) Task(%Whispers_Whisper).naam = "Whisper" Task(%Whispers_Whisper).freq = 129 Task(%Whispers_Whisper).cptr = CODEPTR(Whispers_Whisper) Task(%Whispers_Whisper).flags = %PERTIM_TASK '%False TaskEX(%Whispers_Whisper).StopCptr = CODEPTR(Whispers_Whisper_Stop) Task(%Whispers_Shakers).naam = "Shakers" Task(%Whispers_Shakers).freq = 128 Task(%Whispers_Shakers).cptr = CODEPTR(Whispers_Shakers) Task(%Whispers_Shakers).flags = %PERTIM_TASK '%False TaskEX(%Whispers_Shakers).StopCptr = CODEPTR(Whispers_Shakers_Stop) Task(%Whispers_Temblo).naam = "Temblo" Task(%Whispers_Temblo).freq = 8 ' ? Task(%Whispers_Temblo).cptr = CODEPTR(Whispers_Temblo) Task(%Whispers_Temblo).flags = %False Task(%Whispers_Psch).naam = "Psch" Task(%Whispers_Psch).freq = 256 Task(%Whispers_Psch).cptr = CODEPTR(Whispers_Psch) Task(%Whispers_Psch).flags = %False 'TaskEX(%Whispers_Psch).StopCptr = CODEPTR(Whispers_Psch_End) Task(%Whispers_TW).naam = "Thunder" Task(%Whispers_TW).freq = 256 Task(%Whispers_TW).cptr = CODEPTR(Whispers_TW) Task(%Whispers_TW).flags = %False 'TaskEX(%Whispers_TW).StopCptr = CODEPTR(Whispers_TW_End) Task(%Whispers_Dripper).naam = "Dripper" Task(%Whispers_Dripper).freq = 120 Task(%Whispers_Dripper).cptr = CODEPTR(Whispers_Dripper) Task(%Whispers_Dripper).flags = %False Task(%Whispers_Casta).naam = "Casta" Task(%Whispers_Casta).freq = 100 Task(%Whispers_Casta).cptr = CODEPTR(Whispers_Casta) Task(%Whispers_Casta).flags = %False Task(%Whispers_Lotto).naam = "Lotto" Task(%Whispers_Lotto).freq = 12 Task(%Whispers_Lotto).cptr = CODEPTR(Whispers_Lotto) Task(%Whispers_Lotto).flags = %False TaskEX(%Whispers_Lotto).StopCptr = CODEPTR(Whispers_Lotto_End) Task(%Whispers_Hybr).naam = "Hybr" Task(%Whispers_Hybr).freq = 100 Task(%Whispers_Hybr).cptr = CODEPTR(Whispers_Hybr) Task(%Whispers_Hybr).flags = %False Task(%Whispers_Belly).naam = "Belly" Task(%Whispers_Belly).freq = 10 Task(%Whispers_Belly).cptr = CODEPTR(Whispers_Belly) Task(%Whispers_Belly).flags = %False Task(%Whispers_Vacca).naam = "Vacca" Task(%Whispers_Vacca).freq = 20 Task(%Whispers_Vacca).cptr = CODEPTR(Whispers_Vacca) Task(%Whispers_Vacca).flags = %False Task(%Whispers_Jump).naam = "Jump" ' snar en troms Task(%Whispers_Jump).freq = 50 Task(%Whispers_Jump).cptr = CODEPTR(Whispers_Jump) Task(%Whispers_Jump).flags = %False TaskEX(%Whispers_Jump).StopCptr = CODEPTR(Whispers_Jump_Stop) Task(%Whispers_Llor).naam = "Llor" ' snar en troms Task(%Whispers_Llor).freq = 20 Task(%Whispers_Llor).cptr = CODEPTR(Whispers_Llor) Task(%Whispers_Llor).flags = %False Task(%Whispers_Simba).naam = "Simba" ' met springers, troms en klung Task(%Whispers_Simba).freq = 120 Task(%Whispers_Simba).cptr = CODEPTR(Whispers_Simba) Task(%Whispers_Simba).flags = %False MM_Krum_Off MM_Qt_Off MM_HarmO_Off %MM_Motor MM_Harma_Off %MM_Motor IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser MM_Temblo_On MM_Hybr_On END SUB SUB Whispers_Meta () STATIC cnt, dur, t AS DWORD IF ISFALSE Task(%Whispers_Meta).tog THEN 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser uni.note = 60 ' not used here. RESET cnt, dur t = TimeGetTime uni.vol = gesture.flue_val(3) logfile "Namuda #38 start at:" & TIME$ Task(%Whispers_Meta).tog = %True END IF dur = (TimeGetTime - t)/ 1000 ' in seconds uni.normbody = gesture.flue_val(3) uni.normspeed = 1 + MAX( MIN (gesture.fixspeed_val(3) / 100, 2), 0) ' loopt tussen 1 en 3 uni.wind = ((uni.wind * 31) + gesture.flue_val(3))/ 32 ' normalized uni.vol = ((uni.vol * 3) + gesture.flue_val(3))/4 ' more responsive for the volume controllers ' plaats voor scoring hier... END SUB SUB Whispers_Whisper () ' 14.09.2013: This coding uses extensive modulation of the sound with the keypress command. ' The inertia of the motors will be the limiting factor for responsiveness. STATIC xtrig, ytrig, ztrig, trig, xnoot, ynoot, znoot, xvel, yvel, zvel AS LONG STATIC sens AS SINGLE LOCAL velo AS LONG IF ISFALSE Task(%Whispers_Whisper).tog THEN sens = 18 MM_Whisper_On 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Whispers_Whisper).tog = %True END IF ' on accelerating body speed ' X-vektor: ' sens = Slider(slnr).value ' frequency is unipolar data, not normalized 'velo = MIN(127, 64 + (MAX( @pDoppler.xa * 127 , uni.vol* 127))) velo = 95 + (MAX(uni.vol * 32, @pDoppler.xa * 32)) IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF ISFALSE xtrig THEN xnoot = MIN(72 + (gesture.speedup(0) / 4),80) IF xnoot <> ynoot AND xnoot <> znoot THEN mPlay Whisper.channel, xnoot, velo xtrig = %True xvel = velo ELSE DO INCR xnoot IF xnoot > 80 THEN xnoot = 72 LOOP UNTIL xnoot <> ynoot AND xnoot <> znoot mPlay Whisper.channel, xnoot, velo xtrig = %True xvel = velo END IF ELSE IF velo <> xvel THEN Keypress Whisper.channel, xnoot, velo xvel = velo END IF END IF ELSE 'RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN NoteOff Whisper.channel, xnoot RESET xnoot, xtrig, xvel ELSE IF velo <> xvel THEN KeyPress Whisper.channel, xnoot, velo xvel = velo END IF END IF ELSE RESET xtrig, xvel END IF END IF 'velo = MIN(127, 64 + (MAX( @pDoppler.ya * 127 , uni.vol* 127))) velo = 95 + (MAX(uni.vol * 32, @pDoppler.ya * 32)) IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN ynoot = MIN(72 + (gesture.speedup(1) / 4),80) IF ynoot <> xnoot AND ynoot <> znoot THEN mPlay Whisper.channel, ynoot, velo ytrig = %true yvel = velo ELSE DO INCR ynoot IF ynoot > 80 THEN ynoot = 72 LOOP UNTIL ynoot <> xnoot AND ynoot <> znoot mPlay Whisper.channel, ynoot, velo ytrig = %true yvel = velo END IF ELSE IF velo <> yvel THEN Keypress Whisper.channel, ynoot, velo yvel = velo END IF END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN mPlay Whisper.channel, ynoot, %False RESET ynoot, yvel, ytrig ELSE IF velo <> yvel THEN Keypress Whisper.channel, ynoot, velo yvel = velo END IF END IF ELSE RESET ytrig , yvel END IF END IF 'velo = MIN(127,64 + (MAX( @pDoppler.za * 127 , uni.vol* 127))) velo = 95 + (MAX(uni.vol * 32, @pDoppler.za * 32)) IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN IF ISFALSE ztrig THEN znoot = MIN(72 + (gesture.speedup(2) / 4),80) IF znoot <> xnoot AND znoot <> ynoot THEN mPlay Whisper.channel, znoot, velo ztrig = %True zvel = velo ELSE DO INCR znoot IF znoot > 80 THEN znoot = 72 LOOP UNTIL znoot <> xnoot AND znoot <> ynoot END IF mPlay Whisper.channel, znoot, velo ztrig = %True zvel = velo ELSE IF velo <> zvel THEN Keypress Whisper.channel, znoot, velo zvel = velo END IF END IF ELSE IF znoot THEN IF ISFALSE gesture.speedup_dur(2) THEN mPlay Whisper.channel, znoot, %False RESET znoot, ztrig, zvel ELSE IF velo <> zvel THEN Keypress Whisper.channel, znoot,velo zvel = velo END IF END IF ELSE RESET ztrig END IF END IF IF Gesture.speedup(3) > (sens * 10) THEN 'was * 6 IF gesture.speedup(3) > (gesture.slowdown(3) + (sens * 4)) THEN IF ISFALSE trig THEN PlayDur Whisper.channel, 81, MIN(@pDoppler.zf , 127), 500 ' rubbed string trig = Timegettime + 500 ELSE Keypress Whisper.channel, 81,MIN(@pDoppler.zf , 127) END IF END IF ELSE IF Trig THEN IF TimegetTime > trig THEN RESET Trig ELSE Keypress Whisper.channel, 81,MIN(@pDoppler.zf , 127) END IF END IF END IF END SUB SUB Whispers_Whisper_Stop () Controller Whisper.channel, 123, 85 END SUB SUB Whispers_Meta_End () IF Task(%Whispers_Temblo).tog THEN Stoptask %Whispers_Temblo IF Task(%Whispers_Whisper).tog THEN stoptask %Whispers_Whisper IF Task(%Whispers_TW).tog THEN stoptask %Whispers_TW IF Task(%Whispers_Psch).tog THEN stoptask %Whispers_Psch IF Task(%Whispers_Dripper).tog THEN stoptask %Whispers_Dripper IF task(%Whispers_Casta).tog THEN stoptask %Whispers_Casta IF task(%Whispers_Lotto).tog THEN stoptask %Whispers_Lotto IF Task(%Whispers_Shakers).tog THEN stoptask %Whispers_Shakers logfile "Namuda #38 - Whispers- stop at" & TIME$ END SUB SUB Whispers_Shakers () ' 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 (Links) ' recoded for Whisper 10.09.2013 ' 14.09.2014: scaling checked and optimized 'STATIC slnr AS DWORD STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, lites, xvel, yvel, zvel AS WORD STATIC sens AS SINGLE LOCAL velo AS LONG IF ISFALSE Task(%Whispers_Shakers).tog THEN sens = 12 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Whispers_Shakers).tog = %True END IF 'sens = Slider(slnr).value / 2 velo = 95 + (uni.vol * 32) '63 + (uni.vol * 64) IF Gesture.slowdown(0) > sens THEN ' frequency is unipolar data! - under algo1, can go up to 230 IF ISFALSE xtrig THEN xnoot = 83 mPlay Whisper.channel, xnoot,velo xtrig = %True xvel = velo ELSE IF velo <> xvel THEN Keypress Whisper.channel, xnoot, velo ' shaking speed modulation xvel = velo END IF END IF ELSE IF xtrig THEN IF xnoot THEN NoteOff Whisper.channel, xnoot RESET xnoot, xvel END IF END IF RESET xtrig END IF IF Gesture.slowdown(1) > sens THEN IF ISFALSE ytrig THEN ynoot = 84 mPlay Whisper.channel, ynoot, velo ytrig = %true yvel = velo ELSE IF velo <> yvel THEN KeyPress Whisper.channel, ynoot, velo yvel = velo END IF END IF ELSE IF ytrig THEN IF ynoot THEN NoteOff Whisper.channel, ynoot RESET ynoot, yvel END IF END IF RESET ytrig END IF IF Gesture.slowdown(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers znoot = 85 mPlay Whisper.channel, znoot, velo ztrig = %True zvel = velo ELSE IF velo <> zvel THEN KeyPress Whisper.channel, znoot, velo zvel = velo END IF END IF ELSE IF ztrig THEN IF znoot THEN NoteOff Whisper.channel, znoot RESET znoot, zvel 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_Whisper_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Whisper_Off %MM_Lights RESET lites END IF END IF END SUB SUB Whispers_Shakers_Stop () NoteOff Whisper.channel, 83 NoteOff Whisper.channel, 84 NoteOff Whisper.channel, 85 MM_Whisper_Off %MM_Lights END SUB SUB Whispers_Temblo () ' edgy-smooth on temblo ' copied from springs for use in Study #38 STATIC edgy, smooth, ratchet AS LONG LOCAL noot1,noot2,noot3 AS LONG IF ISFALSE Task(%Whispers_Temblo).tog THEN MM_Temblo_On Task(%Whispers_Temblo).tog = %True END IF ' modulation in function of edgy-smooth properties IF gesture.edgy_dur(3) THEN 'if edgy, we select the high blocks noot1 = MIN(72 + (gesture.edgy(0) *12), 77) ' logfile "noot"+ STR$(noot1) + STR$(@pDoppler.xa * 127)+ STR$(@pDoppler.ya * 127)+ STR$(@pDoppler.za * 127) noot2 = MIN(72 + (gesture.edgy(1) * 12), 77) noot3 = MIN(72 + (gesture.edgy(2) * 12), 77) addnote2har Temblo.har(1), noot1, (@pDoppler.xa * 120) addnote2har Temblo.har(1), noot2, (@pDoppler.ya * 120) addnote2har Temblo.har(1), noot3, (@pDoppler.za * 120) Instrumplay Temblo edgy = %True ELSE edgy = %False 'note off's not required on Temblo END IF IF gesture.smooth_dur(3) THEN ' if smooth we select the low blocks addnote2har Temblo.har(1), MIN(60 + (gesture.smooth(0) * 12), 65), MIN(127, @pDoppler.xa * 180) addnote2har Temblo.har(1), MIN(60 + (gesture.smooth(1) * 12), 65), MIN(127, @pDoppler.ya * 180) addnote2har Temblo.har(1), MIN(60 + (gesture.smooth(2) * 12), 65), MIN(127, @pDoppler.za * 180) instrumplay Temblo smooth = %True ELSE smooth = %False END IF IF ISFALSE edgy AND ISFALSE smooth THEN 'ratchet mPlay Temblo.channel, 69, MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 ratchet = %True ELSE IF ratchet THEN NoteOff Temblo.channel, 69 RESET ratchet END IF END IF Task(%Whispers_Temblo).freq = 4 * uni.normspeed END SUB SUB Whispers_Psch () 'originally for Zwiep en Zwaai 'based on: Domi_Collision_Trig () ' collision detector ' here we look only into the acceleration data in order to detect collisions. ' the task frequency is 256Hz ' reused in Namuda study #38 STATIC xtrig, ytrig, ztrig, strig, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Whispers_Psch).tog THEN 'start gesture analyser!!! IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser RESET lites sens = 1.4 '14/10 Task(%Whispers_Psch).tog = %True END IF ' on collision, do something... ' sens = Slider(slnr).value / 10 IF Gesture.collision(0) > sens THEN IF ISFALSE xtrig THEN 'mPlay Troms.channel, MIN(24 + ((Gesture.collision(0))*4),48), MIN(Gesture.impact(0) * 127,127) mPlay Snar.channel, 73 + RND(1), MIN(Gesture.impact(0) * 127, 127) ' should be alternating 73-74 xtrig = %True END IF ELSE RESET xtrig END IF IF Gesture.collision(1) > sens THEN IF ISFALSE ytrig THEN 'mPlay Vacca.channel, MIN(48 + ((Gesture.collision(1)) *8),88), MIN(Gesture.impact(1) * 127, 127) mPlay Psch.channel, MIN(72 + ((Gesture.collision(1))*3),83), MIN(Gesture.impact(1) * 160, 127) ytrig = %true END IF ELSE RESET ytrig END IF IF Gesture.collision(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers on the same collision 'mPlay Thunderwood.channel, MIN(1 + ((Gesture.collision(2))*4),14), MIN(Gesture.impact(2) * 150, 127) mPlay Psch.channel, MIN(72 + ((Gesture.collision(2))*3),83), MIN(Gesture.impact(2) * 160, 127) ztrig = %True END IF ELSE RESET ztrig END IF 'added 17.04.2010 IF gesture.collision(3) THEN IF ISFALSE lites THEN 'licht MM_So_On %MM_White MM_Troms_On %MM_Lights MM_Heli_On %MM_Lights lites = %True END IF IF gesture.collision(3) > sens THEN 'added 13.05 IF ISFALSE strig THEN ' mPlay Troms.channel, 48,MIN(Gesture.impact(3) * 180, 127) 'cimbaal strig = %True END IF END IF ELSE IF lites THEN 'licht uit. MM_So_Off %MM_White MM_Troms_Off %MM_Lights MM_Heli_Off %MM_Lights RESET lites END IF IF strig THEN IF gesture.collision(3) > sens THEN RESET strig END IF END IF END IF END SUB SUB Whispers_TW () ' Thunderwood & Springers ' alternative property naming: Grow, expand, enlarge STATIC xtrig, ytrig, ztrig, lites AS LONG STATIC od AS SINGLE LOCAL d AS SINGLE STATIC sens AS SINGLE IF ISFALSE Task(%Whispers_TW).tog THEN sens = 0.1 RESET xtrig, ytrig, ztrig, lites MM_Thunderwood_On MM_Springers_On IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Whispers_TW).tog = %True EXIT SUB END IF ' on increasing body surface (exploding, growing, expanding), do something... IF (ISFALSE gesture.implo(0)) AND (gesture.explo(0)> @pDoppler.noise) THEN 'dur condition makes no sense as it is always fullfilled. IF gesture.explo_dur(0) MOD 10 = 1 THEN mPlay Klung.channel, MIN(Klung.lowtes + (gesture.explo(0)* 100), Klung.Hightes), MIN(gesture.explo_val(0) * 127, 127) END IF END IF IF (ISFALSE gesture.implo(1)) AND (gesture.explo(1) > @pDoppler.noise) THEN IF gesture.explo_dur(1) MOD 16 = 1 THEN 'mPlay Simba.channel, MIN(77 + (gesture.explo(1) * 5),80) , MIN((gesture.explo_val(1) ^ 1.5) * 127 , 127 ) mPlay Thunderwood.channel, 24, MIN((gesture.explo_val(1) ^ 1.5) * 127 , 127 ) ytrig = %True END IF ELSE IF ytrig THEN mPlay Thunderwood.channel, 24, %False yTrig = %False END IF END IF IF (ISFALSE gesture.implo(2)) AND (gesture.explo(2)> @pDoppler.noise) THEN 'still too sensitive. SELECT CASE gesture.explo_dur(2) 'units are 3.9ms CASE 1 TO 3 'shaker1 mPlay Springers.channel,72, MIN((gesture.explo_val(2)) * 255, 127) CASE 4 TO 6 'shaker2 mPlay Springers.channel, 79,MIN((gesture.explo_val(2)) * 255, 127) CASE 7 TO 10 'shaker 1 back mPlay Springers.channel, 73,MIN((gesture.explo_val(2)) * 255, 127) CASE 11 TO 14 'springer 1 mPlay Springers.channel, 36,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 15 TO 19 '8 'shaker 2 back mPlay Springers.channel, 80,MIN((gesture.explo_val(2)) * 255, 127) CASE 20 TO 25 '10 'springer 2 mPlay Springers.channel, 37,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 26 TO 32 '15 'springer 3 mPlay Springers.channel, 38,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 33 TO 39 '21 'springer 4 mPlay Springers.channel, 39,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 40 TO 47 '28 'springer 5 mPlay Springers.channel, 40,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 48 TO 54 '35 to 45 '(> 35) and (<= 45) 'blue flashlight Controller Springers.channel, 70, MIN((gesture.explo_val(2)) * 127, 127) ztrig = %True CASE > 54 '200ms - still happens very often! 'siren '' mPlay Springers.channel, 24,MIN((gesture.explo_val(2)) * 127, 120) '' ztrig = %True END SELECT ELSE IF ztrig THEN ' mPlay Springers.channel, 24, %False 'sirene uit Controller Springers.channel, 70, %False 'zwaailicht END IF RESET ztrig END IF END SUB SUB Whispers_TW_Off () MM_Thunderwood_Off MM_Springers_Off END SUB SUB Whispers_Dripper () ' here we look only into the surface data in order to detect sudden shrinking (imploding gesture) ' 25.04.2010: highly improved now. ' 14.09.2014: Remapped on dripper for Namuda Study #38 . Original source in Links. STATIC lites AS LONG LOCAL xnoot, ynoot, znoot AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Whispers_Dripper).tog THEN sens = 0.001 '@pDoppler.noise '* 3 RESET lites IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Whispers_Dripper).tog = %True EXIT SUB END IF ' on decreasing body surface (shrinking), rain... IF (ISFALSE(gesture.explo(0))) AND (gesture.implo(0)> @pDoppler.noise) THEN xnoot = (gesture.implo(0) * 256) MOD 4 mPlay Dripper.channel,xnoot , MIN((gesture.implo_val(0)^2) * 64,63) END IF IF (ISFALSE(gesture.explo(1))) AND (gesture.implo(1)> @pDoppler.noise ) THEN ynoot = (gesture.implo(1) * 256) MOD 4 ynoot += 4 mPlay Dripper.channel, ynoot, MIN(gesture.implo_val(1) * 60, 127) END IF IF (ISFALSE(gesture.explo(2))) AND (gesture.implo(2)> @pDoppler.noise ) THEN znoot = (gesture.implo(2) * 256) MOD 4 znoot += 8 mPlay Dripper.channel,znoot, MIN((gesture.implo_val(2)^2) * 63, 64) END IF IF gesture.implo(3) > gesture.explo(3) THEN IF ISFALSE lites THEN MM_Sire_On %MM_Red MM_Temblo_On %MM_Red lites = %True END IF ELSE IF lites THEN MM_Temblo_Off %MM_Red MM_Sire_Off %MM_Red RESET lites END IF END IF END SUB SUB Whispers_Casta () ' 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. ' 14.09.2013: copied from Links-code and remapped on Casta for Namuda Study #38 ' modified such that the casta's play as long as the property stays set. STATIC lites AS DWORD STATIC xtrig, ytrig, ztrig, tog AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Whispers_Casta).tog THEN sens = 1.0 'start gesture_analyser IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%Whispers_Casta).tog = %True END IF ' on theatrical collision, do casta... IF gesture.theacol(0) > sens THEN mPlay Casta2.channel, 112 + xtrig, MIN(gesture.impact(0) * 127,127) INCR xtrig IF xtrig > 7 THEN RESET xtrig xtrig = %True ELSE RESET xtrig END IF IF gesture.theacol(1) > sens THEN mPlay Casta2.channel, 120 + ytrig, MIN(gesture.impact(1) * 127,127) INCR ytrig IF ytrig > 7 THEN RESET ytrig ELSE RESET ytrig END IF IF gesture.theacol(2) > sens THEN ' Casta Uno will play as long as the property stays true. ' multiple triggers on the same collision INCR ztrig IF ztrig > 14 THEN RESET ztrig mPlay Casta.channel, 113 + ztrig, MIN(gesture.impact(2) * 127,127) ELSE RESET ztrig END IF IF gesture.theacol(3) > (sens * 4) THEN ' with *2 it happens too often, with *5 is never happens. ' with *4 is does happen, but rarely. That's ok for here. mPlay Simba.channel, 78 + tog, MIN(gesture.impact(3) * 127,127) ' alternerend, grote castagnetten INCR tog tog = tog MOD 2 IF ISFALSE lites THEN MM_Simba_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Simba_Off %MM_Lights RESET lites END IF END IF END SUB SUB Whispers_Lotto () ' added 15.09.2013 ' lotto cage = note 82 IF ISFALSE Task(%Whispers_Lotto).tog THEN mPlay Whisper.channel, 82, 127 ' start at full speed. Task(%Whispers_Lotto).tog = %True END IF ' speed modulation KeyPress Whisper.channel, 82, 64 + (uni.vol * 63) END SUB SUB Whispers_Lotto_End () NoteOff Whisper.channel, 82 END SUB SUB Whispers_Hybr () ' here we look only into the surface data in order to detect sudden shrinking (imploding gesture) ' 25.04.2010: highly improved now. ' 14.09.2014: Remapped on dripper for Namuda Study #38 . Original source in Links. ' 14.03.2015: Remapped for Hybr, Namuda study #52 STATIC lites AS LONG LOCAL xnoot, ynoot, znoot AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Whispers_Hybr).tog THEN sens = 0.001 '@pDoppler.noise '* 3 RESET lites 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Whispers_Hybr).tog = %True EXIT SUB END IF ' on decreasing body surface (shrinking), hybr plofjes IF (ISFALSE(gesture.explo(0))) AND (gesture.implo(0)> @pDoppler.noise) THEN xnoot = Hybr.lowtes+ (gesture.implo(0) * 64) '256) MOD 64 PlayDur Hybr.channel,xnoot , MIN((gesture.implo_val(0)^2) * 127,120), 50 END IF IF (ISFALSE(gesture.explo(1))) AND (gesture.implo(1)> @pDoppler.noise ) THEN ynoot = Hybr.lowtes+ (gesture.implo(1) * 64) PlayDur Hybr.channel, ynoot, MIN(gesture.implo_val(1) * 127, 120), 50 END IF IF (ISFALSE(gesture.explo(2))) AND (gesture.implo(2)> @pDoppler.noise ) THEN znoot = Hybr.lowtes+ (gesture.implo(2) * 64) PlayDur Hybr.channel,znoot, MIN((gesture.implo_val(2)^2) * 127, 120), 50 END IF IF gesture.implo(3) > gesture.explo(3) THEN IF ISFALSE lites THEN MM_Sire_On %MM_Red MM_Temblo_On %MM_Red MM_Hybr_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Temblo_Off %MM_Red MM_Sire_Off %MM_Red MM_Hybr_Off %MM_Lights RESET lites END IF END IF END SUB SUB Whispers_Belly () ' 11.04.2015: bug discovered here and killed... IF ISFALSE Task(%Whispers_Belly).tog THEN MM_Belly_On Task(%Whispers_Belly).tog = %True END IF IF Gesture.Edgy(0) > Gesture.Smooth(0) * 1.2 THEN mPlay Belly.channel, MAX(Belly.LowTes, Belly.HighTes - @pDoppler.xf/10), @pDoppler.xa* 80 IF Gesture.Edgy(1) > Gesture.Smooth(1) * 1.2 THEN mPlay Belly.channel, MAX(Belly.LowTes, Belly.HighTes - @pDoppler.yf/10), @pDoppler.ya* 80 IF Gesture.Edgy(2) > Gesture.Smooth(2) * 1.2 THEN mPlay Belly.channel, MAX(Belly.LowTes, Belly.HighTes - @pDoppler.zf/10), @pDoppler.za* 80 Task(%Whispers_belly).freq = uni.normspeed ' 1-3 END SUB SUB Whispers_Vacca () STATIC sens AS INTEGER IF ISFALSE Task(%Whispers_Vacca).tog THEN MM_Vacca_On Task(%Whispers_Vacca).tog = %True END IF IF ISFALSE sens THEN sens = 10 END IF IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN mPlay Vacca.channel, Vacca.HighTes - @pDoppler.xf/6, @pDoppler.xa * 100 END IF IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN mPlay Vacca.channel, Vacca.HighTes - @pDoppler.yf/6, @pDoppler.ya * 100 END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN mPlay Vacca.channel, Vacca.HighTes - @pDoppler.zf/6, @pDoppler.za * 100 END IF END SUB SUB Whispers_jump () ' based on Domi_Jump_Trig () '12.05.2010 evaluation for gesture.airborne property '13.05.2010 Fine tuning session and research ' turned into an etude for the airborne gesture prototype ' robots used: , , , '14.05.2010 Testing session '15.05.2010 rechecking the mappings. ' Performed with Lazara Rosell Albear '2013: for some reasons does not seem to work very well anymore. '02.04.2013: recoded for Glasgow - mapping on and '06.04.2013: parameters for jump recognition changed. '13.04.2013: seems to work very well now. '14.03.2015: copied from the glasgow study. STATIC noot1, noot2, noot3, tog AS INTEGER IF ISFALSE Task(%whispers_jump).tog THEN 'gesture.jumpcrit = 5 ' the higher we set this, the lower we have to set sens 'gesture.jumpsens = 5 ' warning: this does not update the parameter window sliders sofar! MM_Snar_On Task(%whispers_jump).tog = %True END IF IF (gesture.airborne_dur(0)) THEN noot1 = MIN(24 + (SQR(gesture.airborne(0)) * 36), 48) mPlay Troms.channel, noot1, 100 + @pDoppler.xa * 27 '120 ELSE noot1 = %False END IF IF (gesture.airborne_dur(1)) THEN noot2 = MIN(60 + (SQR(gesture.airborne(1)) * 16), 72) mPlay Snar.channel, noot2, 100 + @pDoppler.ya * 27 '120 ELSE noot2 = %False END IF IF (gesture.airborne_dur(2))THEN noot3 = 48 mPlay Troms.channel, noot3, 97 + @pDoppler.za * 30 ' 120 ELSE noot3 = %False END IF IF (gesture.airborne_dur(3)) THEN 'mPlay Casta.channel,MIN(casta.lowtes + (SQR(gesture.airborne(3)) * 24), casta.hightes) , 127 Controller Snar.channel, 11, 127 Snar.ctrl(11) = 127 ELSE IF Snar.ctrl(11) THEN Controller Snar.channel, 11, 0 Snar.ctrl(11) =0 END IF END IF END SUB SUB whispers_jump_stop () MM_Snar_Off MM_Troms_Off 'Save_Gesture_Recognition_Params ' for logfile END SUB SUB Whispers_Llor () ' on collision ' adapted from Xtof code. STATIC n1 AS DWORD, n2 AS DWORD, n3 AS DWORD IF ISFALSE(n1) THEN n1 = 48 n2 = 49 n3 = 50 END IF 'logfile STR$(gesture.theacol(0)) + STR$(gesture.theacol(1)) + STR$(gesture.theacol(2)) + STR$(@pDoppler.xa) + STR$(@pDoppler.ya) + STR$(@pDoppler.za) + STR$(n1) + STR$(n2) + STR$(n3) IF ((@pDoppler.xa > .1) AND (gesture.theacol(0) > .1)) THEN mPlay Llor.channel, n1, 4 + @pDoppler.xa * 100 INCR n1 IF n1 > 59 THEN n1 = 48 END IF IF ((@pDoppler.ya > .1) AND (gesture.theacol(1) > .1)) THEN mPlay Llor.channel, n2, 4 + @pDoppler.ya * 100 INCR n2 IF n2 > 59 THEN n2 = 48 END IF IF ((@pDoppler.za > .1) AND (gesture.theacol(2) > .1)) THEN mPlay Llor.channel, n3, 4 + @pDoppler.za * 100 INCR n3 IF n3 > 59 THEN n3 = 48 END IF END SUB SUB Whispers_Simba () ' drived from Domi_Explode_Trig () in Links.inc ' alternative property naming: Grow - Shrink , expand - coagulate, enlarge - decrease ' here we look only into the surface data on order to detect sudden explosive gesture ' 25.04.2010: further fine tuning ' 04.01.2014: modified for Namuda #42, Happy Robots ' 14.03.2015: reused for Tumult, #52 STATIC xtrig, ytrig, ztrig, lites AS LONG STATIC od AS SINGLE LOCAL d AS SINGLE STATIC sens AS SINGLE IF ISFALSE Task(%Whispers_Simba).tog THEN sens = 0.1 'was 0.09 on 20.04.2010 RESET xtrig, ytrig, ztrig, lites MM_Simba_On 'sometimes seems to fail. MM_Klung_On MM_Springers_On Task(%Whispers_Simba).tog = %True EXIT SUB END IF ' on increasing body surface (exploding, growing, expanding), do something... ' we can also try IF gesture.explo_val(0) > gesture.implo_val(0) then... since these values are now commensurable IF (ISFALSE gesture.implo(0)) AND (gesture.explo(0)> @pDoppler.noise) THEN 'dur condition makes no sense as it is always fullfilled. IF gesture.explo_dur(0) MOD 10 = 1 THEN mPlay Klung.channel, MIN(Klung.lowtes + (gesture.explo(0)* 100), Klung.Hightes), MIN(gesture.explo_val(0) * 127, 127) END IF END IF IF (ISFALSE gesture.implo(1)) AND (gesture.explo(1) > @pDoppler.noise) THEN IF gesture.explo_dur(1) MOD 16 = 1 THEN mPlay Simba.channel, MIN(77 + (gesture.explo(1) * 5),80) , MIN((gesture.explo_val(1) ^ 1.5) * 127 , 127 ) END IF END IF IF (ISFALSE gesture.implo(2)) AND (gesture.explo(2)> @pDoppler.noise) THEN 'still too sensitive. SELECT CASE gesture.explo_dur(2) 'units are 3.9ms CASE 1 TO 3 'shaker1 mPlay Springers.channel,72, MIN((gesture.explo_val(2)) * 255, 127) CASE 4 TO 6 'shaker2 mPlay Springers.channel, 79,MIN((gesture.explo_val(2)) * 255, 127) CASE 7 TO 10 'shaker 1 back mPlay Springers.channel, 73,MIN((gesture.explo_val(2)) * 255, 127) CASE 11 TO 14 'springer 1 mPlay Springers.channel, 36,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 15 TO 19 '8 'shaker 2 back mPlay Springers.channel, 80,MIN((gesture.explo_val(2)) * 255, 127) CASE 20 TO 25 '10 'springer 2 mPlay Springers.channel, 37,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 26 TO 32 '15 'springer 3 mPlay Springers.channel, 38,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 33 TO 39 '21 'springer 4 mPlay Springers.channel, 39,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 40 TO 47 '28 'springer 5 mPlay Springers.channel, 40,MIN((gesture.explo_val(2)^1.5) * 127, 127) CASE 48 TO 54 '35 to 45 '(> 35) and (<= 45) 'blue flashlight Controller Springers.channel, 70, MIN((gesture.explo_val(2)) * 127, 127) ztrig = %True CASE > 54 '200ms - still happens very often! 'siren '' mPlay Springers.channel, 24,MIN((gesture.explo_val(2)) * 127, 120) '' ztrig = %True END SELECT ELSE IF ztrig THEN ' mPlay Springers.channel, 24, %False 'sirene uit Controller Springers.channel, 70, %False 'zwaailicht END IF RESET ztrig END IF 'added 15.04.2010: IF gesture.explo_dur(0) * gesture.explo_dur(1) * gesture.explo_dur(2) THEN d = MAX(gesture.explo_dur(0),gesture.explo_dur(1),gesture.explo_dur(2))/ 0.256 'naar ms d = MAX(24, 48 - (d \ 40)) IF d > od THEN mPlay Troms.channel, d, gesture.explo(3) * 127 od = d END IF ELSE RESET od END IF IF (ISFALSE gesture.implo(3)) AND (gesture.explo(3) > 0.0) THEN IF ISFALSE lites THEN MM_Simba_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Simba_Off %MM_Lights RESET lites END IF END IF END SUB