'**************************************************** '* Namuda studies for Dominica Eyckmans * '* Godfried-Willem Raes * '**************************************************** '* RoboDomi Namuda Study #4 07.10 * '* RoboBomi Namuda Study #7 09.10 * '* Features Namuda Study #8 10.10 * '* Zwiep & Zwaai Namuda Study #9 11.10 * '* Icy Vibes Namuda Study #10 12.10 * '* Prime 2011 Namuda Study #11 01.11 * '* Polyamori Namuda Study #12 02.11 * '* AI Namuda Study #13 03.11 * '* Miked Namuda Study #14 04.11 * '* Early birds Namuda Study #15 05.11 * '* Tango Pia Namuda Study #16 06.11 * '* Spirals for Spiro Namuda Study #17 09.11 * '* LowLevel Namuda Study #18 10.11 * '* Elfjes Namuda Study #19 11.11 * '* Solstice Namuda Study #20 12.11 * '* Emergence Namuda Study #21 01.12 * '* Lite Namuda Study #22 02.12 * '* Wet Namuda Study #23 03.12 * '* NoSi Namuda Study #24 04.12 * '* Ritual Namuda Study #26 09.12 * '* Specs Namuda Study #27 10.12 * '* Unisons Namuda Study #28 01.12 * '* Dozens Namuda Study #29 12.12 * '* Force Namuda Study #30 12.01.13 * '* Sense Namuda Study #31 26.01 * '* Springs Namuda Study #32 03.03.13 * '* Glasgow Namuda Study #34 16.04.13 * '* Whispers Namuda Study #38 18.09.13 * '* Gentle Math Namuda Study #39 22.10.13 * '* DunkelDark Namuda Study #40 08.11.13 * '**************************************************** 'Robodomi: #4 premiere for 22.07.2010 '08.07.2010: Rehearsal with Dominica Eyckmans '16.07.2010: minor code revisions. '17.07.2010: code tested and checked again. '21.07.2010: rehearsal session. '22.07.2010: Rob5 added, to be combined with Rob1 ' The piece starts with Rob3 '------------------------------------------------------ '03.09.2010: RoboBomi added. - Namuda Study #7 - serial ' for Dominica and [ + Aeio & Toypi] ' TO DO: fixspeed coding on toypi: use series as well + octave higher. '------------------------------------------------------ '14.10.2010: Features added - Namuda Study #8 - 20102010 '17.10.2010: First rehearsal for 'Features' with Dominica.. '----------------------------------------------------- '05.11.2010: First rehearsal & try outs for Zwiep en Zwaai #9 '10.11.2010: Coding session for 'Zwiep & Zwaai' '11.11.2010: Further coding and testing. '14.11.2010: Rehearsal. '05.12.2010: Rehearsal Icy Vibes #10 '09.01.2011: Rehearsal Prime 2011 #11 '30.01.2011: Rehearsal Polyamori #12 '27.02.2011: Rehearsal AI #13 '13.03.2011: Rehearsal AI '15.03.2011: Ending code added to AI '03.04.2011: Rehearsal Miked #14 '15.05.2011: Rehearsal Early Birds #15 '05 & 12 .06.2011: Rehearsal Tango Pia, #16 - Tristango '07/2011: Rehearsals for the Diptych produktion '04.09.2011: Coding for RoboSpiro #18 '26.11.2011: Coding for Elfjes #19 '04.12.2011: coding for Solstice #20 '04.01.2012: Coding for Emergence #21 '09.01.2012: NoteCentOn and NoteCentOff procedures substituted with more correct NoteFOn and NoteFOff (in g_midi.inc/ g_lib.dll) '10.03.2012: Coding for Wet. #23 '16.03.2012: Code module for wet in include file "wet.inc" '23.03.2012: Start coding for No/Si #24, in include file "nosi.inc" ' Code for emergence placed in include file "emergence.inc" ' code for lites in "lites.inc" '06.10.2012: Modifications for new version V1.2 ' Code for Specs in "Specs.inc", namuda study #27 '01.11.2012: Code for Unisons in "Uni.inc", namuda study #28 ' INCLUDED files at the end of this file!!! ' Code for prime2011 moved to include file prime.inc '03.03.2013: Code for Springs_2013 in include file springs.inc '29.03.2013: Code for Glasgow in include file glasgow.inc '10.09.2013: Code for Whispers in include file whispers.inc '09.11.2013: Code for DunkelDark in include file robodomi.inc '#INCLUDE "C:\b\pb\gmt\namuda\toneclock.inc" - now in g_har.dll ' Robodies 20.07.2010: Werktitel 'Robodomi' 'procs. for Robodies using Namuda - For Dominica ' reused for Dunkeldark, nov.2013 'DECLARE SUB Rob1 () 'DECLARE SUB Rob1_Stop () 'DECLARE SUB Rob2 () 'DECLARE SUB Rob2_Stop () 'DECLARE SUB Rob3 () 'DECLARE SUB Rob3_Stop () 'DECLARE SUB Rob4 () 'DECLARE SUB Rob4_Stop () %Rob1 = 17 '16 %Rob2 = 18' 17 %Rob3 = 19 '18 %Rob4 = 20 '19 %Rob5 = 21 '20 %Rob6 = 22 '21 ' added for DunkelDark %Rob7 = 23 %Rob8 = 24 %ospu = 26 %osd = 27 'RoboBomi - kode voor Dominica %RoboBomi = 17 %RoboBomi_Ae = 18 %RoboBomi_To = 19 'toypi code - task 0, crashes... 'Features - kode voor Dominica 'only possible task numbers are 0, 14, 15 [ 14, 15 are used, but can be dismissed] 'now cockpit is dynamic and we can use other tasknumbers.. %RoboFeat1 = 17 %RoboFeat2 = 18 'code with movement of Korn, Ob, Puff, Simba, Snar, Psch 'Zwiep en Zwaai' (november 2010) %Korn_PirPlay = 17 'uses Korns own pir sensors %FreezeOb = 18 'uses Ob movement %Move_Puff = 19 %Move_Simba = 20 %Move_Psch = 21 %Move_TW = 22 %SmoothKlar = 23 'code for Icy Vibes (december 2010) - choreographed composition %vbt0 = 17 ' 32 start-up task for ' following tasks may be overwritten: (They are created only when needed) %vbt1 = 18 '17 ' 'Vibes' for 5 tasks: 18,19,20,21,22 - %vbt2 = %vbt1 + 1 ' can be used as environmental music, musique d'ameublement. %vbt3 = %vbt1 + 2 %vbt4 = %vbt1 + 3 %vbt5 = %vbt1 + 4 ' motor task for 'Vibes' for . %vbt6 = %vbt1 + 5 ' piperola & harma task... %vbt7 = %vbt1 + 6 ' white lights %vbt8 = %vbt1 + 7 ' blue lights %vbt9 = %vbt1 + 8 ' intro %zwiep2013 = 1 'conditional compile voor aanpassingen 2013 ' ******************************************** ' * Namuda Study #4 * ' * RoboDomi * ' * Namuda Study #40 * ' * DunkelDark * ' ******************************************** FUNCTION Init_Robodomi AS LONG ClearTasks '------------ROBODOMI:------------------------------------------------------------------------------------------- Task(%Rob1).naam = "Rob-1" 'Robodies 1 gwr - dominica - edgy-smooth properties on Harmo and Piano Task(%Rob1).cptr = CODEPTR(Rob1) Task(%Rob1).freq = 8 Task(%Rob1).flags = %False TaskEX(%Rob1).stopCptr = CODEPTR(Rob1_Stop) 'CODEPTR(Domi_Edgy_Trig_Stop) Task(%Rob2).naam = "Rob-2" 'Robodies 2 gwr - dominica Task(%Rob2).cptr = CODEPTR(Rob2) ' on slowdown Task(%Rob2).freq = 8 Task(%Rob2).flags = %False TaskEX(%Rob2).stopCptr = CODEPTR(Rob2_Stop) Task(%Rob3).naam = "Rob-3" 'Robodies 3 gwr - dominica - fluency property on , Task(%Rob3).cptr = CODEPTR(Rob3) 'this is the start of the piece, with viola. Task(%Rob3).freq = 100 Task(%Rob3).flags = %False TaskEX(%Rob3).stopCptr = CODEPTR(Rob3_Stop) Task(%Rob4).naam = "Rob-4" 'Robodies 4 gwr - dominica - speedup on Bono, So and Heli Task(%Rob4).cptr = CODEPTR(Rob4) Task(%Rob4).freq = 100 Task(%Rob4).flags = %False TaskEX(%Rob4).stopCptr = CODEPTR(Rob4_Stop) Task(%Rob5).naam = "Rob-5" 'Robodies 5 gwr - dominica - xy on speedup Task(%Rob5).cptr = CODEPTR(Rob5) Task(%Rob5).freq = 129 Task(%Rob5).flags = %False TaskEX(%Rob5).stopCptr = CODEPTR(Rob5_Stop) Task(%Rob6).naam = "Rob-6" 'Dunkeldark, gwr - dominica - toypi/spiro on slowdown Task(%Rob6).cptr = CODEPTR(Rob6) Task(%Rob6).freq = 128 Task(%Rob6).flags = %False TaskEX(%Rob6).stopCptr = CODEPTR(Rob6_Stop) Task(%Rob7).naam = "Rob-7" 'Dunkeldark, gwr - dominica - low notes, 1 octave range Task(%Rob7).cptr = CODEPTR(Rob7) Task(%Rob7).freq = 92 ' Task(%Rob7).flags = %False TaskEX(%Rob7).stopCptr = CODEPTR(Rob7_Stop) Task(%Rob8).naam = "Rob-8" 'Dunkeldark, gwr - dominica - whisper for ending. Task(%Rob8).cptr = CODEPTR(Rob8) Task(%Rob8).freq = 49 Task(%Rob8).flags = %False TaskEX(%Rob8).stopCptr = CODEPTR(Rob8_Stop) Task(%ospu).naam = "SpdUp" 'Robodies 4 gwr - dominica - speedup on Bono, So and Heli Task(%ospu).cptr = CODEPTR(Oorsprong_Speedup) Task(%ospu).freq = 100 Task(%ospu).flags = %False TaskEX(%ospu).stopCptr = CODEPTR(Oorsprong_Speedup_Stop) Task(%osd).naam = "SloDn" 'Dunkeldark, gwr - dominica - toypi/spiro on slowdown Task(%osd).cptr = CODEPTR(Oorsprong_SlowDown) Task(%osd).freq = 128 Task(%osd).flags = %False TaskEX(%osd).stopCptr = CODEPTR(Oorsprong_SlowDown_Stop) END FUNCTION 'code for poly-a 02.2011: TYPE Poly_2011 DWORD tik AS DWORD prop AS SINGLE angle AS SINGLE spekfak AS SINGLE ser(11) AS INTEGER serinv(11) AS INTEGER dur(11) AS SINGLE aeio AS INTEGER ' aeio noot bomi AS INTEGER ' bomi noot aeio_cnt AS INTEGER bomi_cnt AS INTEGER END TYPE %Poly0 = 17 %Poly1 = 18 ' aeio %Poly2 = 19 ' bomi %Poly3 = 20 ' so display %Poly4 = 21 ' toypi %Poly5 = 22 ' aeio flageoletten %Poly6 = 23 ' vibi- bourdonola %Poly7 = 24 ' pp2 %Poly8 = 25 ' puff %Poly9 = 26 ' xy %Poly10 = 27 ' aeio finale ' code for AI study TYPE Namuda_AI_Type DWORD robotsplaying AS LONG recording AS LONG wavprop AS waveproperties END TYPE %AI_0 = 17 ' FFT code 4096 samples %AI_sing = 18 ' isolate single wave coding %AI_cor = 19 ' correlation coding %AI_Wavana = 20 ' =%FidelC_wavana_task %AI_1 = 21 '22 %AI_2 = 22 '23 %AI_3 = 23 '24 %AI_4 = 24 '25 %AI_Xy = 25 '26 %AI_End = 26 '27 %Miked_Vol = 27 ' 25.10.2015 volume control for Hybr %Miked_Hybr = 28 ' 25.10.2015 %Miked_FFT = 29 ' do we have place to add a proc. for Hybr? (21.10.2015) %Miked_GestSpek = 30 %Miked_Stop = 31 %miked_pos = 46 %miked_pno = 47 DECLARE FUNCTION Init_AI () AS LONG DECLARE SUB AI_0 () ' FFT DECLARE SUB AI_single () DECLARE SUB AI_cor () DECLARE SUB AI_wavana () DECLARE SUB AI_1 () ' gesture slowdown - piperola DECLARE SUB AI_1_Stop () DECLARE SUB AI_2 () DECLARE SUB AI_2_Stop () DECLARE SUB AI_3 () DECLARE SUB AI_3_Stop () DECLARE SUB AI_4 () DECLARE SUB AI_End () ' for Namuda Study #15: Early Birds, for , dance and viola. %E_Birds_Start = 32 %E_Birds = 33 ' tasks 32-47 are available %E_Birds_Slow = 34 %E_Birds_Tim = 35 '%E_Birds_AM = 36 ' obsolete %E_Birds_Aft = 37 DECLARE SUB E_Birds_Start () DECLARE SUB E_Birds () ' speedup DECLARE SUB E_Birds_Slow () ' slowdown DECLARE SUB E_Birds_Tim () 'DECLARE SUB E_Birds_AM () ' obsolete now 'DECLARE SUB E_Birds_AM_Stop () ' onsolete now DECLARE SUB E_Birds_Aft () DECLARE SUB E_Birds_Off () ' for Namuda Study #14: Miked. DECLARE SUB Miked_FFT () DECLARE SUB Miked_GestSpek () DECLARE SUB Miked_Hybr () DECLARE FUNCTION Init_Robodomi AS LONG 'procs. for Robodies using Namuda - For Dominica 'Study #4 and Study #40 DECLARE SUB Rob1 () 'piano - harmO DECLARE SUB Rob1_Stop () DECLARE SUB Rob2 () 'étherisch piperola,bourdonola, qt, low wind. DECLARE SUB Rob2_Stop () DECLARE SUB Rob3 () 'met altviool - ob & korn, with slide inflections DECLARE SUB Rob3_Stop () DECLARE SUB Rob4 () 'speedup gesture with , , evt. DECLARE SUB Rob4_Stop () DECLARE SUB Rob5 () DECLARE SUB Rob5_Stop () DECLARE SUB Rob6 () DECLARE SUB Rob6_stop () DECLARE SUB Rob7 () DECLARE SUB Rob7_stop () 'procs for RoboBomi: DECLARE FUNCTION Init_RoboBomi AS LONG DECLARE SUB RoboBomi () 'for serial production 09/2010 DECLARE SUB Robobomi_Ae () 'aeio fill in DECLARE SUB Robobomi_To () 'procs for Features: 'oct.2010 DECLARE FUNCTION Init_Features AS LONG DECLARE SUB RoboFeat1 () DECLARE SUB RoboFeat2 () 'procs for Zwiep en Zwaai: 'nov.2010 DECLARE SUB FreezeOb DECLARE SUB Korn_PirPlay () DECLARE SUB Korn_PirPlay_Stop () DECLARE SUB Move_Puff () DECLARE SUB Move_Psch () DECLARE SUB Move_Simba () DECLARE SUB Move_TW () 'procs for Icy Vibes 'dec.2010 ' reused 15.08.2019 DECLARE SUB Vibi_t0 () DECLARE SUB Vibi_t1 () DECLARE SUB Vibi_t2 () DECLARE SUB Vibi_t3 () DECLARE SUB Vibi_t4 () DECLARE SUB Vibi_t5 () DECLARE SUB Vibi_t6 () DECLARE SUB IceLite () DECLARE SUB Iceblue () DECLARE SUB Vibes_Start () DECLARE SUB Vibes_Stop () DECLARE SUB Icy_Intro () '--------------------------------------------- DECLARE FUNCTION Init_Poly () AS LONG DECLARE SUB Poly_1 () DECLARE SUB Poly_2 () DECLARE SUB Poly_3 () DECLARE SUB Poly_4 () DECLARE SUB Poly_5 () DECLARE SUB Poly_6 () DECLARE SUB Poly_7 () DECLARE SUB Poly_8 () DECLARE SUB Poly_9 () DECLARE FUNCTION Init_Tango () AS LONG ' june 2011 '----------------------------------------------------------- DECLARE FUNCTION Init_Colors () AS LONG ' september 2011 DECLARE SUB SpiroSpek () DECLARE SUB SpiroColors2 () DECLARE SUB SpiroColors2_Stop () %SpiroSpek = 17 %SpiroColors2 = 18 %SpiroColors3 = 19 %SpiroColors4 = 20 TYPE LowLevType DWORD normspeed AS SINGLE ' genormaliseerde bewegingssnelheid bereik 1-2, non vectorial normbody AS SINGLE ' genormaliseerde bodysurface averaged, non vectorial END TYPE GLOBAL LoL AS LowLevType ' used in LowLevel, Elfjes, solstice, emergence, No/Si DECLARE SUB Init_LowLevel () DECLARE SUB LowLevAlgo () DECLARE SUB LowLevAlgo2 () DECLARE SUB LowLevAlgo3 () DECLARE SUB LowLevAlgo4 () DECLARE SUB LowLevAlgo5 () DECLARE SUB LowLevAlgo6 () DECLARE SUB LowLevInteract () DECLARE SUB LowLevEnd () DECLARE SUB LowLevAlgo_Stop () DECLARE SUB LowLevScoring () DECLARE SUB LowLevAlgo2_Stop () DECLARE SUB LowLevAlgo3_Stop () DECLARE SUB LowLevAlgo4_Stop () DECLARE SUB LowLevAlgo5_Stop () DECLARE SUB LowLevAlgo6_Stop () DECLARE SUB LowLevEnd_Stop () %LoLeA = 22 ' for low level 10/2011 %LoLeB = 23 %LoLeC = 24 %LoLeD = 25 %LoLeE = 26 %LoLeF = 27 %LoLeI = 28 %LoLeS = 29 %LoLeZ = 30 '----------------------------------------------------------- ' for 'Solstice' 3e cockpit kolom ---------------------------------------- DECLARE SUB Init_Solstice () DECLARE SUB ToneclockTest TYPE Solstice_Type uur AS WORD tc AS WORD energy AS SINGLE END TYPE GLOBAL Sol AS Solstice_Type %tcchordtest = 46 %toneclocktest = 47 %SolStart = 32 %SolsTim = 33 %SolsInt = 34 %Sols0 = 35 %Sols1 = 36 %Sols2 = 37 %Sols3 = 38 %Sols4 = 39 %SolsEnd = 40 DECLARE SUB SolStart () DECLARE SUB Sols0 () DECLARE SUB Sols1 () DECLARE SUB Sols2 () DECLARE SUB Sols3 () DECLARE SUB Sols4 () DECLARE SUB SolsInt () DECLARE SUB Solstim () DECLARE SUB SolsEnd () %testbend = 47 ' was in emergence coding. ' Namuda study #21: = emergence in include file "emergence.inc" ' Namuda study #22: - lites in include file "lites.inc" ' Namuda study #23: - wet in include file "wet.inc" ' Namuda study #24: - No/Si in include file "nosi.inc" '----------------------------------------------------------------------------------------------------------- SUB Rob1 () 'combined gesture properties gesture.edgy, gesture.smooth ... 'written for Dominica Eyckmans - Robodies production 22.07.2010 'reused in study #40, Dunkeldark '11.11.2013: Harmo made less triggerable, Harma added. LOCAL i AS LONG STATIC noot1, noot2, noot3 AS CUR STATIC tog, cnt, cnth AS INTEGER STATIC wind, d, mx AS SINGLE STATIC ni(), no() AS CUR STATIC zh AS HarmType IF ISFALSE Task(%Rob1).tog THEN REDIM ni(3) AS STATIC CUR REDIM no(3) AS STATIC CUR DIM sp(127) AS STATIC DOUBLE AT gesture.pspf(3) 'sum of fast spectra. DIM spi(128) AS STATIC SINGLE DIM aro(127) AS STATIC SINGLE zh.vel = NUL$(128) 'MM_HarmO_On Controller HarmO.channel, 66, 127 ' msgbox hex$(harmo.channel) HarmO.ctrl(79) = 120 Controller HarmO.channel, 79, Harmo.ctrl(79) HarmO.ctrl(80) = 120 Controller HarmO.channel, 80, HarmO.ctrl(80) ' note that the PIC's should remember the position, so if the swells are already ' in this position, nothing ought to change on reception of this command. Harmo.ctrl(66) = 127 Controller Harmo.channel, 66, Harmo.ctrl(66) 'added 17.07.2010 - pretty important... Harmo.ctrl(1) = 100 Controller HarmO.channel, 1, Harmo.ctrl(1) '90 - windvalve range is 24-100 Harmo.ctrl(7) = 30 'low wind on startup Controller HarmO.channel, 7, Harmo.ctrl(7) '%MM_HarmO_Motor '100 'registers: Controller HarmO.channel, 70, 64 ' 2' Controller HarmO.channel, 71, %False '64 ' 8' - removed 10.07.2010 Controller HarmO.channel, 72, %False Controller HarmO.channel, 73, 64 ' 4' Controller HarmO.channel, 74, %False Controller HarmO.channel, 75, 64 ' 4' Controller HarmO.channel, 76, 64 ' 8' Controller HarmO.channel, 77, %False Controller HarmO.channel, 78, 64 ' 8' ' add Harma: Harma.ctrl(7) = HarmO.ctrl(7) MM_Harma_On Controller Harma.channel, 7, Harma.ctrl(7) wind = Harmo.ctrl(7) cnt = %False Task(%Rob1).tog = %True END IF IF (gesture.edgy_dur(3)) AND (gesture.edgy(3)) THEN 'if edgy, we select the piano 'IF ISFALSE ni(0) THEN IF ni(0) < Piano.lowtes THEN ni(0) = MIN(piano.lowtes + (gesture.edgy(0) * 127), piano.hightes) ni(1) = MIN(piano.lowtes + (gesture.edgy(1) * 127), piano.hightes) ni(2) = MIN(piano.lowtes + (gesture.edgy(2) * 127), piano.hightes) d = HH_Tetrad (0, ni(0), ni(1), ni(2), ni(3), gesture.edgy(3)) 'Helmholtz harmony function, calculates ni(3) addnote2har piano.har(1), ni(0), (@pDoppler.xa * 127) addnote2har piano.har(1), ni(1), (@pDoppler.ya * 127) addnote2har piano.har(1), ni(2), (@pDoppler.za * 127) addnote2Har piano.har(1), ni(3), (@pDoppler.xa * 127) Instrumplay Piano ELSE 'sekwens berekenen... 'if ni(0) < Piano.lowtes then ni(0) = 24 + ni(0) MOD 12 'IF ni(0) < Piano.lowtes THEN ni(0) = MIN(piano.lowtes + (gesture.edgy(cnt) * 127), piano.hightes) INCR cnt cnt = cnt MOD 3 '0,1,2 IF ISFALSE no(0) THEN no(0) = MIN(piano.lowtes + (gesture.edgy(cnt) * 127), piano.hightes) 'no(0) = ni(0) d = HH_Chord_Progres(0, ni(), no(), (gesture.edgy(0) + gesture.edgy(1) + gesture.edgy(2) + gesture.edgy(3)) / 8) 'Helmholtz harmony function addnote2har piano.har(1), no(0), (@pDoppler.xa * 127) addnote2har piano.har(1), no(1), (@pDoppler.ya * 127) addnote2har piano.har(1), no(2), (@pDoppler.za * 127) addnote2Har piano.har(1), no(3), (@pDoppler.xa * 127) Instrumplay Piano 'mat ni = no 'does not work with currency! ni(0) = no(0) : ni(1) = no(1) : ni(2) = no(2) : ni(3)= no(3) ' shouldn't we reset no()? (try, 06.07.2010... gwr) indeed. no(0) = no(0) + cnt 'making progressions... IF no(0) > 82 THEN no(0) = ni(0) END IF no(1) = %False: no(2) = %False : no(3) = %False END IF Task(%Rob1).freq = MAX(2, gesture.fixspeed_val(3)/20) ' MAX(2, gesture.fixspeed_val(3) / 25) EXIT SUB ELSE IF ni(0) THEN Instrumplay Piano 'notes off 'MAT ni() = ZER RESET no() 'added 17.07.2010 -gwr ok RESET ni() END IF END IF IF gesture.smooth_dur(3) THEN 'íf smooth, we select Harmo and play movement spectrum on it. FOR i = 0 TO 127 mx = MAX(mx, sp(i)) 'mx is never zero. NEXT i FOR i = 0 TO 127 Spi(i) = sp(i) * @pDoppler.za/mx NEXT i ArrayReduce_SNG (spi(), 8, aro()) cnth += 2 IF cnth > 120 THEN cnth = 120 LinSpec2Har (aro(), zh, cnth ) '64 was Slider(slnr).value) ' in g_mus HarmO.Har(1).vel = ReScaleHarvel (zh, 0.5) 'velocities need to be scaled down: (now -50%) Harma.Har(1).vel = HarmO.Har(1).vel InstrumPlay HarmO InstrumPlay Harma tog = %True 'range for gesture.smooth_val(3) checked. wind = (wind * 0.9375) + (gesture.smooth_val(3) * 7.9375) IF harmo.ctrl(7) <> INT(wind) THEN controller harmo.channel, 7, MAX(MIN(wind, %MM_Harmo_Motor), 30) controller harma.channel, 7, MAX(MIN(wind, %MM_Harma_Motor), 30) Harmo.ctrl(7) = INT(wind) END IF 'light: mPlay Harmo.channel, 122 + (gesture.smooth(3) * 5), 64 'geel frontaal Task(%Rob1).freq = MAX(2, gesture.fixspeed_val(3) / 60) INCR cnth EXIT SUB ELSE IF tog THEN MM_HarmO_Off %MM_Yellow Instrumplay Harmo ' should switch off notes. InstrumPlay Harma RESET tog cnth = 40 END IF END IF Task(%Rob1).freq = 8 ' MAX(2, gesture.fixspeed_val(3) / 25) END SUB SUB Rob1_Stop () ' MM_Harmo_Off %MM_Notes OR %MM_Motor 'motor controller crahses when you put it off MM_Harma_Off %MM_Notes OR %MM_Motor MM_Piano_Off %MM_Notes END SUB SUB Rob2 () 'etherisch, on slowdown with extremely low wind pressure 'qt, piperola, bourdonola 'derived from: Domi_Slowdown_Trig () 'here we look only into the frequency data on order to detect sudden slowdown gesture '11.11.2013: Whisper added. STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, bnoot, lites AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%Rob2).tog THEN sens = 12 MM_Piperola_On MM_Bourdonola_On MM_Qt_On MM_Bomi_On MM_Whisper_On Qt.ctrl(7) = 22 Controller Qt.channel, 7, Qt.ctrl(7) Bourdonola.ctrl(1) = 30 Controller Bourdonola.channel, 1, Bourdonola.ctrl(1) 'low wind pressure ! Piperola.ctrl(7) = 25 Controller Piperola.channel, 7, Piperola.ctrl(7) Bomi.ctrl(7) = 30 Controller Bomi.channel, 7, Bomi.ctrl(7) 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Rob2).tog = %True END IF IF Gesture.slowdown(0) > sens THEN ' frequency is unipolar data! , can go up to 230 IF ISFALSE xtrig THEN xnoot = MIN(Piperola.lowtes - sens + 2+ (gesture.slowdown_val(0)/2), Piperola.hightes) 'independent from sens 15.04 mPlay Piperola.channel, xnoot, 64 mPlay Whisper.channel, 72, MIN(gesture.slowdown_val(0)/2, 127) xtrig = %True END IF ELSE IF xtrig THEN IF xnoot THEN mPlay Piperola.channel, xnoot, %False mPlay Whisper.channel, 72, %False RESET xnoot END IF END IF RESET xtrig END IF IF Gesture.slowdown(1) > sens THEN IF ISFALSE ytrig THEN ynoot = MIN(60 - sens + 2+ (gesture.slowdown_val(1)/2), Qt.hightes) mPlay Qt.channel, ynoot, 48 mPlay Whisper.channel, 73, MIN(gesture.slowdown_val(1)/2, 127) ytrig = %true END IF ELSE IF ytrig THEN IF ynoot THEN mPlay Qt.channel, ynoot, %False mPlay Whisper.channel, 73, %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(Bourdonola.lowtes - sens + 2+(gesture.slowdown_val(2)/2), Bourdonola.hightes) mPlay Bourdonola.channel, znoot, 64 bnoot = MIN(Bomi.lowtes - sens + 2+(gesture.slowdown_val(2)/2), Bomi.hightes) ' added for #40 mPlay Bomi.channel, bnoot, 64 mPlay Whisper.channel, 74, MIN(gesture.slowdown_val(2)/2, 127) ztrig = %True END IF ELSE IF ztrig THEN IF znoot THEN mPlay Bourdonola.channel, znoot , %False mPlay Bomi.channel, bnoot, %False mPlay Whisper.channel, 74, %False RESET znoot END IF END IF RESET ztrig END IF ' add-in for whisper... IF (gesture.slowdown(3) > sens) AND (gesture.slowdown(3) > gesture.speedup(3)) THEN IF ISFALSE lites THEN MM_Piperola_On %MM_Lights MM_Qt_On %MM_Lights MM_Bourdonola_On %MM_Lights MM_Bomi_On %MM_White MM_Whisper_On %MM_Tungsten lites = %True END IF ELSE IF lites THEN MM_Piperola_Off %MM_Lights MM_Qt_Off %MM_Lights MM_Bourdonola_Off %MM_Lights MM_Bomi_Off %MM_White MM_Whisper_Off %MM_Tungsten RESET lites END IF END IF END SUB SUB Rob2_Stop () MM_Piperola_Off MM_Qt_Off MM_Bourdonola_Off MM_Bomi_Off MM_Whisper_Off END SUB SUB Rob3 () 'fluency mapped on Ob and Korn with sliding pitches 'here we could added Asa. [2013] 'this section can be combined with viola. STATIC xnoot, ynoot, znoot, lites AS DWORD LOCAL n AS DWORD STATIC sens AS SINGLE IF ISFALSE Task(%Rob3).tog THEN sens = 0.625 '80 / 128 MM_Ob_On MM_Korn_On MM_Asa_On 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Rob3).tog = %True END IF ' on fluency, do something... IF (gesture.flue(0) > sens) OR (gesture.flue(2) > sens) THEN ' derived from the percentual standard deviation (inverted) ' hoe hoger gesture.flue(0) hoe sterker de eigenschap fluency IF (gesture.flue_dur(0) MOD 8) = 1 THEN '25.04 n = MIN(Ob.lowtes + (gesture.flue_val(0)* 36), Ob.Hightes) IF n <> xnoot THEN IF xnoot THEN NoteOff Ob.channel, xnoot Bend Ob.channel, %False, 64 RESET xnoot END IF xnoot = n mPlay Ob.channel,xnoot, MIN(gesture.flue(0) * 64,127) END IF ELSE IF gesture.flue_dur(0) THEN 'apply pitchbend - bad mapping, beter on xf Bend Ob.channel, %False, MIN(@pDoppler.xf*4, 127 ) ' MIN(gesture.flue_val(0) * 255, 127) '64 + gesture.flue_val(3) * 63 END IF END IF ELSE IF xnoot THEN 'reset pitchbend: Bend Ob.channel, %False, 64 Noteoff Ob.channel, xnoot RESET xnoot END IF END IF 'second voice on : IF (gesture.flue(1) > sens) OR (gesture.flue(2) > sens) THEN ' derived from the percentual standard deviation (inverted) ' hoe hoger gesture.flue(0) hoe sterker de eigenschap fluency IF (gesture.flue_dur(1) MOD 8) = 1 THEN '25.04 n = MIN(Ob.lowtes + (gesture.flue_val(1)* 36), Korn.Hightes) IF n <> ynoot THEN IF ynoot THEN NoteOff Korn.channel, ynoot Bend Korn.channel, %False, 64 RESET ynoot END IF ynoot = n mPlay Korn.channel,ynoot, MIN(gesture.flue(1) * 64,127) END IF ELSE IF gesture.flue_dur(1) THEN 'apply pitchbend Bend Korn.channel, %False, MIN(@pDoppler.yf*4, 127) 'gesture.flue_val(1) * 127 '64 + gesture.flue_val(3) * 63 END IF END IF ELSE IF ynoot THEN 'reset pitchbend: Bend Korn.channel, %False, 64 Noteoff Korn.channel, ynoot RESET ynoot END IF END IF 'we can add a third voice on Autosax, if we remove this one from the speedup in Rob. 'was disabled for Robodomi. 'enabled and applied to Asa for Dunkeldark, 11.2013 IF gesture.flue(2) > sens THEN ' derived from the percentual standard deviation (inverted) ' hoe hoger gesture.flue(0) hoe sterker de eigenschap fluency IF (gesture.flue_dur(2) MOD 8) = 1 THEN '25.04 n = MIN(Asa.lowtes + (gesture.flue_val(2)* 36), Asa.Hightes) IF n <> znoot THEN IF znoot THEN NoteOff Asa.channel, znoot Bend Asa.channel, %False, 64 RESET znoot END IF znoot = n mPlay Asa.channel,znoot, MIN(gesture.flue(2) * 64,127) END IF ELSE IF gesture.flue_dur(2) THEN 'apply pitchbend Bend Asa.channel, %False, MIN(@pDoppler.zf *4, 127) 'gesture.flue_val(1) * 127 '64 + gesture.flue_val(3) * 63 END IF END IF ELSE IF znoot THEN 'reset pitchbend: Bend Asa.channel, %False, 64 Noteoff Asa.channel, znoot RESET znoot END IF END IF END SUB SUB Rob3_Stop () MM_Korn_Off MM_Ob_Off MM_Asa_Off 'MM_Autosax_Off END SUB SUB Rob4 () 'remapping van de originele Namuda Speedup recognition kode. ', , evt. 'STATIC slnr AS DWORD STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Rob4).tog THEN sens = 18 'in Hz units MM_Bono_On MM_Heli_On MM_So_On Controller So.channel, 7, 120 ' volume controller So.ctrl(7) = 120 Controller So.channel, 1, 30 So.ctrl(1) = 30 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Rob4).tog = %True END IF ' on accelerating body speed, do something... ' X-vektor: 'IF gesture.speedup(0) > sens and gesture.speedup(0) > gesture.slowdown(0) THEN ' frequency is unipolar data, not normalized IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF ISFALSE xtrig THEN xnoot = MIN(34 - sens + (gesture.speedup(0)* 1.5), Bono.Hightes) mPlay Bono.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) xtrig = %True END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN mPlay Bono.channel, xnoot, %False RESET xnoot END IF 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(34 - sens + (gesture.speedup(1)* 1.5), Autosax.Hightes) ' mPlay Autosax.channel,ynoot , MIN(gesture.speedup_val(1) * 2, 127) ynoot = MIN(22 - sens + (gesture.speedup(1) * 1.5), So.hightes) mPlay So.channel, ynoot, MIN(Gesture.speedup_val(1) * 2, 127) ytrig = %true END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN 'mPlay Autosax.channel, ynoot, %False mPlay So.channel, ynoot, %False RESET ynoot END IF END IF RESET ytrig END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN IF ISFALSE ztrig THEN znoot = MIN(34 - sens + (gesture.speedup(2)* 1.5), Heli.Hightes) mPlay Heli.channel, znoot, MIN(gesture.speedup_val(2) * 3, 127) ztrig = %True END IF ELSE IF znoot THEN IF ISFALSE gesture.speedup_dur(2) THEN mPlay Heli.channel, znoot, %False RESET znoot END IF END IF RESET ztrig END IF 'overgenomen uit de originele namuda studie: IF Gesture.speedup(3) > (sens * 10) THEN 'was * 6 IF gesture.speedup(3) > (gesture.slowdown(3) + (sens * 4)) THEN mPlay Llor.channel, MIN(Llor.lowtes + gesture.speedup(3) - (sens*10),Llor.Hightes), MIN(@pDoppler.zf , 127) 'experiment END IF END IF END SUB SUB Rob4_Stop () MM_Bono_Off 'MM_AutoSax_Off MM_Heli_Off MM_So_Off END SUB SUB Rob5 () ' fill in for the last section of the RoboDomi composition ' here we look only into the frequency data in order to detect accelerating gesture STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Rob5).tog THEN sens = 18 'in Hz units MM_Xy_On Task(%Rob5).tog = %True END IF ' on accelerating body speed, do something... ' X-vektor: IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF ISFALSE xtrig THEN xnoot = MIN(Xy.lowtes - sens + (gesture.speedup(0)* 1.5), Xy.Hightes) mPlay Xy.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) xtrig = %True END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN 'mPlay Xy.channel, xnoot, %False RESET xnoot END IF END IF END IF IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN ynoot = MIN(Xy.lowtes - sens + (gesture.speedup(1)* 1.5), Xy.Hightes) mPlay Xy.channel,ynoot , MIN(gesture.speedup_val(1) * 2, 127) ytrig = %true END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN 'mPlay Xy.channel, ynoot, %False RESET ynoot END IF END IF RESET ytrig END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN IF ISFALSE ztrig THEN znoot = MIN(55 - sens + (gesture.speedup(2)* 1.5), Puff.Hightes) mPlay Puff.channel, znoot, MIN(gesture.speedup_val(2) * 2, 64) ztrig = %True END IF ELSE IF znoot THEN IF ISFALSE gesture.speedup_dur(2) THEN ' mPlay Puff.channel, znoot, %False RESET znoot END IF END IF RESET ztrig END IF END SUB SUB Rob5_Stop () MM_Xy_Off MM_Puff_Off END SUB SUB Rob6 () ' added for Nam.#40, 'Dunkeldark' , nov.2013 STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, lites AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%Rob6).tog THEN sens = 12 MM_Spiro_On Task(%Rob6).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(Spiro.lowtes - sens + 2+ (gesture.slowdown_val(0)/2), Spiro.hightes) 'independent from sens 15.04 mPlay Spiro.channel, xnoot, 64 xtrig = %True END IF ELSE IF xtrig THEN IF xnoot THEN mPlay Spiro.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(Spiro.lowtes - sens + 2+ (gesture.slowdown_val(1)/2), Spiro.hightes) mPlay Spiro.channel, ynoot, 64 ytrig = %true END IF ELSE IF ytrig THEN IF ynoot THEN mPlay Spiro.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(Toypi.lowtes - sens + 2+(gesture.slowdown_val(2)/2),Toypi.hightes) mPlay Toypi.channel, znoot, (@pDoppler.za * 127) ztrig = %True END IF ELSE IF ztrig THEN IF znoot THEN 'mPlay Toypi.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_Spiro_On %MM_Lights MM_Toypi_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Spiro_Off %MM_Lights MM_Toypi_Off %MM_Lights RESET lites END IF END IF END SUB SUB Rob6_Stop () MM_Spiro_Off MM_Toypi_Off END SUB SUB Rob7 () ' for dunkeldark. STATIC FaNoot, Klarnoot, HornyNoot AS LONG STATIC xtrig, ytrig, ztrig, lites AS LONG STATIC od AS SINGLE LOCAL d AS SINGLE STATIC sens AS SINGLE 'LOCAL i AS DWORD IF ISFALSE Task(%Rob7).tog THEN sens = 0.1 'was 0.09 on 20.04.2010 RESET xtrig, ytrig, ztrig, lites, Fanoot, Klarnoot, Hornynoot MM_Klar_On MM_Fa_On MM_Horny_On MM_Springers_On 'IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Rob7).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 KlarNoot = Klar.lowtes + (gesture.explo(0)* 12) mPlay Klar.channel, KlarNoot, 70 + MIN(gesture.explo_val(0) * 57, 57) END IF ELSE IF KlarNoot THEN NoteOff Klar.channel, Klarnoot RESET KlarNoot 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 FaNoot = 36 + (gesture.explo(1) * 12) mPlay Fa.channel, FaNoot, 75 + MIN((gesture.explo_val(1) ^ 1.5) * 50 , 50 ) END IF ELSE IF FaNoot THEN NoteOff Fa.channel, Fanoot RESET FaNoot END IF END IF IF (ISFALSE gesture.implo(2)) AND (gesture.explo(2)> @pDoppler.noise) THEN IF gesture.explo_dur(2) MOD 16 = 1 THEN HornyNoot = 36 + (gesture.explo(2) * 12) mPlay Horny.channel, HornyNoot, 75 + MIN((gesture.explo_val(2) ^ 1.5) * 50 , 50 ) END IF 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 HornyNoot THEN NoteOff Horny.channel, HornyNoot RESET HornyNoot END IF 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_Klar_On %MM_Lights MM_Fa_On %MM_Lights MM_Horny_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Klar_Off %MM_Lights MM_Fa_Off %MM_Lights MM_Horny_Off %MM_Lights RESET lites END IF END IF END SUB SUB Rob7_Stop () MM_Klar_Off MM_Fa_Off MM_Horny_Off MM_Springers_Off END SUB SUB Rob8 () ' Dunkeldark, ending with Whisper ' added 11.11.2013 - to be combined with Rob3 STATIC xnoot, ynoot, znoot, lites AS DWORD LOCAL n AS DWORD STATIC sens AS SINGLE IF ISFALSE Task(%Rob8).tog THEN sens = 0.625 '80 / 128 MM_Whisper_On Task(%Rob8).tog = %True END IF ' on fluency, do something... IF (gesture.flue(0) > sens) OR (gesture.flue(2) > sens) THEN ' derived from the percentual standard deviation (inverted) ' hoe hoger gesture.flue(0) hoe sterker de eigenschap fluency IF gesture.flue_dur(0) THEN mPlay Whisper.channel, 75, MIN(@pDoppler.xf*4, 127 ) xnoot = 75 END IF ELSE IF xnoot THEN Noteoff Whisper.channel, xnoot RESET xnoot END IF END IF 'second voice on sleigh bell: IF (gesture.flue(1) > sens) OR (gesture.flue(2) > sens) THEN ' derived from the percentual standard deviation (inverted) ' hoe hoger gesture.flue(0) hoe sterker de eigenschap fluency ynoot = 86 mPlay Whisper.channel,ynoot, MIN(gesture.flue(1) * 64,127) ELSE IF ynoot THEN Noteoff Whisper.channel, ynoot RESET ynoot END IF END IF ' third note on Cage: IF gesture.flue(2) > sens THEN ' derived from the percentual standard deviation (inverted) znoot = 82 mPlay Whisper.channel,znoot, MIN(gesture.flue(2) * 64,127) ELSE IF znoot THEN Noteoff Whisper.channel, znoot RESET znoot END IF END IF END SUB SUB Rob8_Stop () MM_Whisper_Off END SUB '------------------------------------------------------------------------------------------ FUNCTION Init_RoboBomi AS LONG ClearTasks '---------------------------------------------------------------------------------- ' Namuda Study #7, 2010 Task(%Robobomi).naam = "Bomi" 'for the serial music production Task(%Robobomi).cptr = CODEPTR(Robobomi) Task(%Robobomi).freq = 8 Task(%Robobomi).flags = %False TaskEX(%Robobomi).startcptr = CODEPTR(MM_Bomi_On) TaskEX(%Robobomi).stopcptr = CODEPTR(MM_Bomi_Off) Task(%Robobomi_Ae).naam = "Aeio" 'for the serial music production Task(%Robobomi_Ae).cptr = CODEPTR(Robobomi_Ae) Task(%Robobomi_Ae).freq = 2 Task(%Robobomi_Ae).flags = %False TaskEX(%Robobomi_Ae).startcptr = CODEPTR(MM_Aeio_On) TaskEX(%Robobomi_Ae).stopcptr = CODEPTR(MM_Aeio_Off) Task(%Robobomi_To).naam = "Toypi" 'for the serial music production Task(%Robobomi_To).cptr = CODEPTR(Robobomi_To) Task(%Robobomi_To).freq = 2 Task(%Robobomi_To).flags = %False MM_Bomi_On %MM_WHITE END FUNCTION SUB RoboBomi () 'we define a series for the notes and let the permutations depend on gesture 'first version 04.09.2010 'code re-used in Namuda Study #32 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(%RoboBomi).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: 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 '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 < Bomi.lowtes THEN transposition = Bomi.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 'due to kristof bug, we first had to do: ' Bomi.channel = &H0303 MM_Bomi_On %MM_Lights IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Robobomi).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 Bomi.channel, xnoot delNote2Har Task(%Robobomi).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 > Bomi.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 <= Bomi.hightes END IF mPlay Bomi.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) addNote2Har Task(%Robobomi).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 Bomi.channel, xnoot, %False delNote2Har Task(%Robobomi).Har, xnoot ' added 09.03.2013 RESET xnoot INCR ix ix = ix MOD 12 END IF 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(34 - sens + (gesture.speedup(1)* 1.5), Autosax.Hightes) ' mPlay Autosax.channel,ynoot , MIN(gesture.speedup_val(1) * 2, 127) IF ynoot THEN NoteOff Bomi.channel, ynoot delNote2Har Task(%Robobomi).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 > Bomi.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 <= Bomi.hightes END IF mPlay Bomi.channel, ynoot, MIN(Gesture.speedup_val(1) * 2, 127) addNote2Har Task(%Robobomi).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 Bomi.channel, ynoot, %False delNote2Har Task(%Robobomi).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 Bomi.channel, znoot delNote2Har Task(%Robobomi).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 > Bomi.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 <= Bomi.hightes END IF mPlay Bomi.channel, znoot, MIN(gesture.speedup_val(2) * 3, 127) addNote2Har Task(%Robobomi).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 Bomi.channel, znoot, %False delNote2Har Task(%Robobomi).Har, znoot ' added 09.03.2013 RESET znoot INCR iz iz = iz MOD 12 END IF END IF RESET ztrig END IF 'windklep sturing: IF Gesture.speedup(3) > sens THEN 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 <> Bomi.ctrl(1) THEN Controller Bomi.channel, 1, klep Bomi.ctrl(1) = klep END IF END IF END IF 'reeksmatige sturing van het tempo: IF Gesture.slowdown(3) > sens THEN Task(%Robobomi).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 Robobomi_Ae () 'should play the inverted krebs of the series very slowly, on 'if we connect Aeio to port 5 (0-7), we use the 12 aeio channels without the parser 'if we connect Aeio to port 4 (0-7), we use the parser and have Aeio on channel 1 '07.09.2010: we got it working with the parser controller. '12.09.2010: Parser upgrade & dsPIC upgrade... LOCAL i AS LONG STATIC sens AS SINGLE STATIC it, oldnote, trig , cnt AS LONG IF ISFALSE Task(%Robobomi_Ae).tog THEN DIM ser_4(11) AS STATIC INTEGER '= Ser_InvKrebs 'zelfde als berekend in RoboBomi Ser_4(0) = 61 : Ser_4(1) = 63 : Ser_4(2) = 58 : Ser_4(3) = 55 Ser_4(4) = 64 : Ser_4(5) = 65 : Ser_4(6) = 59 : Ser_4(7) = 62 Ser_4(8) = 57 : Ser_4(9) = 56 : Ser_4(10) = 60 : Ser_4(11) = 66 'initialisatie van aeio: MM_Aeio_On FOR i = 0 TO 11 Ser_4(i) = Ser_4(i) - 19 'transpose series to Aeio range 36-47 NEXT i Controller Aeio.channel, 7, 100 ' 127 'maybe too loud. Controller Aeio.channel, 23, 64 'Controller Aeio.channel, 64, 64 'sustain ON : no dampers sens = 0.05 cnt = 0 Slider(0).value = 5 'cockpit upper slider, user for hammer force SendMessage Slider(0).h, %TBM_SETPOS,%True, Slider(0).value Slider(1).value = 6 'cockpit lower slider, used for damping force (time) Sendmessage Slider(1).h, %TBM_SETPOS, %True, Slider(1).value Task(%RoboBomi_Ae).tog = %True END IF 'try playing on freeze property IF (gesture.freeze(0)) OR (gesture.freeze(1)) OR (gesture.freeze(2)) THEN IF ISFALSE Trig THEN mPlay Aeio.channel, Ser_4(it), 127 ' + 12 would be octave up 'with hammers: mPlay Aeio.channel, 24 + ((ser_4(it)) MOD 12), Slider(0).value '10 'soft oldnote = Ser_4(it) INCR it it = it MOD 12 Trig = %True ELSE IF cnt > 24 THEN IF RND(1) > 0.5 THEN Controller Aeio.channel, 100 + (oldnote MOD 12), 2 END IF END IF 'we can modulate the tone here... ' decrescendo?, or play flageolets? END IF ELSE IF oldnote THEN ' NoteOff Bourdonola.channel, oldnote ' Play debugchannel + (oldnote MOD 12), 36, %False ' NoteOff Aeio.channel, oldnote Release Aeio.channel, oldnote, Slider(1).value oldnote = %False END IF RESET Trig END IF END SUB SUB RoboBomi_To () ' here we look only into the speed data on order to detect speed constancy ' based on Fixspeed demo ' 05.09.2010: first rehearsal with Dominica ' TO DO: use same series as other modules and transpose all an octave higher. ' 06.09.2010: coding changed. To be tested yet!!! ' 12.09.2010: Second rehearsal and code debug/update. ' 09.03.2013: Reused in Namuda Study #32 - Spring 2013 STATIC xtrig, ytrig, ztrig, i, xdiv, ydiv, zdiv, div AS LONG STATIC xnoot, ynoot, znoot, lites AS DWORD STATIC sens AS SINGLE IF ISFALSE Task(%RoboBomi_To).tog THEN DIM ser_3(11) AS STATIC INTEGER '= Ser_Inv 'zelfde als berekend in RoboBomi Ser_3(0) = 66 : Ser_3(1) = 60 : Ser_3(2) = 56 : Ser_3(3) = 57 Ser_3(4) = 62 : Ser_3(5) = 59 : Ser_3(6) = 65 : Ser_3(7) = 64 Ser_3(8) = 55 : Ser_3(9) = 58 : Ser_3(10) = 63 : Ser_3(11) = 61 FOR i = 0 TO 11 Ser_3(i) = Ser_3(i) + 17 'transpose to range 72 - 96 NEXT i i = 0 div = 12 'startwaarde voor autoregulering. sens = 0.5 '64 / 128 MM_Toypi_On IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%RoboBomi_To).tog = %True 'exit sub END IF ' values are not normalised, but the property is!!! ' speedval can be as high has 190, but then never as fixspeed ' the higher gesture.fixspeed() the higher the significance of the property. IF gesture.fixspeed(3) > sens THEN IF ISFALSE xtrig THEN xnoot = Ser_3(i) + ((gesture.fixspeed_val(3) \ div) * 12) IF xnoot > Toypi.Hightes THEN DO INCR div xnoot = Ser_3(i) + ((gesture.fixspeed_val(3) \ div) * 12) 'autoadaptive code. LOOP UNTIL xnoot <= Toypi.hightes END IF mPlay Toypi.channel,xnoot, MIN(gesture.fixspeed(3) * 120,120) INCR i i = i MOD 12 xtrig = %True ELSE 'repeat note mPlay Toypi.channel,xnoot, MIN(gesture.fixspeed(3) * 127,120) END IF Task(%RoboBomi_To).freq = MAX( gesture.fixspeed_Val(3)/ 10, 3) ELSE 'INCR i 'i = i MOD 12 RESET xtrig Task(%RoboBomi_To).freq = 3 END IF ' following was remmed in RoboDomi, we unremmed it for spring, Namuda Study #32 IF gesture.fixspeed(1) > sens THEN IF ISFALSE ytrig THEN ynoot = Ser_3((i+1)MOD 12) + ((gesture.fixspeed_val(1) \ div) * 12) 'ynoot = MIN(Toypi.lowtes + (gesture.fixspeed_val(1)/2), Toypi.Hightes) mPlay Toypi.channel,MIN(ynoot,Toypi.Hightes), MIN(gesture.fixspeed(1) * 64, 64) ytrig = %true END IF ELSE RESET ytrig END IF IF gesture.fixspeed(2) > sens THEN IF ISFALSE ztrig THEN ' avoiding multiple triggers on the same collision znoot = Ser_3((i+2)MOD 12) + ((gesture.fixspeed_val(2) \ div) * 12) 'znoot = MIN(Toypi.lowtes + (gesture.fixspeed_val(2)/2), Toypi.HighTes) mPlay Toypi.channel,MIN(znoot,Toypi.Hightes), MIN(gesture.fixspeed(2) * 64, 64) ztrig = %True END IF ELSE RESET ztrig END IF '------------------------ IF gesture.fixspeed(3) > sens THEN IF ISFALSE lites THEN MM_Toypi_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Toypi_Off %MM_Lights RESET lites END IF END IF END SUB '----------------------------------------------------------------------------------------- FUNCTION Init_Features AS LONG ClearTasks '---------------------------------------------------------------------------------- ' - for 20102010 Task(%Robofeat1).naam = "Feat1" Task(%Robofeat1).cptr = CODEPTR(RoboFeat1) Task(%Robofeat1).freq = 10 Task(%RoboFeat1).flags = %False TaskEX(%RoboFeat1).stopcptr = CODEPTR(RoboFeat1_Stop) Task(%Robofeat2).naam = "Feat2" Task(%Robofeat2).cptr = CODEPTR(RoboFeat2) Task(%Robofeat2).freq = 10 Task(%RoboFeat2).flags = %False TaskEX(%RoboFeat2).stopcptr = CODEPTR(RoboFeat2_Stop) END FUNCTION SUB RoboFeat1 () '%Robofeat1 - for the 20102010 production 'remapping van de originele Namuda Speedup recognition kode & Rob4 coding ', , evt. STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot AS LONG STATIC l AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%RoboFeat1).tog THEN sens = 18 'in Hz units MM_Bono_On MM_Puff_On MM_ThunderWood_On MM_Simba_On MM_Piperola_On %MM_Power Controller Puff.channel, 66, 127 Controller Puff.channel, 90, 4 'pir eyes, relaxed algo. IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%RoboFeat1).tog = %True END IF ' on accelerating body speed, do something... ' X-vektor: IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN l = 120 + (gesture.speedup(0) MOD 6) mPlay Bono.channel, l, 127 'lites IF ISFALSE xtrig THEN IF Task(%Robofeat1).pan THEN 'set with OS-button xnoot = MIN(34 - sens + (gesture.speedup(0)* 1.5), Bono.Hightes) mPlay Bono.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) '= Rob4 xtrig = %True END IF END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN mPlay Bono.channel, xnoot, %False RESET xnoot END IF END IF IF l THEN MM_Bono_Off %MM_Lights l = %False END IF END IF IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN ' ynoot = MIN(34 - sens + (gesture.speedup(1)* 1.5), Autosax.Hightes) ' mPlay Autosax.channel,ynoot , MIN(gesture.speedup_val(1) * 2, 127) ' ynoot = MIN(22 - sens + (gesture.speedup(1) * 1.5), So.hightes) ' mPlay So.channel, ynoot, MIN(Gesture.speedup_val(1) * 2, 127) IF ynoot THEN NoteOff Thunderwood.channel, ynoot 'zoniet hebben we plaknoten natuurlijk.... ynoot = MIN(gesture.speedup(1)/2, Thunderwood.hightes) 'exclude rathet: 15, windmachine, 24, storm, 25 IF ynoot = 15 THEN ynoot = 14 IF ynoot = 24 THEN ynoot = 23 IF ynoot = 25 THEN ynoot = 26 mPlay Thunderwood.channel, ynoot , MIN(Gesture.speedup_val(1)* 2, 127) IF ISFALSE ytrig THEN MM_Thunderwood_Off %MM_Green MM_Thunderwood_On %MM_Red ytrig = %true END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN NoteOff Thunderwood.channel, ynoot RESET ynoot END IF END IF IF ytrig THEN MM_Thunderwood_Off %MM_Red MM_Thunderwood_On %MM_Green RESET ytrig END IF END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN znoot = MIN(34 - sens + (gesture.speedup(2)* 1.5), Puff.Hightes) mPlay Puff.channel, znoot, MIN(gesture.speedup_val(2) * 2, 60) IF ISFALSE ztrig THEN mPlay Puff.channel, 120, 0 'red ztrig = %True END IF ELSE IF znoot THEN IF ISFALSE gesture.speedup_dur(2) THEN mPlay Puff.channel, 120, 127 'red RESET znoot END IF END IF RESET ztrig END IF IF Gesture.speedup(3) > (sens * 10) THEN 'was * 6 'piperola-perc. here mPlay Piperola.channel, 120 + (Gesture.speedup(3) MOD 8), 100 'overgenomen uit de originele namuda studie: IF gesture.speedup(3) > (gesture.slowdown(3) + (sens * 4)) THEN mPlay Llor.channel, MIN(Llor.lowtes + gesture.speedup(3) - (sens*10),Llor.Hightes), MIN(@pDoppler.zf , 127) 'experiment END IF END IF END SUB SUB RoboFeat1_Stop () MM_Thunderwood_Off MM_Puff_Off MM_Bono_Off END SUB SUB RoboFeat2 () '%Robofeat2 - edgy property STATIC noot AS CURRENCY STATIC wind, Spekfak AS SINGLE STATIC cnt, xtrig, ytrig, ztrig, Basenote, Bominoot, BomiNoot2, Bominoot3 AS LONG IF ISFALSE Task(%Robofeat2).tog THEN IF ISFALSE cnt THEN Basenote = 20 spekfak = 1.3 ELSE Basenote = Basenote + 8 'augmented fifth (20 semitones) IF Basenote > 35 THEN Basenote = 24 + ( Basenote MOD 12) END IF END IF INCR cnt MM_Piano_On MM_Simba_On MM_Bomi_On RESET Bominoot, Bominoot2, Bominoot3 Task(%Robofeat2).tog = %True END IF IF gesture.edgy_dur(0) THEN IF ISFALSE xtrig THEN MM_Piano_On %MM_Yellow MM_Piano_Off %MM_Blue xtrig = %True END IF ELSE IF xtrig THEN MM_Piano_On %MM_Blue MM_Piano_Off %MM_Yellow xtrig = %False END IF END IF IF gesture.edgy_dur(1) THEN IF ISFALSE ytrig THEN MM_Bomi_On %MM_Yellow MM_Bomi_Off %MM_Red IF Task(%Robofeat2).pan THEN 'set with OS-button in cockpit SELECT CASE cnt 'added 18.10.2010 CASE 5, 6 BomiNoot = 60 + (Basenote MOD 24) Bominoot2 = Matchspecnote(MIN(Bomi.lowtes+ (gesture.edgy(1) *28 ), bomi.hightes),BaseNote, Spekfak) IF Bominoot2 = Bominoot THEN Bominoot2 += 12 mPlay Bomi.channel, BomiNoot, 48 mPlay Bomi.channel, BomiNoot2, 48 Controller Bomi.channel, 1, 90 Controller Bomi.channel, 11, 100 + (cnt MOD 9) 'speed Controller Bomi.channel, 12, 38 CASE 7, 8 BomiNoot = Matchspecnote(MIN(Bomi.lowtes+ (gesture.edgy(0) *28 ), bomi.hightes),BaseNote, Spekfak) Bominoot2 = Matchspecnote(MIN(Bomi.lowtes+ (gesture.edgy(1) *28 ), bomi.hightes),BaseNote, Spekfak) IF BomiNoot2 = Bominoot THEN Bominoot2 += 12 mPlay Bomi.channel, BomiNoot, 48 mPlay Bomi.channel, BomiNoot2, 48 Controller Bomi.channel, 1, 90 Controller Bomi.channel, 11, 100 + (cnt MOD 9) 'speed Controller Bomi.channel, 12, 38 CASE > 8 BomiNoot = Matchspecnote(MIN(Bomi.lowtes+ (gesture.edgy(0) *28 ), bomi.hightes),BaseNote, Spekfak) Bominoot2 = Matchspecnote(MIN(Bomi.lowtes+ (gesture.edgy(1) *28 ), bomi.hightes),BaseNote, Spekfak) IF BomiNoot2 = Bominoot THEN Bominoot2 += 12 Bominoot3 = Matchspecnote(MIN(Bomi.lowtes+ (gesture.edgy(2) *28 ), bomi.hightes),BaseNote, Spekfak) IF Bominoot3 = Bominoot THEN Bominoot3 += 10 mPlay Bomi.channel, BomiNoot, 48 mPlay Bomi.channel, BomiNoot2, 48 mPlay Bomi.channel, Bominoot3, 48 Controller Bomi.channel, 1, 90 Controller Bomi.channel, 11, 100 + (cnt MOD 9) 'speed Controller Bomi.channel, 12, 38 END SELECT END IF ytrig = %True END IF ELSE IF ytrig THEN MM_Bomi_On %MM_Red MM_Bomi_Off %MM_Yellow IF cnt > 5 THEN IF BomiNoot THEN NoteOff Bomi.channel, Bominoot : RESET BomiNoot IF BomiNoot2 THEN NoteOff Bomi.channel,Bominoot2 : RESET Bominoot2 IF Bominoot3 THEN NoteOff Bomi.channel, Bominoot3 : RESET Bominoot3 END IF ytrig = %False END IF END IF IF gesture.edgy_dur(2) THEN IF ISFALSE ztrig THEN MM_Simba_On %MM_Yellow MM_Simba_Off %MM_White mPlay Simba.channel, 58, MIN(gesture.edgy(2) * 127, 127) 'Left arm motor mPlay Simba.channel, 59, 127 ztrig = %True END IF ELSE IF ztrig THEN ' was ytrig, bug killed 04.09.2011 gwr MM_Simba_On %MM_White MM_Simba_Off %MM_Yellow NoteOff Simba.channel, 58 NoteOff Simba.channel, 59 ztrig = %False END IF END IF IF gesture.edgy_dur(3) THEN 'if edgy, we select toypi noot = Matchspecnote(MIN(toypi.lowtes + 7 + (gesture.edgy(0) *28 ), toypi.hightes),BaseNote, Spekfak) AddNote2Har Toypi.Har(1), noot,@pDoppler.xa * 127 noot = Matchspecnote(MIN(toypi.lowtes + 7 + (gesture.edgy(1) *28 ), toypi.hightes),BaseNote, Spekfak) AddNote2Har Toypi.Har(1), noot,@pDoppler.xa * 127 noot = Matchspecnote(MIN(toypi.lowtes + 7 + (gesture.edgy(2) *28 ), toypi.hightes),BaseNote, Spekfak) AddNote2Har Toypi.Har(1), noot,@pDoppler.xa * 127 InstrumPlay Toypi MM_Toypi_On %MM_Lights ELSE MM_Toypi_Off END IF END SUB SUB RoboFeat2_Stop () Controller Bomi.channel, 1, 0 Controller Bomi.channel, 11, 0 Controller Bomi.channel, 12, 0 MM_Toypi_Off MM_Simba_Off MM_Bomi_Off MM_Piano_Off END SUB '********************** Korn & Ob with movement ******************************* FUNCTION Init_ZwiepZwaai AS LONG ClearTasks Task(%Korn_Pirplay).naam = "PirKorn" Task(%Korn_PirPlay).freq = 100 Task(%Korn_PirPlay).cptr = CODEPTR(Korn_PirPlay) TaskEx(%Korn_PirPlay).stopcptr = CODEPTR(Korn_PirPlay_Stop) 'MM_Korn_Off Task(%freezeOb).naam = "FreezeOb" Task(%freezeOb).freq = 12 Task(%freezeOb).cptr = CODEPTR(FreezeOb) TaskEx(%freezeOb).stopcptr = CODEPTR(MM_Ob_Off) Task(%SmoothKlar).naam = "SmoothKlar" Task(%SmoothKlar).freq = 12 Task(%SmoothKlar).cptr = CODEPTR(SmoothKlar) TaskEx(%SmoothKlar).stopcptr = CODEPTR(MM_Klar_Off) Task(%Move_Puff).naam = "ZZ_Puff" Task(%Move_Puff).freq = 12 Task(%Move_Puff).cptr = CODEPTR(Move_Puff) TaskEx(%Move_Puff).stopcptr = CODEPTR(MM_Puff_Off) Task(%Move_Simba).naam = "ZZ_Simba" Task(%Move_Simba).freq = 11 Task(%Move_Simba).cptr = CODEPTR(Move_Simba) TaskEx(%Move_Simba).stopcptr = CODEPTR(MM_Simba_Off) Task(%Move_Psch).naam = "ZZ_Psch" 'works on collision Task(%Move_Psch).freq = 256 Task(%Move_Psch).cptr = CODEPTR(Move_Psch) TaskEx(%Move_Psch).stopcptr = CODEPTR(MM_Psch_Off) Task(%Move_TW).naam = "ZZ_Thun" 'springers & thunderwood Task(%Move_TW).freq = 256 Task(%Move_TW).cptr = CODEPTR(Move_TW) TaskEx(%Move_TW).stopcptr = CODEPTR(Move_TW_Off) #IF %DEF(%zwiep2013) Task(%freezeOb).freq = 4 Task(%smoothKlar).freq = 1 ' Task(%Korn_pirplay).freq = 1 #ENDIF END FUNCTION SUB Korn_PirPlay () 'connect Korn midi output to midi port 1 !!!!!!!!!!!!!!!!!!!!! 'to be used for Zwiep en Zwaai... 'Korn firmware version must be > 2.2 'STATIC init AS DWORD STATIC nv, note, cnt AS INTEGER STATIC lft, rght, cc AS SINGLE STATIC nextcc AS LONG IF ISFALSE Task(%Korn_Pirplay).tog THEN MM_Korn_On 'send defaults Controller Korn.channel, 90, 1 'best algorithm currently - nicely integrated data ,while 2 and 3 are fast all/nothing alterations Controller Korn.channel, 100, 3 'sends the information from both pir sensors as pitchbend Controller Korn.channel, 101, 5 'set datarate to 20 hz Controller Korn.channel, 31, 110 'fast movement speed Controller Korn.channel, 32, 64 'default accel./decel ramps RESET cnt Task(%Korn_Pirplay).tog = %True END IF nv = GetPitchbendRaw(0, %remove OR %oldest) IF nv > -1 THEN ' logfile "left raw" + STR$(nv) lft = (2 * lft + (255 - nv)/13)/3 'light integration as signal is integrated already, compensate for the fact that values come in 'upside down', convert to range of Korn ' logfile "cooked"+ STR$(lft) END IF nv = GetPitchBendRaw(1, %remove OR %oldest) IF nv > -1 THEN ' logfile "right raw" + STR$(nv) rght = (2 * rght + (255 - nv)/13)/3 ' logfile "cooked"+ STR$(rght) END IF INCR cc #IF NOT %DEF(%zwiep2013) IF ISFALSE cc MOD 12 THEN 'task runs at freq 100 - we check only once every 15 steps if we should play something #ELSE IF cc >= nextcc THEN nextcc = cc + 12 + 48 * (1 - MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za))^2 #ENDIF SELECT CASE MAX(lft, rght) CASE < 1 'nothing 'INCR cnt CASE lft note = MIN( 94, 72 + lft) IF ISFALSE cnt MOD 2 THEN note = Gray(note) AddNote2Har Korn.Har(1),note , MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 ' 64 'áctually should never reach 94 CASE rght note = MAX(52, 72 - rght) IF ISFALSE cnt MOD 2 THEN note = Gray(note) AddNote2Har Korn.Har(1),note , MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) * 127 '64 END SELECT Task(%Korn_Pirplay).Har = Korn.Har(1) 'required for harmony procedures INCR cnt InstrumPlay Korn END IF END SUB SUB Korn_Pirplay_Stop () Controller Korn.channel, 90, 0 Controller Korn.channel, 100, 0 Controller Korn.channel, 123, 0 END SUB SUB FreezeOb () 'to do: add dynamics. STATIC lastmovupdate AS DWORD STATIC lastmovvalue AS BYTE LOCAL note AS BYTE IF ISFALSE Task(%FreezeOb).tog THEN MM_Ob_On Task(%FreezeOb).tog = %True END IF IF ((gesture.freeze(0)) OR (gesture.freeze(1)) OR (gesture.freeze(2))) AND ( MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) > .06) THEN #IF %DEF(%zwiep2013) IF Task(%freezeob).freq < 12 THEN Task(%freezeob).freq = MIN(12, Task(%freezeOb).Freq * 1.1) #ENDIF logfile "frozen with amp" + STR$( MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za)) IF lastmovupdate < (timegettime - 2000) THEN 'as movement takes some time, we don't send new directions more then twice a second SELECT CASE lastmovvalue CASE < 65 'move up : note values under 25 don't make sense lastmovvalue = MIN(127, lastmovvalue + RND * 100) 'assymetrical, so Korn is more likely to point in front CASE > 87 'move down lastmovvalue = MAX(25, lastmovvalue - RND * 60) CASE ELSE 'choose randiom direction lastmovvalue = MIN(25, MAX(127, lastmovvalue + CHOOSE (1 + INT(RND * 2), 1, -1) * RND * 60)) END SELECT Ob.ctrl(23) = 70 Controller Ob.channel, 23, 70 'put ctrl 23 high for start of the movement Controller Ob.channel, 22, lastmovvalue lastmovupdate = timegettime END IF 'play some note, dependent on lastmovvalue?? note = Ob.lowtes + lastmovvalue/3 + MIN(200, timegettime - lastmovupdate)/400 - INT(RND * 3) 'produces small random movement around centre hbound to position.. AddNote2Har Ob.har(1), note, 64 'as we're standing still, getting velocity from movement params doesnt'make much sense.. Task(%FreezeOb).Har = Ob.har(1) InstrumPlay Ob Ob.ctrl(123) = 0 'what would be the effect of this??? just a flag.(gwr) Controller Ob.channel, 17, MAX(15, 75 - 50 * (timegettime - lastmovupdate)/ 2000) MM_Ob_On %MM_Lights ELSE #IF %DEF(%zwiep2013) IF Task(%freezeob).freq > 4 THEN Task(%freezeob).freq = MAX(4, Task(%freezeOb).Freq / 1.1) #ENDIF 'çan we stop movement wherever we are? IF ISFALSE Ob.ctrl(123) THEN Controller Ob.channel, 123, 127 'the param is irrelevant. = notes off Ob.ctrl(123) = 127 END IF END IF 'half a second after a new movement we adapt it's cc 23, so ob can stabilise IF (Ob.ctrl(23) = 70) AND (lastmovupdate < (timegettime - 750)) THEN SELECT CASE lastmovvalue CASE < 31: Ob.ctrl(23) = 27 CASE < 71: Ob.ctrl(23) = 20 'very approximately - maybe we have to make finer divisions CASE < 83: Ob.ctrl(23) = 26 CASE 83: Ob.ctrl(23) = 30 CASE < 93: Ob.ctrl(23) = 42 CASE < 98: Ob.ctrl(23) = 60 CASE 98: Ob.ctrl(23) = 78 'from here we get reversal: instead of slowing down we only get full power after half a sec CASE 99: Ob.ctrl(23) = 99 CASE ELSE: Ob.ctrl(23) = 127 END SELECT Controller Ob.channel, 23, Ob.ctrl(23) END IF ' InstrumPlay Ob 'either plays new note or performs note off END SUB SUB SmoothKlar () 'to do: add dynamics. STATIC lastmovupdate AS DWORD STATIC lastmovvalue AS BYTE LOCAL note AS BYTE LOCAL velo AS BYTE IF ISFALSE Task(%Smoothklar).tog THEN MM_Ob_On Task(%Smoothklar).tog = %True END IF #IF %DEF(%zwiep2013) Task(%smoothklar).freq = MAX(2, MIN(12, (6 * task(%smoothklar).freq + MAX(@pDoppler.xf, @pDoppler.yf, @pDoppler.zf)/7)/7)) logfile STR$(Task(%smoothklar).freq ) #ENDIF IF (gesture.smooth_dur(3) > 0) AND (MAX(@pDoppler.xa, @pDoppler.ya, @pDoppler.za) > .2)THEN IF lastmovupdate < (timegettime - 4000) THEN 'as movement takes some time, we don't send new directions more then twice a second SELECT CASE lastmovvalue CASE < 65 'move up : note values under 25 don't make sense lastmovvalue = MIN(127, lastmovvalue + RND * 100) 'assymetrical, so Korn is more likely to point in front CASE > 87 'move down lastmovvalue = MAX(1, lastmovvalue - RND * 100) CASE ELSE 'choose randiom direction lastmovvalue = MIN(1, MAX(127, lastmovvalue + CHOOSE (1 + INT(RND * 2), 1, -1) * RND * 60)) END SELECT ' Ob.ctrl(23) = 70 ' Controller Ob.channel, 23, 70 'put ctrl 23 high for start of the movement Controller Klar.channel, 22, lastmovvalue lastmovupdate = timegettime END IF 'play some note, dependent on lastmovvalue?? note = Klar.lowtes + lastmovvalue/3 + MIN(200, timegettime - lastmovupdate)/400 - INT(RND * 3) 'produces small random movement around centre hbound to position.. velo = MIN(127, 30 + 1.5 * (Klar.HighTes - note)) AddNote2Har Klar.har(1), note, velo 'as we're standing still, getting velocity from movement params doesnt'make much sense.. Task(%Smoothklar).Har = Klar.har(1) InstrumPlay Klar Klar.ctrl(123) = 0 'what would be the effect of this??? just a flag.(gwr) Controller Klar.channel, 7, MAX(15, 75 - 40 * (timegettime - lastmovupdate)/ 2000) MM_Klar_On %MM_Lights ELSE 'çan we stop movement wherever we are? IF ISFALSE Klar.ctrl(123) THEN Controller Klar.channel, 123, 127 'the param is irrelevant. = notes off Ob.ctrl(123) = 127 END IF END IF ' 'half a second after a new movement we adapt it's cc 23, so ob can stabilise ' IF (Ob.ctrl(23) = 70) AND (lastmovupdate < (timegettime - 750)) THEN ' SELECT CASE lastmovvalue ' CASE < 31: Ob.ctrl(23) = 27 ' CASE < 71: Ob.ctrl(23) = 20 'very approximately - maybe we have to make finer divisions ' CASE < 83: Ob.ctrl(23) = 26 ' CASE 83: Ob.ctrl(23) = 30 ' CASE < 93: Ob.ctrl(23) = 42 ' CASE < 98: Ob.ctrl(23) = 60 ' CASE 98: Ob.ctrl(23) = 78 'from here we get reversal: instead of slowing down we only get full power after half a sec ' CASE 99: Ob.ctrl(23) = 99 ' CASE ELSE: Ob.ctrl(23) = 127 ' END SELECT ' Controller Ob.channel, 23, Ob.ctrl(23) ' END IF ' InstrumPlay Ob 'either plays new note or performs note off END SUB SUB Move_Puff () 'for Zwiep en Zwaai 'should activate the Puff eyes with a suitable algo. LOCAL n1,n2,n3 AS CUR LOCAL v AS BYTE LOCAL nt1, nt2 AS INTEGER LOCAL d AS SINGLE IF ISFALSE Task(%Move_Puff).tog THEN IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Controller Puff.channel, 66, 127 Controller Puff.channel, 90, 1 '4 'pir eyes, relaxed algo. Task(%Move_Puff).tog = %True END IF 'some quartertone harmony... nt1 = GetHighestNote(Task(%Korn_Pirplay).Har, 48, 100) ' GetStrongest(Task(%Korn_Pirplay).Har) IF nt1 = -1 THEN n1=0 ELSE n1= HIBYT(nt1) nt2 = GetHighestNote(Task(%FreezeOb).Har, 55, 120) ' GetStrongest(Task(%FreezeOb).Har) IF nt2 = -1 THEN n2 = 0 ELSE n2= HIBYT(nt2) IF n1 AND n2 THEN v = LOBYT(nt2) d = HH_Triad(50,n1,n2,n3, 0.1) 'this will calculate a note n3 AddNote2Qhar Puff.Qhar(1), n3, v / 2 QInstrumplay Puff END IF END SUB SUB Move_Simba () 'for Zwiep en Zwaai STATIC ztrig AS LONG IF ISFALSE Task(%Move_Simba).tog THEN ztrig = %False MM_Simba_On Task(%Move_Simba).tog = %True END IF IF gesture.edgy_dur(2) THEN IF ISFALSE ztrig THEN MM_Simba_On %MM_Yellow MM_Simba_Off %MM_White mPlay Simba.channel, 58, MIN(gesture.edgy(2) * 127, 127) 'Left arm motor mPlay Simba.channel, 59, 127 ztrig = %True END IF ELSE IF ztrig THEN MM_Simba_On %MM_White MM_Simba_Off %MM_Yellow NoteOff Simba.channel, 58 NoteOff Simba.channel, 59 ztrig = %False END IF END IF END SUB SUB Move_Psch () '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 STATIC xtrig, ytrig, ztrig, strig, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Move_Psch).tog THEN 'start gesture analyser!!! IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser RESET lites sens = 1.4 '14/10 Task(%Move_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 ' mPlay Thunderwood.channel, 0, 127 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 ' mPlay Thunderwood.channel, 0, %False RESET lites END IF IF strig THEN IF gesture.collision(3) > sens THEN RESET strig END IF END IF END IF END SUB SUB Move_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(%Move_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(%Move_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 Move_TW_Off () MM_Thunderwood_Off MM_Springers_Off END SUB '--------------------------------------------------------------------------------------------------------------- '< Icy Vibes > code 'Rehearsed 05.12.2010. 'requirements: wait time before startbutton, so that we can do the teflon snow theatrics. 'the piece should run completely without an operator behind the PC. 'Rehearsed 12.12.2010. FUNCTION Init_IcyVibes AS LONG ' creates the cockpit tasks on startup ' this is the first procedure called after selection of the piece in the dropdown box. ' LOCAL snowdur, t, tog AS DWORD ' snowdur = 30000 'in ms ' t = timegetTime + snowdur ClearTasks Task(%vbt0).naam = "IcyVibes" Task(%vbt0).cptr = CODEPTR(Vibi_t0) Task(%vbt0).freq = 5 Task(%vbt0).Har.vel = STRING$(128,0) TaskEX(%vbt0).startCptr = CODEPTR(Vibes_Start) ' creates the cockpit in the first version, now done here. TaskEX(%vbt0).stopCptr =CODEPTR(Vibes_Stop) ' wait for snowing action to complete, before startup: Task(%vbt9).naam = "Icy_Intro" Task(%vbt9).cptr = CODEPTR(Icy_Intro) Task(%vbt9).freq = 10 Task(%vbt1).naam = "ViTim1" Task(%vbt1).freq = 1 Task(%vbt1).cptr = CODEPTR(Vibi_t1) Task(%vbt1).Har.vel = STRING$(128,0) Task(%vbt2).naam = "ViTim2" Task(%vbt2).freq = 1 Task(%vbt2).cptr = CODEPTR(Vibi_t2) Task(%vbt2).Har.vel = STRING$(128,0) Task(%vbt3).naam = "ViTim3" Task(%vbt3).freq = 1 Task(%vbt3).cptr = CODEPTR(Vibi_t3) Task(%vbt3).Har.vel = STRING$(128,0) Task(%vbt4).naam = "ViTim4" Task(%vbt4).freq = 1 Task(%vbt4).cptr = CODEPTR(Vibi_t4) Task(%vbt4).Har.vel = STRING$(128,0) Task(%vbt5).naam = "ViMots" Task(%vbt5).freq = 1 Task(%vbt5).cptr = CODEPTR(Vibi_t5) Task(%vbt5).Har.vel = STRING$(128,0) ' for bomi, harma & piperola in Task(%vbt6).naam = "PipHar" Task(%vbt6).freq = 3 Task(%vbt6).cptr = CODEPTR(Vibi_t6) Task(%vbt6).Har.vel = STRING$(128,0) Task(%vbt6).flags = %False '%MIDI_TASK Task(%vbt6).tog = %False Task(%vbt7).naam = "White" Task(%vbt7).freq = 20 Task(%vbt7).cptr = CODEPTR(IceLite) Task(%vbt7).Har.vel = STRING$(128,0) Task(%vbt8).naam = "Blue" Task(%vbt8).freq = 21 Task(%vbt8).cptr = CODEPTR(IceBlue) Task(%vbt8).Har.vel = STRING$(128,0) ChangeCockpitTasks %vbt0 ' DO ' INCR tog ' IF ISFALSE tog MOD INT(1 + (RND(1) * 3)) THEN ' MM_AllLightsOn %MM_White ' else ' MM_AllLightsOff %MM_White ' end if ' SLEEP 50 ' LOOP UNTIL timeGetTime >= t IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser starttask %vbt9 ' starttask %vbt0 'autostart END FUNCTION SUB Vibi_t0 () ' based on meta-task for by Godfried-Willem Raes, october 2001. ' changed for interactivity with Namuda, for , 2010 ' reused 15.08.2019 with Emilie. STATIC denscnt AS BYTE STATIC dynacnt AS BYTE LOCAL seconds AS CUR IF ISFALSE Task(%vbt0).tog THEN ' IF Task(%vbt1).tog THEN stoptask %vbt1 ' IF Task(%vbt2).tog THEN stoptask %vbt2 ' IF Task(%vbt3).tog THEN stoptask %vbt3 ' IF Task(%vbt4).tog THEN stoptask %vbt4 ' IF Task(%vbt5).tog THEN stoptask %vbt5 Slider(0).tag = "Dens" Slider(1).tag = "Dyna" SetDlgItemText gh.Cockpit, %GMT_TEXT_SLIDER0, Slider(0).tag SetDlgItemText gh.Cockpit, %GMT_TEXT_SLIDER1, Slider(1).tag Slider(0).value = 1 denscnt = 1 SendMessage Slider(0).h, %TBM_SETPOS,%True, Slider(0).value Slider(1).value = 10 dynacnt = 10 SendMessage Slider(1).h, %TBM_SETPOS,%True, Slider(1).value SetDlgItemText gh.Cockpit, %GMT_MSG1, "" ' App.komposduur = 420 '(7'00"+ intro with snow ) was 390 (6'30") 'was 675 = 11'25" Task(%vbt0).tog = %True ' App.tstart = timeGetTime ' Runtime %True EXIT SUB END IF Task(%vbt0).freq = 1 'should not be slower than the timing resolution in the score. ' scoring for automatic build up at start and stop... seconds = ((timegettime - App.tstart) / 1000) SELECT CASE seconds CASE >= App.Komposduur '700 StopTask %vbt0 EXIT SUB CASE >= App.Komposduur * 0.98518 '665 IF task(%vbt1).tog THEN stoptask %vbt1 task(%vbt0).freq = 1.5 CASE > = App.Komposduur * 0.9674 '653 IF task(%vbt2).tog THEN stoptask %vbt2 task(%vbt0).freq = 1.1 CASE >= App.Komposduur * 0.9451 '638 IF task(%vbt3).tog THEN stoptask %vbt3 Task(%vbt0).freq = 0.9 CASE >= App.Komposduur * 0.91852 '620 IF task(%vbt4).tog THEN stoptask %vbt4 Task(%vbt0).freq = 0.6 CASE >= App.Komposduur * 0.8888 '600 IF task(%vbt5).tog THEN stoptask %vbt5 Task(%vbt0).freq = 0.6 CASE >= App.Komposduur * 0.22222'150 Task(%vbt0).freq = seconds / App.Komposduur 'was: (seconds/1000) '0.15Hz to 0.6Hz CASE >= 70 'App.Komposduur * 0.1 '67 IF ISFALSE Task(%vbt5).tog THEN starttask %vbt5 CASE >= 55 ' App.Komposduur * 0.08148 '55 IF ISFALSE Task(%vbt4).tog THEN starttask %vbt4 CASE >= 40 'App.Komposduur * 0.058259 '40" IF ISFALSE Task(%vbt3).tog THEN starttask %vbt3 CASE >= 28 'App.Komposduur * 0.045 '28" IF ISFALSE Task(%vbt8).tog THEN starttask %vbt8 'blue lites CASE >= 25 '24.5 'App.Komposduur * 0.035 ' 24.5" 0.0326 '22" IF ISFALSE Task(%vbt6).tog THEN starttask %vbt6 'piperola-harma-bomi task why is this one failing??? - because the task freq was 0.1... END IF CASE >=14 ' App.Komposduur * 0.02 '14" IF ISFALSE Task(%vbt2).tog THEN starttask %vbt2 CASE >= 0 IF ISFALSE Task(%vbt7).tog THEN starttask %vbt7 'white lites IF ISFALSE Task(%vbt1).tog THEN starttask %vbt1 END SELECT 'following has to become interactivity controlled: dynacnt = (seconds \2) AND &H7F ' was (seconds \ 3) AND &H7F ' - minimum duration for 1 cycle = 381" = 6'21" IF dynacnt < 2 THEN dynacnt = 2 denscnt = (seconds \3) AND &H7F ' was (seconds \ 5) AND &H7F ' - minimum duration for 1 cycle = 635" = 10'35" IF denscnt <1 THEN denscnt = 1 IF Slider(0).value <> denscnt THEN slider(0).value = denscnt SendMessage Slider(0).h, %TBM_SETPOS,%True, Slider(0).value END IF IF Slider(1).value <> dynacnt THEN slider(1).value = dynacnt SendMessage Slider(1).h, %TBM_SETPOS,%True, Slider(1).value END IF END SUB SUB Vibes_Start () Runtime %False App.komposduur = 420 '(7'00"+ intro with snow ) was 390 (6'30") 'was 675 = 11'25" IF Task(%vbt1).tog THEN stoptask %vbt1 IF Task(%vbt2).tog THEN stoptask %vbt2 IF Task(%vbt3).tog THEN stoptask %vbt3 IF Task(%vbt4).tog THEN stoptask %vbt4 IF Task(%vbt5).tog THEN stoptask %vbt5 IF Task(%vbt6).tog THEN stoptask %vbt6 App.tstart = timeGetTime Runtime %True MM_Pos_Off %MM_Motor ' added 12.08.2019 ' ' creates the cockpit tasks on startup ' Task(%vbt1).naam = "ViTim1" ' Task(%vbt1).freq = 1 ' Task(%vbt1).cptr = CODEPTR(Vibi_t1) ' Task(%vbt1).Har.vel = STRING$(128,0) ' ' Task(%vbt2).naam = "ViTim2" ' Task(%vbt2).freq = 1 ' Task(%vbt2).cptr = CODEPTR(Vibi_t2) ' Task(%vbt2).Har.vel = STRING$(128,0) ' ' Task(%vbt3).naam = "ViTim3" ' Task(%vbt3).freq = 1 ' Task(%vbt3).cptr = CODEPTR(Vibi_t3) ' Task(%vbt3).Har.vel = STRING$(128,0) ' ' Task(%vbt4).naam = "ViTim4" ' Task(%vbt4).freq = 1 ' Task(%vbt4).cptr = CODEPTR(Vibi_t4) ' Task(%vbt4).Har.vel = STRING$(128,0) ' ' Task(%vbt5).naam = "ViMots" ' Task(%vbt5).freq = 1 ' Task(%vbt5).cptr = CODEPTR(Vibi_t5) ' Task(%vbt5).Har.vel = STRING$(128,0) ' ' ' for bomi, harma & piperola in ' Task(%vbt6).naam = "PipHar" ' Task(%vbt6).freq = 3 ' Task(%vbt6).cptr = CODEPTR(Vibi_t6) ' Task(%vbt6).Har.vel = STRING$(128,0) ' Task(%vbt6).flags = %False '%MIDI_TASK ' ' Task(%vbt7).naam = "White" ' Task(%vbt7).freq = 20 ' Task(%vbt7).cptr = CODEPTR(IceLite) ' Task(%vbt7).Har.vel = STRING$(128,0) ' ' Task(%vbt8).naam = "Blue" ' Task(%vbt8).freq = 21 ' Task(%vbt8).cptr = CODEPTR(IceBlue) ' Task(%vbt8).Har.vel = STRING$(128,0) ' ' ChangeCockpitTasks %vbt0 END SUB SUB Vibes_Stop () ' stopcode for IF Task(%vbt1).tog THEN stoptask %vbt1 IF Task(%vbt2).tog THEN stoptask %vbt2 IF Task(%vbt3).tog THEN stoptask %vbt3 IF Task(%vbt4).tog THEN stoptask %vbt4 IF Task(%vbt5).tog THEN stoptask %vbt5 IF Task(%vbt6).tog THEN stoptask %vbt6 MM_Piperola_Off %MM_Notes MM_Harma_Off %MM_Notes MM_Bomi_Off END IF IF Task(%vbt7).tog THEN stoptask %vbt7 'white 'MM_Off %MM_Blue END IF IF Task(%vbt8).tog THEN stoptask %vbt8 'blue END IF IF Task(%vbt9).tog THEN stoptask %vbt9 MM_Vibi_Off Slider(0).tag = "---" Slider(1).tag = "---" SetDlgItemText gh.Cockpit, %GMT_TEXT_SLIDER0, Slider(0).tag SetDlgItemText gh.Cockpit, %GMT_TEXT_SLIDER1, Slider(1).tag ' delete the tasks from the cockpit: Task(%vbt1).naam = "" Task(%vbt1).cptr = %False Task(%vbt2).naam = "" Task(%vbt2).cptr = %False Task(%vbt3).naam = "" Task(%vbt3).cptr = %False Task(%vbt4).naam = "" Task(%vbt4).cptr = %False Task(%vbt5).naam = "" Task(%vbt5).cptr = %False Task(%vbt6).naam = "" Task(%vbt6).cPtr = %False Task(%vbt7).naam = "" Task(%vbt7).cPtr = %False Task(%vbt8).naam = "" Task(%vbt8).cPtr = %False Task(%vbt9).naam = "" Task(%vbt9).cptr = %False Task(%vbt0).naam = "" ' Task(%vbt0).cptr = %False 'could crash... ChangeCockpitTasks -1 '%vbt0 ' parameter= calling task, otherwize the check in the task gets lost. runtime %False END SUB SUB Vibi_t1 () LOCAL demping AS BYTE LOCAL note AS BYTE LOCAL velo AS BYTE STATIC oldnote AS BYTE STATIC oldvelo AS BYTE IF ISFALSE task(%vbt1).tog THEN task(%vbt1).tog = %True DO note = Vibi.lowtes + (RND(1) * 37) IF IsNoteInHar (Task(%Vbt1).Har, note) THEN note = %False LOOP UNTIL note > %False demping = 60 + (oldvelo /2) IF oldnote THEN Release Vibi.channel, oldnote, demping DelNote2Har Task(%Vbt1).Har, oldnote oldnote = %False END IF Velo = 1 + (RND(1) * Slider(1).value) '120) ' cockpit slider 1 = dynamics Velo = MAX(@pDoppler.xa * 127, @pDoppler.ya * 127, @pDoppler.za * 127, velo) IF Velo > 127 THEN velo = 127 mPlay Vibi.channel, note, velo AddNote2Har Task(%Vbt1).Har, note, velo oldnote = note oldvelo = velo Task(%vbt1).Freq = 0.05 + (RND(1) * Slider(0).value / 32!) '2) ' cockpit slider 0 = density END SUB SUB Vibi_t2 () LOCAL demping AS BYTE LOCAL note AS BYTE LOCAL velo AS BYTE STATIC oldnote AS BYTE IF ISFALSE task(%vbt2).tog THEN task(%vbt2).tog = %True DO note = 60 + (RND(1) * 37) IF IsNoteInHar (Task(%Vbt1).Har, note) THEN note = %False LOOP UNTIL note > %False demping = 18 + (RND(1) * 80) IF oldnote THEN 'Vibi_HoldUp oldnote, demping, 64 Release Vibi.channel, oldnote, demping DelNote2Har Task(%Vbt1).Har, oldnote oldnote = %False END IF Velo = 1 + (RND(1) * Slider(1).value) Velo = MAX(@pDoppler.xa * 127, @pDoppler.ya * 127, @pDoppler.za * 127, velo) IF velo > 127 THEN velo = 127 mPlay Vibi.channel, note, velo AddNote2Har Task(%Vbt1).Har, note, velo oldnote = note Task(%vbt2).Freq = 0.05 + (RND(1) * Slider(0).value/ 32!) END SUB SUB Vibi_t3 () LOCAL demping AS BYTE LOCAL note AS BYTE LOCAL velo AS BYTE STATIC oldnote AS BYTE IF ISFALSE task(%vbt3).tog THEN task(%vbt3).tog = %True DO note = 60 + (RND(1) * 37) IF IsNoteInHar (Task(%Vbt1).Har, note) THEN note = %False LOOP UNTIL note > %False demping = 18 + (RND(1) * 64) IF oldnote THEN Release Vibi.channel, oldnote, demping DelNote2Har Task(%Vbt1).Har, oldnote oldnote = %False END IF Velo = 1 + (RND(1) * Slider(1).value) Velo = MAX(@pDoppler.xa * 127, @pDoppler.ya * 127, @pDoppler.za * 127, velo) IF velo > 127 THEN velo = 127 mPlay Vibi.channel, note, velo AddNote2Har Task(%Vbt1).Har, note, velo oldnote = note Task(%vbt3).Freq = 0.05 + (RND(1) * Slider(0).value / 32!) END SUB SUB Vibi_t4 () LOCAL demping AS BYTE LOCAL note AS BYTE LOCAL velo AS BYTE STATIC oldnote AS BYTE IF ISFALSE task(%vbt4).tog THEN task(%vbt4).tog = %True DO note = 60 + (RND(1) * 37) IF IsNoteInHar (Task(%Vbt1).Har, note) THEN note = %False LOOP UNTIL note > %False demping = 16 + (RND(1) * 80) IF oldnote THEN Release Vibi.channel, oldnote, demping DelNote2Har Task(%Vbt1).Har, oldnote oldnote = %False END IF Velo = 1 + (RND(1) * Slider(1).value) Velo = MAX(@pDoppler.xa * 127, @pDoppler.ya * 127, @pDoppler.za * 127, velo) IF velo > 127 THEN velo =127 mPlay Vibi.channel, note, velo AddNote2Har Task(%Vbt1).Har, note, velo oldnote = note Task(%vbt4).Freq = 0.05 + (RND(1) * Slider(0).value / 32!) END SUB SUB Vibi_t5 () ' motor control task... LOCAL n AS BYTE LOCAL nrdiat AS BYTE LOCAL nrkrom AS BYTE STATIC oldkrom AS BYTE STATIC olddiat AS BYTE IF ISFALSE task(%vbt5).tog THEN task(%vbt5).tog = %True FOR n = 60 TO 96 SELECT CASE n MOD 12 CASE 0,2,4,5,7,9,11 IF IsNoteInHar (Task(%Vbt1).Har, n) THEN INCR nrdiat CASE ELSE IF IsNoteInHar (Task(%Vbt1).Har, n) THEN INCR nrkrom END SELECT NEXT n IF nrdiat <> olddiat THEN Controller Vibi.channel, 20, RND(1) * 127 olddiat = nrdiat END IF IF nrkrom <> oldkrom THEN Controller Vibi.channel, 21, RND(1) * 127 oldkrom = nrkrom END IF Task(%vbt5).freq = 2 + RND(1) END SUB SUB Vibi_t6 () ' piperola & harma task - plays the difference tones between the strongest 2 vibraphone pitches. ' we also use harma, for fractional pitches here... 'extreme high to tubi 'to do: add subbas on HarmO or HybrLo LOCAL note, nv AS INTEGER LOCAL pipflag AS BYTE LOCAL notefrac AS SINGLE STATIC note1 AS BYTE ' oldnote for piperola STATIC note2 AS BYTE ' oldnote for Harma STATIC bominote AS BYTE ' STATIC qtnote AS BYTE LOCAL hi_note, hi_velo, lo_note, lo_velo AS BYTE LOCAL dif, sum AS SINGLE STATIC pipduur, harduur AS DWORD STATIC HarmaWind AS SINGLE IF ISFALSE Task(%vbt6).tog THEN Task(%vbt6).freq = 4 ProgChange Harma.channel,&B00001111 MM_Harma_On %MM_Motor Controller Harma.channel,7,8 ' motor low value MM_Piperola_ON %MM_Motor 'geeft geen wind!!! Controller Piperola.channel, 7, 35 MM_Bomi_On MM_Tubi_On Task(%vbt6).tog = %True EXIT SUB END IF IF Pipduur THEN IF TimegetTime > Pipduur THEN IF note1 THEN noteoff Piperola.channel, note1 note1 = %False IF bominote THEN noteoff Bomi.channel, bominote bominote = %False pipduur = %False END IF END IF IF Harduur THEN IF timegetTime > Harduur THEN ' note off harma IF note2 THEN noteoff Harma.channel, note2 RESET note2, Harduur END IF END IF Task(%vbt6).Har.vel = Task(%vbt1).Har.vel FillHarType Task(%vbt6).Har fillHarType Task(%vbt1).har note = GetStrongest(Task(%vbt1).Har,1) ' returns 0-11 IF note = -1 THEN EXIT SUB DelShNo2Har Task(%vbt6).Har,note fillHarType Task(%vbt6).Har note = GetStrongest(Task(%vbt6).Har,1) IF note = -1 THEN EXIT SUB DelShNo2Har Task(%vbt6).Har,note fillHarType Task(%vbt6).Har Task(%vbt5).har.vel = CommonHar$(Task(%vbt1).Har,Task(%vbt6).Har) ' this now contains only the weakest notes... Task(%vbt6).Har.vel = AbsDifHar$(Task(%vbt1).Har,Task(%vbt5).Har) ' returns the notes in vbt1 that are NOT also in vbt5 ' so now we should have isolated the 2 strongest notes in their original position... ' lets now retrieve these two notes: nv = GetHighestNote (Task(%vbt6).Har,60,96) IF nv = -1 THEN EXIT SUB ELSE hi_note = HIBYT(nv) hi_velo = LOBYT(nv) DelNote2Har Task(%vbt6).Har, hi_note END IF nv = GetHighestNote (Task(%vbt6).Har,60,96) IF nv = -1 THEN EXIT SUB ELSE lo_note = HIBYT(nv) lo_velo = LOBYT(nv) 'DelNote2Har Task(%vbt6).Har, lo_note END IF dif = DifTone(hi_note,lo_note) IF dif = %False THEN EXIT SUB notefrac = F2NF(dif) 'fractional midinote IF notefrac =< %False THEN EXIT SUB 'orchestration @ Bomi: IF (notefrac >= bomi.lowtes) AND (notefrac <= bomi.hightes) THEN IF FRAC(notefrac) < 0.2 THEN bominote = FIX(notefrac) IF FRAC(notefrac) > 0.8 THEN bominote = FIX(notefrac) + 1 IF bominote THEN PlayDur Bomi.channel, bominote, 22, 150 + (RND(1) * 3000) Controller Bomi.channel, 1, 90 Controller Bomi.channel, 11, MIN(gesture.speedup_val(0) * 10, 127) 'speed Controller Bomi.channel, 12, 38 END IF END IF 'orchestration @ tubi: IF notefrac > 96 THEN 'kan eigenlijk niet, de hoogst mogelijke verschiltoon met vibi is 93.5 AddNote2QHar Tubi.qhar(1), notefrac, MIN(gesture.flue_val(3) * 127, 48) 'QInstrumPlay Tubi END IF ' sumtones for tubi: ----------------------------------------------------- sum = Sumtone(hi_note, lo_note) IF sum THEN AddNote2QHar Tubi.qhar(1), F2NF(sum),MIN(gesture.flue_val(3) * 127, 32) 'note range must be 72.5- 107 QInstrumPlay Tubi END IF SELECT CASE notefrac CASE < piperola.lowtes pipflag = %False note = FIX(notefrac) CASE ELSE SELECT CASE FRAC(notefrac) CASE < 0.25 '33 note = FIX(notefrac) pipflag = %True CASE > 0.75 '66 note = FIX(notefrac) + 1 pipflag = %True CASE ELSE ' quartertones for harma... note = FIX(notefrac) + 1 pipflag = %False END SELECT END SELECT IF pipflag THEN IF note > piperola.hightes THEN DO note = note - 12 LOOP UNTIL note =< piperola.hightes END IF IF note < piperola.lowtes THEN 'kan niet voorvallen.. DO note = note + 12 LOOP UNTIL note >= piperola.lowtes END IF ELSE ' harma case... ' here we can use the average velo value to steer the motor! IF note > Harma.hightes THEN DO note = note - 12 LOOP UNTIL note < Harma.hightes END IF IF note < Harma.lowtes THEN DO note = note + 12 LOOP UNTIL note > Harma.lowtes END IF END IF IF note1 THEN IF note <> note1 THEN noteoff Piperola.channel,note1 note1 = %False ELSE EXIT SUB END IF END IF IF note2 THEN IF note <> note2 THEN noteoff Harma.channel, note2 note2 = %False ELSE EXIT SUB END IF END IF IF pipflag THEN IF note <> note1 THEN mPlay Piperola.channel,note,64 pipduur = Timegettime + 150 + (RND(1) * 3000) note1 = note END IF ELSE HarmaWind = MIN(120, (6 * HarmaWind + 10 + (lo_velo + hi_velo)/1.5) / 7) Controller Harma.channel,7, HarmaWind '/ 2 ' motor pressure IF note <> note2 THEN mPlay Harma.channel,note,MAX(lo_velo,hi_velo) IF note < 48 THEN harduur = TimegetTime + 1000 + (RND(1) * 6000) ELSE harduur = Timegettime + 500 + (RND(1) * 4000) END IF note2 = note END IF END IF Task(%vbt6).freq = 4 END SUB SUB Icelite () '%vbt7 - white lites 'collision trigger @ white strobo's 'white lights on , ,,,,, , , , , , sens THEN IF ISFALSE xtrig THEN mPlay Vibi.channel, 121, 127 KeyPress Vibi.channel, 121, MIN(Gesture.impact(0) * 255, 127) 'white LED mPlay Vibi.channel, 123, 127 KeyPress Vibi.channel, 123, MIN(Gesture.impact(0) * 255, 127) 'white LED MM_Bono_On %MM_White MM_Hybr_On %MM_White xtrig = %True END IF ELSE IF xtrig THEN MM_Vibi_Off %MM_White MM_Bono_Off %MM_White MM_Hybr_Off %MM_White RESET xtrig END IF END IF IF Gesture.collision(1) > sens THEN IF ISFALSE ytrig THEN MM_Bomi_On %MM_White MM_Korn_On %MM_White MM_Per_On %MM_White ytrig = %true END IF ELSE IF ytrig THEN RESET ytrig MM_Bomi_Off %MM_Lights MM_Korn_Off %MM_White MM_Per_Off %MM_White END IF END IF IF Gesture.collision(2) > sens THEN IF ISFALSE ztrig THEN MM_Puff_On %MM_White MM_Ob_On %MM_White ' MM_HarmO_On %MM_White MM_Piano_On %MM_White ' added 12.08.2019 MM_Pos_On %MM_White ztrig = %True END IF ELSE IF ztrig THEN MM_Puff_Off %MM_White MM_Ob_Off %MM_White ' MM_HarmO_Off %MM_White MM_Piano_Off %MM_White MM_Pos_Off %MM_White RESET ztrig END IF END IF 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 mPlay Thunderwood.channel, 0, 127 lites = %True END IF ELSE IF lites THEN 'licht uit. MM_So_Off %MM_White MM_Troms_Off %MM_Lights MM_Heli_Off %MM_Lights mPlay Thunderwood.channel, 0, %False RESET lites END IF IF strig THEN IF gesture.collision(3) > sens THEN RESET strig END IF END IF END IF END SUB SUB IceBlue () 'interactive coding for the blue lights - %vbt8 'blue in: Qt, Korn, Springers, Autosax, Pedal, Bomi, Llor, Per, Snar ' theatrical collision trigger STATIC xtrig, ytrig, ztrig, strig, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%vbt8).tog THEN 'start gesture analyser!!! IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser RESET lites sens = 1 Task(%vbt8).tog = %True END IF ' on theatrical collision, do something... ' sens = Slider(slnr).value / 10 IF Gesture.theacol(0) > sens THEN IF ISFALSE xtrig THEN MM_Piano_On %MM_Blue MM_Qt_On %MM_Blue 'KeyPress piano.channel, 127, MIN(Gesture.impact(0) * 255, 127) 'white LED xtrig = %True END IF ELSE IF xtrig THEN MM_Piano_Off %MM_Blue MM_Qt_Off %MM_Blue RESET xtrig END IF END IF IF Gesture.theacol(1) > sens THEN IF ISFALSE ytrig THEN MM_Llor_On %MM_Blue MM_Korn_On %MM_Blue ytrig = %true END IF ELSE IF ytrig THEN RESET ytrig MM_Llor_Off %MM_Blue MM_Korn_Off %MM_Blue END IF END IF IF Gesture.theacol(2) > sens THEN IF ISFALSE ztrig THEN MM_Ob_On %MM_blue 'velo could be flashing speed MM_Psch_On %MM_Blue ztrig = %True END IF ELSE IF ztrig THEN MM_Ob_Off %MM_blue MM_Psch_Off %MM_Blue RESET ztrig END IF END IF IF gesture.theacol(3) THEN IF ISFALSE lites THEN 'licht MM_Snar_On %MM_Blue Controller Springers.channel, 70, MIN(gesture.impact(3) * 127,127) Springers.ctrl(70) = 64 'MM_Autosax_On %MM_Blue fault in implementation!!! MM_Per_On %MM_Blue MM_Fa_On %MM_Blue lites = %True END IF ELSE IF lites THEN 'licht uit. MM_Snar_Off %MM_Blue '` MM_Springers_Off %MM_Blue - not implmented ' MM_Autosax_Off %MM_Blue - pic implementation fault. Controller Springers.channel, 70, %False Springers.ctrl(70) = %False MM_Per_Off %MM_Blue MM_Fa_Off %MM_Blue RESET lites END IF IF strig THEN IF gesture.theacol(3) > sens THEN RESET strig END IF END IF END IF END SUB SUB Icy_Intro () '%vbt9 'in deze intro wordt het lichaam van de uitvoerder besneeuwd. Er zijn alleen witte flitsen. 'voor de kreatie gebruikte we Teflon sneeuw 'evt. toe te voegen: subbasnoot on HybrLo STATIC tog, t , snowdur AS DWORD IF ISFALSE Task(%vbt9).tog THEN snowdur = 30000 'in ms - duur aanpassen aan regie. t = timegetTime + snowdur tog = %False Task(%vbt9).tog = %True MM_Pos_Off %MM_Motor END IF INCR tog IF ISFALSE tog MOD INT(1 + (RND(1) * 3)) THEN MM_AllLightsOn %MM_White ELSE MM_AllLightsOff %MM_White END IF IF timeGetTime >= t THEN MM_AllLightsOff %MM_White stoptask %vbt9 starttask %vbt0 'autostart END IF END SUB '------------------------------------------------------------------------------------- FUNCTION Init_Poly () AS LONG ' Polyamori - voor stem, altviool, Namuda dans en robotorkest. ' premiere 10.02.2011 door Dominica Eyckmans. LOCAL n, i AS LONG LOCAL z AS SINGLE GLOBAL Py AS Poly_2011 Py.Ser(0) = 36 : Py.ser(1) = 39 : Py.ser(2) = 44 : Py.ser(3) = 47 Py.ser(4) = 40 : Py.ser(5) = 38 : Py.ser(6) = 46 : Py.ser(7) = 42 Py.ser(8) = 41 : Py.ser(9) = 43 : Py.ser(10) = 45 : Py.ser(11) = 37 ' inversion: Py.SerInv(0) = 48 Py.SerInv(1) = 45 ' -3 Py.SerInv(2) = 40 '-5 Py.SerInv(3) = 37 ' -3 Py.SerInv(4) = 44 ' +7 Py.SerInv(5) = 46 ' +2 Py.SerInv(6) = 38 ' -8 Py.SerInv(7) = 42 ' +4 Py.SerInv(8) = 43 ' +1 Py.SerInv(9) = 41 ' -3 Py.SerInv(10) = 39 ' -2 Py.SerInv(11) = 47 ' +8 ' durational series: Py.Dur(0) = 2/3 ' 1/3 Py.Dur(1) = 1/3 Py.dur(2) = 1/2 Py.dur(3) = 3/5 '1/2 Py.dur(4) = 4/5 '2/3 Py.dur(5) = 1/5 Py.dur(6) = 3/4 ' 2/3 Py.dur(7) = 6/5 ' 1 Py.dur(8) = 5/4 '1 Py.dur(9) = 2/5 '1/5 Py.dur(10) = 1 '3/5 Py.dur(11) = 1/4 ' 3/5 ' normalize this: 'n = ArrayMax_SNG (Py.dur) ' does not work with array's in types FOR i = 1 TO 11 IF Py.dur(i) > Py.dur(i-1) THEN z = Py.dur(i) ' find maximum value NEXT i FOR i = 0 TO 11 Py.dur(i) = Py.dur(i) / z ' now normalized to the 0-1 range NEXT i ClearTasks IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Poly0).naam = "Poly 0" Task(%Poly0).cptr = CODEPTR(Poly_0) Task(%Poly0).freq = 1 Task(%Poly0).flags = %False Task(%Poly1).naam = "Poly 1" Task(%Poly1).cptr = CODEPTR(Poly_1) Task(%Poly1).freq = 4 Task(%Poly1).flags = %False ' TaskEX(%Poly1).stopcptr = CODEPTR(MM_Aeio_Off) Task(%Poly2).naam = "Poly 2" Task(%Poly2).cptr = CODEPTR(Poly_2) Task(%Poly2).freq = 8 Task(%Poly2).flags = %False TaskEX(%Poly2).stopcptr = CODEPTR(MM_Bomi_Off) Task(%Poly3).naam = "Poly 3" Task(%Poly3).cptr = CODEPTR(Poly_3) Task(%Poly3).freq = 8 Task(%Poly3).flags = %False Task(%Poly4).naam = "Poly 4" Task(%Poly4).cptr = CODEPTR(Poly_4) Task(%Poly4).freq = 12 Task(%Poly4).flags = %False TaskEX(%Poly4).stopcptr = CODEPTR(MM_Toypi_Off) Task(%Poly5).naam = "Poly 5" Task(%Poly5).cptr = CODEPTR(Poly_5) 'aeio-flageolets Task(%Poly5).freq = 20 Task(%Poly5).flags = %False Task(%Poly6).naam = "Poly 6" 'bourdonola-vibi Task(%Poly6).cptr = CODEPTR(Poly_6) Task(%Poly6).freq = 16 Task(%Poly6).flags = %False TaskEX(%Poly6).stopcptr = CODEPTR(MM_Bourdonola_Off) Task(%Poly7).naam = "Poly 7" 'piano Task(%Poly7).cptr = CODEPTR(Poly_7) Task(%Poly7).freq = 0.5 Task(%Poly7).flags = %False TaskEX(%Poly7).stopcptr = CODEPTR(MM_Piano_Off) Task(%Poly8).naam = "Poly 8" 'puff Task(%Poly8).cptr = CODEPTR(Poly_8) Task(%Poly8).freq = 7 Task(%Poly8).flags = %False TaskEX(%Poly8).stopcptr = CODEPTR(MM_Puff_Off) Task(%Poly9).naam = "Poly 9" 'xy Task(%Poly9).cptr = CODEPTR(Poly_9) Task(%Poly9).freq = 7 ' 12 'maybe too fast Task(%Poly9).flags = %False TaskEX(%Poly9).stopcptr = CODEPTR(MM_Xy_Off) Task(%Poly10).naam = "Poly 10" 'xy Task(%Poly10).cptr = CODEPTR(Poly_10) Task(%Poly10).freq = 30 Task(%Poly10).flags = %False TaskEX(%Poly10).stopcptr = CODEPTR(MM_Aeio_Off) MM_HarmO_Off FUNCTION = %True END FUNCTION SUB Poly_0 () ' metatask - scoring LOCAL i AS DWORD IF ISFALSE Task(%Poly0).tog THEN RESET Py.tik Task(%Poly0).freq = 1 ' tiktempo MM 60 Task(%Poly0).tog = %True END IF Py.prop = MIN(Py.tik / 360, 1) ' 360 = 6' , 600 = 10' Py.angle = Py.prop * Pi 'in rad. , semicircle Py.spekfak = 1.75 + (SIN(Py.angle) / 2) INCR Py.tik SELECT CASE Py.tik CASE 15 IF ISFALSE Task(%Poly1).tog THEN StartTask %Poly1 ' aeio CASE 30 IF ISFALSE Task(%Poly2).tog THEN StartTask %Poly2 ' bomi CASE 45 IF ISFALSE Task(%Poly3).tog THEN StartTask %Poly3 ' so display CASE 60 IF ISFALSE Task(%Poly4).tog THEN StartTask %Poly4 ' toypi CASE 75 IF ISFALSE Task(%Poly5).tog THEN starttask %Poly5 ' flageolets on aeio CASE 90 IF ISFALSE task(%Poly6).tog THEN starttask %Poly6 ' vibi-bourdonola CASE 120 IF ISFALSE Task(%Poly7).tog THEN starttask %Poly7 ' piano CASE 180 IF ISFALSE Task(%Poly9).tog THEN StartTask %POly9 ' xy CASE 230 IF ISFALSE Task(%Poly8).tog THEN starttask %Poly8 ' puff CASE 260 IF Task(%Poly2).tog THEN stoptask %Poly2 CASE 290 IF Task(%Poly8).tog THEN stoptask %Poly8 CASE 333 IF Task(%Poly5).tog THEN stoptask %Poly5 CASE 334 IF Task(%Poly1).tog THEN stoptask %Poly1 CASE 335 IF ISFALSE Task(%Poly10).tog THEN starttask %Poly10 ' aeio flageolets CASE 350 MM_Qt_On CASE 351 ' slotnoot AddNote2Har Qt.har(1), Py.ser(Py.aeio_cnt), 36 AddNote2Har Qt.har(1), Py.ser(Py.bomi_cnt), 36 AddNote2Har Qt.har(1), Py.serinv(Py.aeio_cnt), 36 AddNote2Har Qt.har(1), Py.serinv(Py.bomi_cnt), 36 Instrumplay Qt CASE 352 TO 359 Controller Qt.channel, 7, Qt.ctrl(7) * 0.7 ' decrescendo CASE 360 MM_Qt_Off FOR i = %Poly1 TO %Poly9 IF Task(i).tog THEN stoptask i NEXT i CASE > 360 IF ISFALSE Task(%Poly10).tog THEN MM_AllOff StopTask %Poly0 END IF END SELECT END SUB SUB Poly_1 () LOCAL i AS LONG STATIC sens AS SINGLE STATIC it, oldnote, trig , cnt, lite AS LONG IF ISFALSE Task(%Poly1).tog THEN 'initialisatie van aeio: MM_Aeio_On Controller Aeio.channel, 7, 120 'maybe too loud. Controller Aeio.channel, 23, 64 'Controller Aeio.channel, 64, 64 'sustain ON : no dampers sens = 18 ' 0.05 cnt = 0 Slider(0).value = 5 'cockpit upper slider, user for hammer force SendMessage Slider(0).h, %TBM_SETPOS,%True, Slider(0).value Slider(1).value = 6 'cockpit lower slider, used for damping force (time) Sendmessage Slider(1).h, %TBM_SETPOS, %True, Slider(1).value Task(%Poly1).tog = %True END IF 'try playing on accelleration property IF gesture.speedup(3) > gesture.slowdown(3) + sens THEN IF ISFALSE Trig THEN AddNote2Har Aeio.har(1), Py.ser(it), 127 mPlay Aeio.channel, Py.ser(it), 127 ' + 12 would be octave up 'with hammers: mPlay Aeio.channel, 24 + ((Py.ser(it)) MOD 12), Slider(0).value '10 'soft Py.aeio = Py.ser(it) Py.aeio_cnt = it INCR it it = it MOD 12 Trig = %True INCR cnt ELSE ' IF cnt > 2 THEN ' was 24 ' Controller Aeio.channel, 100 + (Py.aeio MOD 12), 1 + (cnt mod 5) ' flageolet number ctrl ' END IF 'we can further modulate the tone here... END IF ELSE IF Py.aeio THEN Release Aeio.channel, Py.aeio, Slider(1).value RESET Py.aeio, cnt ' oldnote = %False END IF RESET Trig END IF ' lights? IF Py.aeio THEN SELECT CASE it MOD 12 CASE 0,3,6,9 MM_Aeio_On %MM_Yellow CASE 1,4,7,10 MM_Aeio_On %MM_Red CASE 2,5,8,11 MM_Aeio_On %MM_Blue END SELECT lite = %True ELSE IF lite THEN MM_Aeio_Off %MM_Lights RESET lite END IF END IF END SUB SUB Poly_2 () 'Bomi - slowdown property LOCAL angle, n AS SINGLE LOCAL wind AS INTEGER STATIC noot, tog, lite, sens, it AS INTEGER IF ISFALSE Task(%Poly2).tog THEN RESET it MM_Bomi_On sens = 12 Task(%Poly2).tog = %True END IF noot = Py.ser(it) +24 ' 19 ' duodecime 'interaktieve modulatie: IF gesture.slowdown(3) > sens AND gesture.slowdown(3) > gesture.speedup(3) THEN addNote2Har Bomi.Har(1), noot, @pDoppler.xa * 127 ' reekstoon Py.bomi = noot ' add spectral notes!!! n = Spectralnote (noot, MIN(gesture.slowdown(0)/ 5, 20), Py.spekfak, %ExpSpec) addNote2Har Bomi.har(1), n, @pDoppler.xa * 127 n = Spectralnote (noot, MIN(gesture.slowdown(1)/5,20), Py.spekfak, %ExpSpec) addNote2Har Bomi.har(1), n, @pDoppler.ya * 127 n = Spectralnote (noot, MIN(gesture.slowdown(2)/5,20), Py.spekfak, %ExpSpec) addNote2Har Bomi.har(1), n, @pDoppler.za * 127 InstrumPlay Bomi tog = %True Py.bomi_cnt = it INCR it it = it MOD 12 ELSE IF tog THEN instrumplay Bomi RESET Py.bomi, tog END IF END IF 'windmodulatie in funktie van bewegingssnelheid: wind = MIN(10 + gesture.fixspeed_val(3), 127) ' range to be checked. IF wind <> bomi.ctrl(7) THEN Controller Bomi.channel, 7, wind Bomi.ctrl(7) = wind END IF 'lights: IF wind > %MM_Bomi_Motor THEN IF ISFALSE lite THEN MM_Bomi_On %MM_Lights lite = %True END IF ELSE IF lite THEN MM_Bomi_Off %MM_Lights RESET lite END IF END IF ' tempo te modeleren met oppervlakte lichaam: Task(%Poly2).freq = 8 * (gesture.flue_val(3) + 0.5) END SUB SUB Poly_3 () LOCAL n AS INTEGER IF ISFALSE Task(%Poly3).tog THEN Controller So.channel, 14, 1 ' display funktie So.ctrl(14) = 1 Task(%Poly3).tog = %True END IF So.Har(1).vel = SumHar$(Bomi.Har(0), Aeio.Har(0)) ' Har(0) gives the sounding note! n = GetStrongest (So.Har(1), 1) IF n > -1 THEN IF So.ctrl(15) <> 60 + (n MOD 12) THEN Controller So.channel,15, 60 + (n MOD 12) ' display vocal pitch So.ctrl(15) = 60 + (n MOD 24) END IF ELSE Controller So.channel, 15, 0 So.ctrl(15) = 0 END IF END SUB SUB Poly_4 () ' toypi task LOCAL noot, n AS INTEGER STATIC cnt, lites AS DWORD IF ISFALSE Task(%Poly4).tog THEN RESET cnt Task(%Poly4).tog = %True END IF noot = Py.aeio ' GetStrongest (Aeio.har(0),1) IF noot THEN n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(0)/ 5, 20), Py.spekfak, %ExpSpec) addNote2Har Toypi.har(1), n, @pDoppler.xa * 64 ' 127 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(1)/5,20), Py.spekfak, %ExpSpec) addNote2Har Toypi.har(1), n, @pDoppler.ya * 64 ' 127 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(2)/5,20), Py.spekfak, %ExpSpec) addNote2Har Toypi.har(1), n, @pDoppler.za *64 ' 127 InstrumPlay Toypi INCR cnt ELSE MM_Toypi_Off %MM_Lights RESET cnt, lites END IF ' lights: SELECT CASE cnt MOD 3 CASE 0 IF cnt THEN MM_Toypi_On %MM_White lites = %True END IF CASE 1 MM_Toypi_On %MM_Blue lites = %True CASE 2 MM_Toypi_On %MM_Yellow lites = %True END SELECT END SUB SUB Poly_5 () ' aeio flageoletten STATIC cnt AS LONG IF ISFALSE Task(%Poly5).tog THEN RESET cnt Task(%Poly5).freq = Task(%Poly1).freq * 8 ' 6 Task(%Poly5).tog = %True END IF IF Py.aeio THEN Controller Aeio.channel, 100 + (Py.aeio MOD 12), 1 + (cnt MOD 7) ' flageolet number ctrl INCR cnt ELSE RESET cnt END IF END SUB SUB Poly_6 () ' spaarzame interjekties LOCAL n, noot AS INTEGER IF ISFALSE Task(%Poly6).tog THEN MM_Bourdonola_On MM_Vibi_On Task(%Poly6).tog = %True END IF ' if (Py.aeio > %False) and (Py.bomi > %False) then ' kan dit eigenlijk wel? ' If (Py.aeio MOD 12) = (Py.bomi MOD 12) then IF Py.aeio_cnt = Py.bomi_cnt THEN Bourdonola.Har(1).vel = NUL$(128) AddNote2Har Bourdonola.Har(1), 36 + ((Py.ser(Py.aeio_cnt)) MOD 12), 127 PlayHarDur Bourdonola.channel, Bourdonola.Har(1), Py.dur(Py.aeio_cnt) * 1000 ' Instrumplay Bourdonola - this resulted in way too short notes. ' vibi: noot = Py.aeio MOD 12 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(0)/ 5, 20), Py.spekfak, %ExpSpec) addNote2Har Vibi.har(1), n, @pDoppler.xa * 64 ' 127 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(1)/5,20), Py.spekfak, %ExpSpec) addNote2Har Vibi.har(1), n, @pDoppler.ya * 64 ' 127 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(2)/5,20), Py.spekfak, %ExpSpec) addNote2Har Vibi.har(1), n, @pDoppler.za *64 ' 127 InstrumPlay Vibi END IF ' InstrumPlay Bourdonola Instrumplay Vibi ' end if END SUB SUB Poly_7 () ' use durations in series Py.dur() LOCAL noot, n AS LONG STATIC it AS INTEGER IF ISFALSE Task(%Poly7).tog THEN MM_Piano_On RESET it Task(%Poly7).freq = 0.5 Task(%Poly7).tog = %True END IF ' PlayDur Piano.channel, 36 + (Py.ser(Py.bomi_cnt) MOD 12), @pDoppler.xa * 64, Py.dur(Py.bomi_cnt) * 1000 IF Task(%Poly2).tog THEN IF Py.bomi > 0 THEN AddNote2Har Piano.Har(1), 36 + ((Py.ser(Py.bomi_cnt)) MOD 12), @pDoppler.xa * 64 END IF noot = Py.ser(Py.bomi_cnt) MOD 12 ' Py.bomi mod 12 ELSE AddNote2Har Piano.Har(1), 36 + ((Py.serinv(it)) MOD 12), @pDoppler.xa * 64 noot = Py.ser(it) MOD 12 ' Py.bomi mod 12 INCR it it = it MOD 12 END IF n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(0)/ 8, 20), Py.spekfak, %ExpSpec) addNote2Har piano.har(1), n, @pDoppler.ya * 64 ' 127 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(1)/8,20), Py.spekfak, %ExpSpec) addNote2Har piano.har(1), n, @pDoppler.za * 64 ' 127 n = Spectralnote (48 + noot, MIN(gesture.fixspeed_val(2)/8,20), Py.spekfak, %ExpSpec) addNote2Har Piano.har(1), n, @pDoppler.xa *64 ' 127 'end if IF Task(%Poly2).tog THEN PlayHarDur Piano.channel, Piano.Har(1), Py.dur(Py.bomi_cnt) * 1000 ' 1000 = Task(%Poly7).freq * 2000 ELSE PlayHarDur Piano.channel, Piano.Har(1), Py.dur(it) * 1000 ' 1000 = Task(%Poly7).freq * 2000 END IF END SUB SUB Poly_8 () ' quartertones Puff LOCAL n AS SINGLE STATIC noot AS CUR STATIC tog, lite, it, sens AS INTEGER IF ISFALSE Task(%Poly8).tog THEN RESET it sens = 12 Task(%Poly8).tog = %True END IF noot = Py.ser(it) + 24 'interaktieve modulatie: IF gesture.slowdown(3) > sens AND gesture.slowdown(3) > gesture.speedup(3) THEN addNote2QHar puff.qHar(1), noot, @pDoppler.xa * 64 '127 ' reekstoon ' add spectral notes!!! n = SpectralnoteF (noot, MIN(gesture.slowdown(0)/ 10, 20), Py.spekfak, %ExpSpec) addNote2QHar Puff.qhar(1), n, @pDoppler.xa * 48 ' 127 n = SpectralnoteF (noot, MIN(gesture.slowdown(1)/10,20), Py.spekfak, %ExpSpec) addNote2qHar Puff.qhar(1), n, @pDoppler.ya * 48 ' 127 n = SpectralnoteF (noot, MIN(gesture.slowdown(2)/10,20), Py.spekfak, %ExpSpec) addNote2QHar Puff.qhar(1), n, @pDoppler.za * 48 ' 127 QInstrumPlay Puff tog = %True INCR it it = it MOD 12 IF ISFALSE lite THEN MM_Puff_On %MM_Lights lite = %True END IF ELSE IF tog THEN RESET tog END IF IF lite THEN MM_Puff_Off %MM_Lights RESET lite END IF END IF ' tempo te modeleren met oppervlakte lichaam: Task(%Poly8).freq = 7 * (gesture.flue_val(3) + 0.5) END SUB SUB Poly_9 () 'Xy - edgy property LOCAL n AS SINGLE STATIC noot, tog, it AS INTEGER IF ISFALSE Task(%Poly9).tog THEN RESET it MM_Xy_On Task(%Poly9).tog = %True END IF noot = 36 + Py.serInv(it) 'interaktieve modulatie: IF gesture.edgy_dur(3) THEN ' spectral notes on inverted series !!! n = SpectralnoteF (noot, gesture.edgy(0) * 36, Py.spekfak, %ExpSpec) addNote2QHar xy.qhar(1), n, @pDoppler.xa * 60 ' 127 n = SpectralnoteF (noot, gesture.edgy(1) * 36, Py.spekfak, %ExpSpec) addNote2QHar xy.qhar(1), n, @pDoppler.ya * 60 ' 127 n = SpectralnoteF (noot, gesture.edgy(2) * 36, Py.spekfak, %ExpSpec) addNote2QHar xy.qhar(1), n, @pDoppler.za * 60 ' 127 QInstrumPlay Xy INCR it it = it MOD 12 IF ISFALSE tog THEN MM_Xy_On %MM_Lights tog = %True END IF ELSE IF tog THEN ' Qinstrumplay Xy - note off not required. MM_Xy_Off %MM_Lights tog = %False END IF END IF Task(%Poly9).freq = 7 * (gesture.flue_val(3) + 0.5) END SUB SUB Poly_10 () ' re expositie tema op aeio - finale LOCAL i AS LONG STATIC it, fl, tog AS LONG IF ISFALSE Task(%Poly10).tog THEN RESET it, fl, tog MM_Aeio_On Controller Aeio.channel, 7, 120 'maybe too loud. Controller Aeio.channel, 23, 64 MM_Aeio_On %MM_RED Task(%Poly10).tog = %True END IF IF ISFALSE fl THEN IF Py.aeio THEN Release Aeio.channel, Py.aeio, Slider(1).value 'with hammers: i = 11 - it ' to play the krebs mPlay Aeio.channel, 24 + ((Py.ser(i)) MOD 12), 9 + it ' Slider(0).value '10 'soft mPlay Aeio.channel, Py.ser(i), 127 ' inversion? Py.aeio = Py.ser(i) Py.aeio_cnt = i INCR it it = it MOD 12 IF ISFALSE it THEN ' 1 cycle Release Aeio.channel, Py.aeio, 1 ' Slider(1).value MM_Aeio_Off stoptask %Poly10 END IF INCR fl ' this was the bug, we forgot this and never got flageolets... ELSE Controller Aeio.channel, 100 + (Py.aeio MOD 12), 1 + fl ' flageolet number ctrl IF it < 11 THEN INCR fl fl = fl MOD 24 ELSE IF ISFALSE tog THEN INCR fl fl = fl MOD 24 IF ISFALSE fl THEN tog = %True : fl = 24 ELSE DECR fl IF ISFALSE fl THEN Controller Aeio.channel, 100 + (Py.aeio MOD 12), 1 END IF END IF END IF END IF IF ISFALSE tog THEN Task(%Poly10).freq = 19 *(gesture.flue_val(3) + 0.5) * (Py.dur(it)) ELSE Task(%Poly10).freq = Task(%Poly10).freq * 0.9 ' slowdown at the end END IF END SUB ' ******************************************************************************************** FUNCTION Init_AI () AS LONG ' Namuda Study #13 ' AI - voor stem, altviool, Namuda dans en robotorkest. ' Microphone must be placed on stage on a low floorstand. ' premiere 15.03.2011 door Dominica Eyckmans. ' 27.02.2011: first rehearsal session ' TO DO: add Psch on collision gestures (non pitched percussion only) ' add harmonic coherence between tasks ' task %AI_1 must start later! ' 09-13.03.2011: further coding and research ' 13.03.2011: second rehearsal. ' also had the code for Miked and Tekstuur LOCAL n, i AS LONG LOCAL z AS SINGLE GLOBAL NamAI AS Namuda_AI_Type ClearTasks IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser ' audio input tasks: Task(%AI_0).naam = "fft" ' listens to audio input Task(%AI_0).cptr = CODEPTR(AI_0) Task(%AI_0).freq = 10 ' 1 '1, isn't that way too slow ??? Task(%AI_0).flags = %False Task(%Ai_sing).naam="single" Task(%Ai_sing).freq = 10 Task(%Ai_sing).cptr = CODEPTR(ai_single) Task(%AI_Sing).flags = %False Task(%Ai_cor).naam="cor" Task(%Ai_cor).freq = 10 Task(%Ai_cor).cptr = CODEPTR(ai_cor) Task(%AI_cor).flags = %False Task(%Ai_wavana).naam="wavana" Task(%Ai_wavana).freq = 18.8 Task(%Ai_wavana).cptr = CODEPTR(ai_wavana) Task(%AI_wavana).flags = %PERTIM_Task ' gesture task: Task(%AI_1).naam = "AI pip" ' looks at slowdown gestures Task(%AI_1).cptr = CODEPTR(AI_1) Task(%AI_1).freq = 130 Task(%AI_1).flags = %PERTIM_Task ' as in %Slowdown_Trigger used for Links. TaskEX(%AI_1).stopcptr = CODEPTR(AI_1_Stop) Task(%AI_2).naam = "AI-Dly" ' delay line Harma Task(%AI_2).cptr = CODEPTR(AI_2) Task(%AI_2).freq = 32 Task(%AI_2).flags = %False TaskEX(%AI_2).stopcptr = CODEPTR(AI_2_Stop) Task(%AI_3).naam = "AI-3" ' delay line HarmO Task(%AI_3).cptr = CODEPTR(AI_3) Task(%AI_3).freq = 16 Task(%AI_3).flags = %False TaskEX(%AI_3).stopcptr = CODEPTR(AI_3_Stop) Task(%AI_4).naam = "AI-Perc" ' collission percussion Task(%AI_4).cptr = CODEPTR(AI_4) Task(%AI_4).freq = 256 Task(%AI_4).flags = %False Task(%AI_Xy).naam = "AI-Xy" ' xy - delay line Task(%AI_Xy).cptr = CODEPTR(AI_Xy) Task(%AI_Xy).freq = 37 Task(%AI_Xy).flags = %False Task(%AI_End).naam = "AI-End" ' stop Task(%AI_End).cptr = CODEPTR(AI_End) Task(%AI_End).freq = 1 Task(%AI_End).flags = %False MM_HarmO_Off %MM_Motor '------MIKED Namuda Study #14 ------- ' audio input tasks: Task(%Miked_FFT).naam = "fft-tx" ' listens to audio input Task(%Miked_FFT).cptr = CODEPTR(Miked_FFT) Task(%Miked_FFT).freq = 16 Task(%Miked_FFT).flags = %False Task(%Miked_Gestspek).naam = "fft-ges" Task(%Miked_GestSpek).cptr = CODEPTR(Miked_GestSpek) Task(%Miked_GestSpek).freq = 12 Task(%Miked_GestSpek).flags = %False Task(%Miked_Stop).naam = "Mik_Stop" Task(%Miked_Stop).cptr = CODEPTR(Miked_Stop) Task(%Miked_Stop).freq = 1 Task(%Miked_Stop).flags = %False ' added 25.10.2015: Task(%Miked_Hybr).naam = "fftHybr" ' listens to audio input Task(%Miked_Hybr).cptr = CODEPTR(Miked_Hybr) Task(%Miked_Hybr).freq = 16 Task(%Miked_Hybr).flags = %False ' added 25.10.2015: Task(%Miked_Pno).naam = "fftPno" ' listens to audio input Task(%Miked_Pno).cptr = CODEPTR(Miked_Piano) Task(%Miked_Pno).freq = 16 Task(%Miked_Pno).flags = %False Task(%Miked_Pos).naam = "fftPos" ' listens to audio input Task(%Miked_Pos).cptr = CODEPTR(Miked_Pos) Task(%Miked_Pos).freq = 16 Task(%Miked_Pos).flags = %False Task(%Miked_Vol).naam = "Hybr_vol" Task(%Miked_Vol).cptr = CODEPTR(Miked_Vol) Task(%Miked_Vol).freq = 4 Task(%Miked_Vol).flags = %False ' voorlopig hier voor Early Birds, Namuda study # 15 Task(%E_Birds_Start).naam = "EB_Start" Task(%E_Birds_Start).cptr = CODEPTR(E_Birds_Start) Task(%E_Birds_Start).freq = 1 Task(%E_Birds_Start).flags = %False 'TaskEX(%E_Birds_Start).stopCptr = CODEPTR(E_Birds_Off) Task(%E_Birds).naam = "E_Birds" Task(%E_Birds).cptr = CODEPTR(E_Birds) Task(%E_Birds).freq = 120 Task(%E_Birds).flags = %False TaskEX(%E_Birds).stopCptr = CODEPTR(E_Birds_Off) Task(%E_Birds_slow).naam = "EB_Slow" Task(%E_Birds_slow).cptr = CODEPTR(E_Birds_slow) Task(%E_Birds_slow).freq = 111 Task(%E_Birds_slow).flags = %False ' %PERTIM_TASK '%False TaskEx(%E_Birds_slow).stopcptr = CODEPTR(E_Birds_Off) Task(%E_Birds_Tim).naam = "EB_Tim" Task(%E_Birds_Tim).cptr = CODEPTR(E_Birds_Tim) Task(%E_Birds_Tim).freq = 25 Task(%E_Birds_Tim).flags = %False ' Task(%E_Birds_AM).naam = "EB_AM" ' Task(%E_Birds_AM).cptr = CODEPTR(E_Birds_AM) ' Task(%E_Birds_AM).freq = 10 ' Task(%E_Birds_AM).flags = %False ' TaskEX(%E_Birds_AM).stopcptr = CODEPTR(E_Birds_AM_Stop) ' resets ctrl 7 Task(%E_Birds_Aft).naam = "EB_Aft" Task(%E_Birds_Aft).cptr = CODEPTR(E_Birds_Aft) Task(%E_Birds_Aft).freq = 8 Task(%E_Birds_Aft).flags = %False FUNCTION = %True END FUNCTION SUB Ai_single () 'analysis copied from Fidelc, plays strongest note on Bomi and writes it to delayline like AI_0 'two different analysis methods: with corelation, or simply with isolatesinglewave 'works more or less, but tends to circle around the right note, considerably less accurate then the fft analysis.. ' now runs at 10Hz, but can be faster. LOCAL Track AS LONG LOCAL i AS DWORD LOCAL j AS DWORD LOCAL cor AS SINGLE ' STATIC duur AS DWORD LOCAL period AS SINGLE LOCAL param AS DWORD ' 09.05.2000 STATIC noot, oldnote AS INTEGER STATIC retval AS LONG 'STATIC duur AS DWORD STATIC triglev AS SINGLE 'velo level from which we do isolatesingle.. IF ISFALSE Task(%Ai_sing).tog THEN ' IF (Task(%Ai_sing).swit AND %TASK_BUSY) = %d1 THEN EXIT SUB ' this task excludes other audio input tasks... IF Task(%Ai_0).tog THEN stoptask %Ai_0 IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana MM_Bomi_On %MM_Wind OR %MM_Motor CheckAudio Audio, App Task(%Ai_sing).tog = %True triglev = .01 'duur = 32 ' 2 x duration of 1 period of midi note 36 END IF IF TrackStatus.StreamIn THEN BIT SET param, %LeftChannel BIT SET param, %ApplyLowPass DIM Sp(%lStreamInLatencyM1) AS LOCAL SINGLE RetrieveInputWave param, Sp() ' retrieves the whole input buffer latency time (55ms) ELSE StopTask %Ai_sing END IF 'with isolatesinglewave, we get a pretty accurate result with our close miked voice as input (sometimes with octave mistakes) 'on complex signals its results seem rather random 'with less closely miked voice, it already gets shakier.. 'as long as we are having a signal. on silence we get a lot of random sounding notes, so we should monitor the signal level first.. cor = 0 FOR i = 0 TO UBOUND(sp) cor = cor + ABS(sp(i)) NEXT cor = cor / UBOUND(sp) CONTROL SET TEXT gh.cockpit, %GMT_MSG2, "vol:" + STR$(cor) IF cor > triglev THEN DIM Sw(0) AS LOCAL SINGLE period = IsolateSingleWave (Sp(),Sw()) ' g_math. kijkt naar pieken en 0-doorgangen. period is in seconds according to doc, IF UBOUND(Sw) THEN ShowNormArray gh.spec, Sw() END IF ELSE period = 0 END IF RESET Task(%ai_sing).har.vel IF period > 0 THEN CONTROL SET TEXT gh.cockpit, %GMT_MSG1, STR$(1/period) noot = f2n(1/period) ' mPlay Vibi.channel, noot, 64 'test' ' AddNote2Har Vibi.Har(1), noot, 30 ' InstrumPlay Vibi END IF AddNote2Har Task(%ai_sing).har, noot, SQR(cor) * 127 'we take square root as cor tends to stay low.. noot = GetStrongestNoteVelo (Task(%ai_sing).har) IF oldnote THEN IF HI(BYTE,noot) <> oldnote THEN WriteDelayline oldnote, %False ' note off RESET oldnote END IF END IF IF noot THEN WriteDelayline HI(BYTE,noot), LO(BYTE,noot) oldnote = HI(BYTE,noot) END IF ' logfile "h:"+ Task(%a2m).har Task(%ai_sing).har.vel = ReturnStrongestinHar(Task(%ai_sing).har, 1) ' was two notes, but in practice it are allways two notes a half step from each other TransHarm Task(%ai_sing).har, 4 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN Playhar Task(%ai_sing).har, Bomi.channel ELSE MM_Bomi_Off %MM_Notes END IF ShowHar Task(%ai_sing).Har, 1,140,2 Task(%ai_sing).freq = 10 ' does it has to be that slow? END SUB SUB Ai_cor () 'analysis copied from Fidelc, plays strongest note on Bomi and writes it to delayline like AI_0 'two different analysis methods: with corelation, or simply with isolatesinglewave 'works more or less, but tends to circle around the right note, considerably less accurate then the fft analysis.. LOCAL Track AS LONG LOCAL i AS DWORD LOCAL j AS DWORD LOCAL cor AS SINGLE ' STATIC duur AS DWORD LOCAL period AS SINGLE LOCAL param AS DWORD ' 09.05.2000 STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD STATIC triglev AS SINGLE 'velo level from which we do isolatesingle.. IF ISFALSE Task(%Ai_cor).tog THEN 'IF (Task(%Ai_cor).swit AND %TASK_BUSY) = %d1 THEN EXIT SUB ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_0).tog THEN stoptask %Ai_0 IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana MM_Bomi_On %MM_Wind OR %MM_Motor CheckAudio Audio, App Task(%Ai_cor).tog = %True triglev = .01 'duur = 32 ' 2 x duration of 1 period of midi note 36 END IF IF TrackStatus.StreamIn THEN BIT SET param, %LeftChannel BIT SET param, %ApplyLowPass DIM Sp(%lStreamInLatencyM1) AS LOCAL SINGLE RetrieveInputWave param, Sp() ' retrieves the whole input buffer latency time (55ms) ELSE StopTask %Ai_sing END IF 'with isolatesinglewave, we get a pretty accurate result with our close miked voice as input (sometimes with octave mistakes) 'on complex signals its results seem rather random 'with less closely miked voice, it already gets shakier.. 'as long as we are having a signal. on silence we get a lot of random sounding notes, so we should monitor the signal level first.. cor = 0 FOR i = 0 TO UBOUND(sp) cor = cor + ABS(sp(i)) NEXT cor = cor / UBOUND(sp) CONTROL SET TEXT gh.cockpit, %GMT_MSG2, "vol:" + STR$(cor) IF cor > triglev THEN DIM Sw(0) AS LOCAL SINGLE period = IsolateSingleWave (Sp(),Sw()) ' g_math. kijkt naar pieken en 0-doorgangen. period is in seconds according to doc, IF UBOUND(Sw) THEN ShowNormArray gh.spec, Sw() END IF ELSE period = 0 END IF RESET Task(%ai_cor).har.vel 'the following returns big clusters, that somewhat follow the input pitch FOR i = 36 TO 96 '72 cor = CorrelateNoteToWave (i,Sw()) ' now function correlates with a complete period. 'IF cor < 0 THEN cor = 0 ' happens ! but not with unipolar data... AddNote2Har Task(%Ai_cor).har, i, cor * 127 NEXT i 'the resulting note tends to circle around the right note ' better: using FUNCTION GetStrongestNoteVelo (H AS HarmType) EXPORT AS INTEGER , in g_har noot = GetStrongestNoteVelo (Task(%ai_cor).har) IF oldnote THEN IF HI(BYTE,noot) <> oldnote THEN WriteDelayline oldnote, %False ' note off RESET oldnote END IF END IF IF noot THEN WriteDelayline HI(BYTE,noot), LO(BYTE,noot) oldnote = HI(BYTE,noot) END IF ' logfile "h:"+ Task(%a2m).har Task(%ai_cor).har.vel = ReturnStrongestinHar(Task(%ai_cor).har, 1) ' was two notes, but in practice it are allways two notes a half step from each other TransHarm Task(%ai_cor).har, 4 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN Playhar Task(%ai_cor).har, Bomi.channel ELSE MM_Bomi_Off %MM_Notes END IF ShowHar Task(%ai_cor).Har, 1,140,2 Task(%ai_cor).freq = 10 END SUB SUB AI_Wavana () ' does funny things... scales on settling notes... ' = SUB WaveAnalyser () in Fidel-C '%FidelC_wavana_task = 23 ' code test for waveproperties STATIC param AS DWORD STATIC oldnote AS INTEGER LOCAL sz AS ASCIIZ * 30 'LOCAL WavProp AS WaveProperties - now part of NamAI IF ISFALSE task(%AI_Wavana).tog THEN ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_0).tog THEN stoptask %Ai_0 CheckAudio Audio, App MM_Bomi_On %MM_Wind OR %MM_Motor ' for display only ' IF ISFALSE gh.spec THEN ' StopTask %AI_Wavana ' EXIT SUB ' END IF Task(%AI_Wavana).tog = %True END IF BIT SET param, %LeftChannel BIT SET param, %ApplyLowPass IF TrackStatus.StreamIn THEN DIM Sp(%lStreamInLatencyM1) AS LOCAL SINGLE RetrieveInputWave param, Sp() ' retrieves the whole input buffer latency time (55ms) GetWaveProperties Sp(), NamAI.WavProp ' analyzer in g_math ELSE StopTask %AI_Wavana END IF ' for monitoring: ' sz = FORMAT$(wavProp.freq, "####") + " " + FORMAT$(wavProp.amplitude,"#.###") + " " + FORMAT$(wavProp.correlation,"#.###") ' SetDlgItemText gh.Cockpit, %GMT_MSG2, sz ' now we should have note in NamAI.Wavprop.note and velo in NamAI.WaveProp.velo IF oldnote THEN IF NamAI.Wavprop.note <> oldnote THEN WriteDelayline oldnote, %False ' note off DelNote2Har Task(%ai_wavana).har, oldnote RESET oldnote END IF END IF IF NamAI.Wavprop.note THEN WriteDelayline NamAI.Wavprop.note, NamAI.Wavprop.velo AddNote2Har Task(%Ai_wavana).har, NamAI.Wavprop.note, NamAI.Wavprop.velo oldnote = NamAI.Wavprop.note END IF ' logfile "h:"+ Task(%a2m).har ' Task(%ai_wavana).har.vel = ReturnStrongestinHar(Task(%ai_wavana).har, 2) ' two notes TransHarm Task(%ai_wavana).har, 4 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN Playhar Task(%ai_wavana).har, Bomi.channel ELSE MM_Bomi_Off %MM_Notes END IF ShowHar Task(%ai_wavana).Har, 1,140,2 END SUB SUB AI_0 () ' should listen to audio-input ' based on audio2midi from g_tools '07/03/2011 xof replacedvDft with higher resolution one. ' 10.03.2011: rechecked. Causes high jitter levels in GMT! LOCAL Track AS LONG LOCAL i, j, offset AS DWORD STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD IF ISFALSE Task(%ai_0).tog THEN CheckAudio Audio, App MM_Bomi_On %MM_Wind OR %MM_Motor ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana ' duur = 55 ' in ms - this is the duration of the samples ' = 2426 samples duur = 92.87 ' in ms = 4096 samples ' also the window size for the FFT Task(%ai_0).tog = %True END IF IF TrackStatus.StreamIn THEN Track = RetrieveSample (duur) ' logfile "track"+ STR$(track) ELSE StopTask %ai_0 MSGBOX "audio is not working",,FUNCNAME$ END IF SELECT CASE Track CASE 0 TO 15 ' fourier transform task to retrieve notes from audio input... ' DIM Sp(0 TO %d9-1) AS LOCAL SINGLE ' 512 lines, the complete track chunk is 2433 samples though ' DIM Sp(0 TO %d12-1) AS LOCAL SINGLE ' nr. of bands to be calculated 0-4095 DIM Sp(0 TO %d11-1) AS LOCAL SINGLE ' %d11-1 (2047, should be enough) offset = %False ' WaveDFT Track, offset, %False, Sp() WaveDFTHiRes Track, offset, %False, Sp(), 3, %d11 ' d11=2048 - FFT op 4095 samples SizeAudioTrack Track, %False Task(%ai_0).har.vel = STRING$(128,0) 'necessary?? ' Linspec2Har Sp(),Task(%ai_0).har,42.98 Linspec2Har Sp(), Task(%ai_0).har, 10.745 ' bandbreedte der spektraalbandjes Task(%ai_0).freq = 1000! / duur ' ca. 10Hz 6 works fine... , is now 18 CASE ELSE EXIT SUB END SELECT ' noot = GetStrongest (Task(%ai_0).har, 1) ' this returns note mod 12 !!! ' IF oldnote > -1 THEN ' if noot <> oldnote then ' WriteDelayline oldnote + 48, %False ' note off ' end if ' END IF ' if noot > -1 then ' WriteDelayLine noot + 48, 64 ' write to delay line, as in Cohiba etc... ' ' on leaving the code, do ClearDelayArrays (in g_midi) ' end if ' oldnote = noot ' better: using FUNCTION GetStrongestNoteVelo (H AS HarmType) EXPORT AS INTEGER , in g_har noot = GetStrongestNoteVelo (Task(%ai_0).har) IF oldnote THEN IF HI(BYTE,noot) <> oldnote THEN WriteDelayline oldnote, %False ' note off RESET oldnote END IF END IF IF noot THEN WriteDelayline HI(BYTE,noot), LO(BYTE,noot) oldnote = HI(BYTE,noot) END IF ' logfile "h:"+ Task(%a2m).har Task(%ai_0).har.vel = ReturnStrongestinHar(Task(%ai_0).har, 2) ' two notes TransHarm Task(%ai_0).har, 4 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN Playhar Task(%ai_0).har, Bomi.channel ELSE MM_Bomi_Off %MM_Notes END IF ShowHar Task(%ai_0).Har, 1,140,2 END SUB SUB AI_1 () ' derived from Domi_Slowdown_Trig () as used in Links. ' here we look only into the frequency data in 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 ' 10.03.2011: rechecked o.k. for AI STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, lites AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%ai_1).tog THEN sens = 12 MM_Piperola_On MM_Bourdonola_On Controller Bourdonola.channel, 1, 50 'low wind pressure ! IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%ai_1).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(Piperola.lowtes - sens + 2+ (gesture.slowdown_val(0)/2), Piperola.hightes) 'independent from sens 15.04 mPlay Piperola.channel, xnoot, 64 xtrig = %True END IF ELSE IF xtrig THEN IF xnoot THEN mPlay Piperola.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(Piperola.lowtes - sens + 2+ (gesture.slowdown_val(1)/2), Piperola.hightes) mPlay Piperola.channel, ynoot, 64 ytrig = %true END IF ELSE IF ytrig THEN IF ynoot THEN mPlay Piperola.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(Piperola.lowtes - sens + 2+(gesture.slowdown_val(2)/2), Piperola.hightes) mPlay Piperola.channel, znoot, 64 ztrig = %True END IF ELSE IF ztrig THEN IF znoot THEN mPlay Piperola.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 '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_Piperola_On %MM_Lights lites = %True END IF ELSE IF lites THEN MM_Piperola_Off %MM_Lights RESET lites END IF END IF IF (xnoot > %False) OR (ynoot > %False) OR (znoot > %False) THEN NamAI.robotsplaying = %True ELSE NamAI.robotsplaying = %False END IF END SUB SUB AI_1_Stop () MM_Piperola_Off %MM_Notes NamAI.robotsplaying = %False END SUB SUB AI_2 () ' This delay line outputs at normal speed but inverts the intervals ' output on Harma LOCAL nv%, noot?, velo? STATIC delaytime AS DWORD, mirrornote? IF ISFALSE Task(%AI_2).tog THEN MM_Harma_On Controller Harma.channel, 7, 42 delaytime = 2000 'units ms mirrornote? = 60 Task(%AI_2).tog = %True END IF nv% = ReadDelayLine(%AI_2, delaytime, 1!) SELECT CASE nv% CASE %False: EXIT SUB CASE %NotFalse : EXIT SUB ' if no note came in, exit the task CASE -2 ' read past present. ' This can only happen if speed! > 1! nv% = ReadDelayLine(%AI_2, 0, 0) ' force a reset StopTask %AI_2 EXIT SUB END SELECT velo? = LO(BYTE,nv%) noot? = HI(BYTE,nv%) noot? = mirrornote? + mirrornote? - noot? ' range to be checked IF noot? > 127 THEN EXIT SUB IF noot? <=0 THEN EXIT SUB ' Harma Coding: IF velo? THEN AddNote2Har Harma.Har(1), noot?, velo? InstrumPlay Harma END SUB SUB AI_2_Stop () LOCAL nv% MM_Harma_Off %MM_Notes nv% = ReadDelayLine(%AI_2, 0, 0) ' force a reset END SUB SUB AI_3 () ' backwards delay, as in Baklava, on HarmO LOCAL nv%, noot?, velo? STATIC delaytime AS DWORD STATIC Cnt AS DWORD STATIC snelheid AS SINGLE 'STATIC oln AS DWORD IF ISFALSE Task(%AI_3).tog THEN MM_HarmO_On Controller HarmO.channel, 7, 30 ' lower wind MM_HarmO_On %MM_Regs delaytime = 1000 ' 50 snelheid = - 0.9 ' -1 nv% = ReadDelayLine%(%ai_3, 0, 0) ' force a reset Task(%AI_3).tog = %True END IF nv% = ReadDelayLine%(%AI_3, delaytime, Snelheid) ' speed is negative, so we play backwards SELECT CASE nv% CASE %False, %NotFalse, -2 EXIT SUB ' if no note came in, exit the task CASE -3 ' read past delay in backwardsmode: force reset, stop task. cannot happen... ' Task(%AI_3).Har.vel = STRING$(128,0) InstrumPlay HarmO ' notes off ' nv% = ReadDelayLine%(%ai_3, 0, 0) ' force a reset Task(%ai_3).tog = %False ' force calculation of a new delay time ' StopTask %ai_3 ' stop the task. EXIT SUB END SELECT velo? = LO(BYTE,nv%) noot? = HI(BYTE, nv%) ' no transposition nor inversion of intervals. IF noot? > harmo.Hightes THEN EXIT SUB IF noot? < harmo.Lowtes THEN EXIT SUB 'IF oln THEN DelNote2Har harmo.Har(1), oln IF velo? THEN AddNote2Har harmo.Har(1), noot?, MIN(velo?, 36) ': oln = noot? Task(%ai_3).Har.vel = harmo.Har(1).vel ' for globhar InstrumPlay harmO END SUB SUB AI_3_Stop () Task(%AI_3).Har.vel = STRING$(128,0) MM_HarmO_Off %MM_Notes END SUB SUB AI_4 () ' Casta, Casta2 , Simba and Psch ' non pitched percussion on collision movements. ' collision detector - based on corresponding Namuda code (Links) ' here we look only into the acceleration data in order to detect collisions. ' we may want to make the timeframe adjustable ' the task frequency is 256Hz STATIC xtrig, ytrig, ztrig, strig, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%AI_4).tog THEN 'start gesture analyser!!! IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser MM_Simba_On RESET lites sens = 1.4 '14/10 Task(%ai_4).tog = %True END IF ' on collision, do psch... IF Gesture.collision(0) > sens THEN IF ISFALSE xtrig THEN mPlay Casta2.channel, MIN(Casta2.lowtes + ((Gesture.collision(0)) *4),Casta2.hightes), MIN(Gesture.impact(0) * 127, 127) ' logfile "casta" + STR$(Casta2.lowtes + ((Gesture.collision(0)) *4)) + STR$(Gesture.impact(0) * 127) xtrig = %True END IF ELSE RESET xtrig END IF IF Gesture.collision(1) > sens THEN IF ISFALSE ytrig THEN mPlay Casta.channel, MIN(Casta.lowtes + ((Gesture.collision(1)) *4),Casta.hightes), 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 Psch.channel, MIN(72 + ((Gesture.collision(2))*3),83), MIN(Gesture.impact(2) * 160, 127) ztrig = %True END IF ELSE RESET ztrig END IF IF gesture.collision(3) THEN IF ISFALSE lites THEN MM_Simba_On %MM_Lights lites = %True END IF IF gesture.collision(3) > sens THEN IF ISFALSE strig THEN mPlay Simba.channel, 80,MIN(Gesture.impact(3) * 180, 127) 'icebell strig = %True END IF END IF ELSE IF lites THEN MM_Simba_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 AI_Xy () ' This delay line outputs at double speed and inverts the intervals LOCAL nv%, noot?, velo? STATIC delaytime AS DWORD, mirrornote? IF ISFALSE Task(%AI_Xy).tog THEN MM_Xy_On delaytime = 5000 'units ms mirrornote? = 65 Task(%AI_Xy).tog = %True END IF nv% = ReadDelayLine(%AI_Xy, delaytime, 1.5!) SELECT CASE nv% CASE %False: EXIT SUB CASE %NotFalse : EXIT SUB ' if no note came in, exit the task CASE -2 ' read past present. ' This can only happen if speed! > 1! nv% = ReadDelayLine(%AI_Xy, 0, 0) ' force a reset 'StopTask %AI_Xy EXIT SUB END SELECT velo? = LO(BYTE,nv%) noot? = HI(BYTE,nv%) noot? = mirrornote? + mirrornote? - noot? ' range to be checked IF noot? > 127 THEN EXIT SUB IF noot? <=0 THEN EXIT SUB ' xy Coding: ' IF velo? THEN AddNote2Har Xy.Har(1), noot?, velo?/2 ' InstrumPlay Xy IF noot? < Xy.lowtes THEN DO noot? = noot? + 12 ' noot += 12 LOOP UNTIL noot? >= Xy.lowtes END IF IF velo THEN mPlay Xy.channel, noot?, MAX(velo?, 6) ' velo?/2 'mPlay Piano.channel, noot?, velo? ' for debug only END IF END SUB SUB AI_End () ' end cleanly IF ISFALSE Task(%AI_End).tog THEN MM_AllLightsOn Task(%AI_End).tog = %True EXIT SUB END IF IF Task(%AI_0).tog THEN stoptask %AI_0 IF Task(%AI_sing).tog THEN stoptask %AI_Sing IF Task(%AI_cor).tog THEN stoptask %AI_cor IF Task(%AI_Wavana).tog THEN stoptask %AI_Wavana IF Task(%AI_1).tog THEN stoptask %AI_1 IF Task(%AI_2).tog THEN stoptask %AI_2 IF Task(%AI_3).tog THEN stoptask %AI_3 IF Task(%AI_4).tog THEN stoptask %AI_4 IF Task(%AI_Xy).tog THEN stoptask %AI_Xy MM_AllOff MM_AllLightsOff stoptask %AI_End END SUB SUB Miked_FFT () ' fft speach analysis ' should listen to audio-input ' based on audio2midi from g_tools '07/03/2011 xof replacedvDft with higher resolution one. ' 10.03.2011: rechecked. Causes high jitter levels in GMT! ' 03.04.2011: back to using 1024 samples, tuning now becomes Mi. ' 21.10.2015: To be checked with Hybr and HybrHi, as these robots have much better dynamic control. LOCAL Track AS LONG LOCAL i, j, offset AS DWORD STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD IF ISFALSE Task(%Miked_FFT).tog THEN CheckAudio Audio, App MM_Qt_On %MM_Wind OR %MM_Motor OR %MM_Lights ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana IF Task(%ai_0).tog THEN stoptask %AI_0 'duur = 92.87 ' in ms = 4096 samples duur = 1000 * 1024 / 44100 ' 23ms = 1024 samples ' also the window size for the FFT duur = duur + 2 Task(%Miked_FFT).tog = %True END IF IF TrackStatus.StreamIn THEN Track = RetrieveSample (duur) ELSE StopTask %Miked_FFT MSGBOX "audio is not working",,FUNCNAME$ END IF SELECT CASE Track CASE 0 TO 15 ' fourier transform task to retrieve notes from audio input... DIM Sp(0 TO %d9-1) AS LOCAL SINGLE ' 512 spectral lines offset = %False WaveDFT Track, offset, %False, Sp() ' WaveDFTHiRes Track, offset, %False, Sp(), 3, %d11 ' d11=2048 - FFT op 4095 samples SizeAudioTrack Track, %False ' Task(%Miked_FFT).Qhar.vel = STRING$(128,0) 'necessary?? ' Linspec2Har Sp(),Task(%ai_0).har,42.98 ' Linspec2QHar Sp(), Task(%Miked_FFT).qhar, 42.98 ' 10.745 ' bandbreedte der spektraalbandjes LinSpec2QHar Sp(), Qt.qhar(1), 42.98 Task(%Miked_FFT).freq = 1000! / duur CASE ELSE EXIT SUB END SELECT TransQHarm Qt.qhar(1), -2 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN QInstrumPlay Qt ELSE MM_Qt_Off %MM_Notes END IF END SUB SUB Miked_Hybr () ' fft speach analysis ' should listen to audio-input ' based on audio2midi from g_tools '07/03/2011 xof replacedvDft with higher resolution one. ' 10.03.2011: rechecked. Causes high jitter levels in GMT! ' 03.04.2011: back to using 1024 samples, tuning now becomes Mi. ' 21.10.2015: To be checked with Hybr and HybrHi, as these robots have much better dynamic control. ' 25.10.2015: This procedure works to excellence! LOCAL Track AS LONG LOCAL i, j, offset AS DWORD STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD IF ISFALSE Task(%Miked_Hybr).tog THEN CheckAudio Audio, App 'MM_Qt_On %MM_Wind OR %MM_Motor OR %MM_Lights MM_Hybr_On ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana IF Task(%ai_0).tog THEN stoptask %AI_0 IF Task(%Miked_FFT).tog THEN stoptask %Miked_FFT 'duur = 92.87 ' in ms = 4096 samples duur = 1000 * 1024 / 44100 ' 23ms = 1024 samples ' also the window size for the FFT duur = duur + 2 Task(%Miked_Hybr).tog = %True END IF IF TrackStatus.StreamIn THEN Track = RetrieveSample (duur) ELSE StopTask %Miked_Hybr MSGBOX "audio is not working",,FUNCNAME$ END IF SELECT CASE Track CASE 0 TO 15 ' fourier transform task to retrieve notes from audio input... DIM Sp(0 TO %d9-1) AS LOCAL SINGLE ' 512 spectral lines offset = %False WaveDFT Track, offset, %False, Sp() ' WaveDFTHiRes Track, offset, %False, Sp(), 3, %d11 ' d11=2048 - FFT op 4095 samples SizeAudioTrack Track, %False ' Task(%Miked_Hybr).har.vel = STRING$(128,0) 'necessary?? ' Linspec2QHar Sp(), Task(%Miked_FFT).qhar, 42.98 ' 10.745 ' bandbreedte der spektraalbandjes LinSpec2Har Sp(), Hybr.har(1), 42.98 Task(%Miked_Hybr).freq = 1000! / duur CASE ELSE EXIT SUB END SELECT ' TransQHarm Qt.qhar(1), -2 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN 'QInstrumPlay Qt InstrumPlay Hybr ' includes HybrHi ELSE MM_Hybr_Off %MM_Notes END IF END SUB SUB Miked_RORO () ' fft speach analysis ' should listen to audio-input ' based on audio2midi from g_tools '07/03/2011 xof replacedvDft with higher resolution one. ' 10.03.2011: rechecked. Causes high jitter levels in GMT! ' 03.04.2011: back to using 1024 samples, tuning now becomes Mi. ' 21.10.2015: To be checked with Hybr and HybrHi, as these robots have much better dynamic control. LOCAL Track AS LONG LOCAL i, j, offset AS DWORD STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD IF ISFALSE Task(%Miked_FFT).tog THEN CheckAudio Audio, App MM_Roro_On %MM_Wind OR %MM_Motor OR %MM_Lights ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana IF Task(%ai_0).tog THEN stoptask %AI_0 'duur = 92.87 ' in ms = 4096 samples duur = 1000 * 1024 / 44100 ' 23ms = 1024 samples ' also the window size for the FFT duur = duur + 2 Task(%Miked_FFT).tog = %True END IF IF TrackStatus.StreamIn THEN Track = RetrieveSample (duur) ELSE StopTask %Miked_FFT MSGBOX "audio is not working",,FUNCNAME$ END IF SELECT CASE Track CASE 0 TO 15 ' fourier transform task to retrieve notes from audio input... DIM Sp(0 TO %d9-1) AS LOCAL SINGLE ' 512 spectral lines offset = %False WaveDFT Track, offset, %False, Sp() ' WaveDFTHiRes Track, offset, %False, Sp(), 3, %d11 ' d11=2048 - FFT op 4095 samples SizeAudioTrack Track, %False ' Task(%Miked_FFT).Qhar.vel = STRING$(128,0) 'necessary?? ' Linspec2Har Sp(),Task(%ai_0).har,42.98 ' Linspec2QHar Sp(), Task(%Miked_FFT).qhar, 42.98 ' 10.745 ' bandbreedte der spektraalbandjes LinSpec2Har Sp(), Roro.har(1), 42.98 Task(%Miked_FFT).freq = 1000! / duur CASE ELSE EXIT SUB END SELECT TransHarm Roro.har(1), -2 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN InstrumPlay Roro ELSE MM_Roro_Off %MM_Notes END IF END SUB SUB Miked_Vol () STATIC slnr AS LONG IF ISFALSE Task(%Miked_Vol).tog THEN IF ISFALSE Task(%Miked_Vol).hParam THEN DIM TaskParamLabels(0) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "volune" MakeTaskParameterDialog %Miked_Vol,1,Slider(),0,UDctrl(),TaskParamLabels() END IF IF ISFALSE slnr THEN slnr = TaskEX(%Miked_Vol).SliderNumbers(0) Slider(slnr).value = 64 SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value END IF Task(%Miked_Vol).tog = %TRue END IF IF Hybr.ctrl(7) <> Slider(slnr).value THEN Hybr.ctrl(7) = Slider(slnr).value Controller Hybr.channel, 7, Hybr.ctrl(7) END IF END SUB SUB Miked_Piano () ' fft speach analysis ' should listen to audio-input ' based on audio2midi from g_tools '07/03/2011 xof replacedvDft with higher resolution one. ' 10.03.2011: rechecked. Causes high jitter levels in GMT! ' 03.04.2011: back to using 1024 samples, tuning now becomes Mi. ' 21.10.2015: To be checked with Hybr and HybrHi, as these robots have much better dynamic control. ' 25.10.2015: This procedure works to excellence! LOCAL Track AS LONG LOCAL i, j, offset AS DWORD STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD IF ISFALSE Task(%Miked_Pno).tog THEN CheckAudio Audio, App 'MM_Qt_On %MM_Wind OR %MM_Motor OR %MM_Lights MM_Piano_On ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana IF Task(%ai_0).tog THEN stoptask %AI_0 IF Task(%Miked_FFT).tog THEN stoptask %Miked_FFT 'duur = 92.87 ' in ms = 4096 samples duur = 1000 * 1024 / 44100 ' 23ms = 1024 samples ' also the window size for the FFT duur = duur + 2 Task(%Miked_Pno).tog = %True END IF IF TrackStatus.StreamIn THEN Track = RetrieveSample (duur) ELSE StopTask %Miked_Hybr MSGBOX "audio is not working",,FUNCNAME$ END IF SELECT CASE Track CASE 0 TO 15 ' fourier transform task to retrieve notes from audio input... DIM Sp(0 TO %d9-1) AS LOCAL SINGLE ' 512 spectral lines offset = %False WaveDFT Track, offset, %False, Sp() ' WaveDFTHiRes Track, offset, %False, Sp(), 3, %d11 ' d11=2048 - FFT op 4095 samples SizeAudioTrack Track, %False ' Task(%Miked_Hybr).har.vel = STRING$(128,0) 'necessary?? ' Linspec2QHar Sp(), Task(%Miked_FFT).qhar, 42.98 ' 10.745 ' bandbreedte der spektraalbandjes LinSpec2Har Sp(), Piano.har(1), 42.98 Task(%Miked_Pno).freq = 1000! / duur CASE ELSE EXIT SUB END SELECT ' TransQHarm Qt.qhar(1), -2 ' transpose to avoid feedback IF ISFALSE NamAI.robotsplaying THEN 'QInstrumPlay Qt InstrumPlay Piano ' includes HybrHi ELSE MM_Piano_Off %MM_Notes END IF END SUB SUB Miked_Pos () ' fft speach analysis ' should listen to audio-input ' based on audio2midi from g_tools '07/03/2011 xof replacedvDft with higher resolution one. ' 10.03.2011: rechecked. Causes high jitter levels in GMT! ' 03.04.2011: back to using 1024 samples, tuning now becomes Mi. ' 21.10.2015: To be checked with Hybr and HybrHi, as these robots have much better dynamic control. ' 25.10.2015: This procedure works to excellence! LOCAL Track AS LONG LOCAL i, j, offset AS DWORD STATIC noot, oldnote AS INTEGER STATIC retval AS LONG STATIC duur AS DWORD IF ISFALSE Task(%Miked_Pno).tog THEN CheckAudio Audio, App 'MM_Qt_On %MM_Wind OR %MM_Motor OR %MM_Lights MM_Pos_On %MM_Wind OR %MM_Motor ' this task excludes other audio input tasks... IF Task(%Ai_sing).tog THEN stoptask %Ai_sing IF Task(%Ai_cor).tog THEN stoptask %Ai_cor IF Task(%Ai_wavana).tog THEN stoptask %Ai_wavana IF Task(%ai_0).tog THEN stoptask %AI_0 IF Task(%Miked_FFT).tog THEN stoptask %Miked_FFT 'duur = 92.87 ' in ms = 4096 samples duur = 1000 * 1024 / 44100 ' 23ms = 1024 samples ' also the window size for the FFT duur = duur + 2 Task(%Miked_pos).tog = %True END IF IF TrackStatus.StreamIn THEN Track = RetrieveSample (duur) ELSE StopTask %Miked_Hybr MSGBOX "audio is not working",,FUNCNAME$ END IF SELECT CASE Track CASE 0 TO 15 ' fourier transform task to retrieve notes from audio input... DIM Sp(0 TO %d9-1) AS LOCAL SINGLE ' 512 spectral lines offset = %False WaveDFT Track, offset, %False, Sp() ' WaveDFTHiRes Track, offset, %False, Sp(), 3, %d11 ' d11=2048 - FFT op 4095 samples SizeAudioTrack Track, %False ' Task(%Miked_Hybr).har.vel = STRING$(128,0) 'necessary?? ' Linspec2QHar Sp(), Task(%Miked_FFT).qhar, 42.98 ' 10.745 ' bandbreedte der spektraalbandjes LinSpec2Har Sp(), Pos_.har(1), 42.98 Task(%Miked_Pos).freq = 1000! / duur CASE ELSE EXIT SUB END SELECT ' TransQHarm Qt.qhar(1), -2 ' transpose to avoid feedback InstrumTransposeToRange Pos_ IF ISFALSE NamAI.robotsplaying THEN 'QInstrumPlay Qt InstrumPlay Pos_ ' includes HybrHi ELSE MM_Pos_Off %MM_Notes END IF END SUB SUB Miked_GestSpek () 'original source: SUB Butoh_Spek () ' hardware: Doppler sonar system, 3 channels. NiDAQ-mx ' here we attempt to map the gestural spectrum on 3 wide range robots ' for Butoh production with Emilie De Vlam ' 06.07.2009: to do: speed up ' thin the spectral chords (clusters) ' add sliders for sensitivity ' 14.07.2009: Thinning procs for arrays added in g_indep.dll. Applied here. ' 18.07.2009: Integration time on Harma increased. ' the difference between naked performance and dressed is extreme here. ' Movement vectors can be separately controlled pretty well. ' 29.11.2009: Code taken up again and rehearsed with Dominica Eyckmans. ' seems less responsive now than it was in july... ' 12.12.2009: rehearsal. Now new piece: 'Far stars fade with spectral shifts' - done with Dominica Eyckmans. ' 03.05.2010; demonstrated for Lazara ' 09.05.2010: recoded using our FFT task - does not work as well!!! ' improved by running the FFT task with a 25% overlap at 256Hz instead of 128 Hz. Jitter goes up to 9 now on \\Yo ' 10.05.2010: rechecked with the new FFT task. Dynamic levels need rescaling now. ' 28.05.2010: used as a demo for namuda coding. ' 02.04.2011: recoded/retuned for use in miked (Textsound concert) ' 21.10.2015: Code taken up again for the textsound production on 28th of october. STATIC xh AS harmtype STATIC yh AS Qharmtype STATIC ynh AS harmtype STATIC zh AS harmtype STATIC gem AS harmtype STATIC cnt AS DWORD LOCAL i AS LONG LOCAL mx AS SINGLE STATIC slnr AS DWORD STATIC ysint AS SINGLE ' integrated volumes for qt STATIC zsint AS SINGLE ' integrated volumes for harma STATIC onoff AS LONG IF ISFALSE Task(%Miked_GestSpek).tog THEN DIM Sp(128) AS STATIC SINGLE xh.vel = NUL$(128) yh.vel = NUL$(256) zh.vel = NUL$(128) ' medium time buffers: 256 S/s - 1 s timeframe DIM spx(127) AS STATIC DOUBLE AT gesture.pspm(0) DIM spy(127) AS STATIC DOUBLE AT gesture.pspm(1) DIM spz(127) AS STATIC DOUBLE AT gesture.pspm(2) DIM aro(127) AS STATIC SINGLE cnt = 0 MM_Xy_On MM_Harma_On MM_Piperola_On MM_Bourdonola_On Progchange Piano.channel, 0 MM_Xy_On %MM_Lights MM_Bourdonola_On %MM_Lights MM_Piperola_On %MM_Lights MM_Harma_On %MM_Lights IF ISFALSE Task(%Miked_GestSpek).hParam THEN DIM TaskParamLabels(0 TO 1) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "map-f" ' spectral mapping. TaskParamLabels(1) = "sens" ' minimum required amplitude MakeTaskParameterDialog %Miked_GestSpek,2,Slider(),0,UDctrl(),TaskParamLabels() ' 2 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%Miked_GestSpek).SliderNumbers(0) Slider(slnr).value = 47 ' was 36 in de versie met Emilie. ' in Links met Dominika liepen we hiermee van hoog naar laag. ' 120 levert Si als tonale basis ' 60 geeft Sib ' 64-67 geven Do ' 20 en 40 geven een Mi, (= tonale basis voor de Qt FFT task op de mikrofoon) ' 40 geeft Mi (zoals de vokale transform) ' 47 geeft Fa# 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 END IF Task(%Miked_GestSpek).freq = 20 Task(%Miked_GestSpek).tog = %True EXIT SUB END IF IF @pDoppler.xa > (Slider(slnr+1).value / 128) THEN FOR i = 0 TO 127 mx = MAX(mx,spx(i)) ' find the maximum value in spx() NEXT i IF ISFALSE mx THEN warning "Empty X spectrum..." ELSE FOR i = 0 TO 127 Sp(i) = spx(i) * @pDoppler.xa/ mx ' Sp() must be normalized now NEXT i END IF ArrayReduce_SNG (sp(), 8, aro()) ' in g_indep, returns the 8 strongest components in aro() LinSpec2Har (aro(), xh, Slider(slnr).value) ' in g_mus with 1, we work in 1Hz steps Piano.har(1).vel = ReScaleHarvel (xh, 2) ' velo waarden, 2= rescale faktor! InstrumPlay Piano INCR onoff ELSE InstrumPlay Piano RESET onoff END IF ysint = ((ysint * 15) + SQR(@pDoppler.ya)) / 16 ' normalized integrated volume 'IF MIN(ysint * 160, 127) <> Qt.ctrl(7) THEN 'Controller Qt.channel, 7, MIN(ysint * 160, 127) 'Qt.ctrl(7) = MIN(ysint * 160, 127) 'END IF IF @pDoppler.ya > (Slider(slnr+1).value / 128) THEN FOR i = 0 TO 127 mx = MAX(mx,spy(i)) NEXT i IF ISFALSE mx THEN warning "Empty Y spectrum" ELSE FOR i = 0 TO 127 Sp(i) = spy(i) * @pDoppler.ya/mx NEXT i END IF ArrayReduce_SNG (sp(), 8, aro()) 'LinSpec2QHar (Sp(), Qt.Qhar(1), 20) ' in g_har - dit gaat niet LinSpec2QHar (aro(), yh, Slider(slnr).value) '20) ' in g_har LinSpec2Har (aro(),ynh, Slider(slnr).value) '20) ' for use in determination of common spectral lines/notes Xy.Qhar(1).vel = yh.vel QInstrumplay Xy INCR onoff ELSE QInstrumplay Xy RESET onoff END IF zsint = ((zsint * 31) + SQR(@pDoppler.za)) / 32 ' normalized integrated volume ' longer integration to avoid problems with ' the harma motor controller. IF MAX(MIN(zsint * 127,127),10) <> Harma.ctrl(7) THEN Controller Harma.channel, 7, MAX(MIN(zsint * 127, 127),10) Harma.ctrl(7) = MAX(MIN(zsint * 127, 127),10) END IF IF @pDoppler.za > (Slider(slnr+1).value / 128) THEN FOR i = 0 TO 127 mx = MAX(mx, spz(i)) NEXT i IF ISFALSE mx THEN warning "Empty Z spectrum" ELSE FOR i = 0 TO 127 Sp(i) = spz(i) * @pDoppler.za/mx NEXT i END IF ArrayReduce_SNG (sp(), 8, aro()) LinSpec2Har (aro(), zh, Slider(slnr).value) ' in g_mus Harma.Har(1).vel = zh.vel InstrumPlay Harma INCR onoff ELSE InstrumPlay Harma RESET onoff END IF IF onoff >= 3 THEN ' nu nog iets doen met gemeenschappelijke noten in xh,yh en zh: gem.vel = CommonHar$ (zh, xh) ' yh is kwarttoons en moet dus eerst gereduceerd worden. ' vandaar de introduktie van ynh... gem.vel = CommonHar$ (gem, ynh) gem.vel = ReScaleHarvel (gem, 5) ' Xy.Har(1).vel = LimitHar (gem, xy.lowtes, xy.hightes) ' Instrumplay Xy Bourdonola.Har(1).vel = LimitHar (gem, bourdonola.lowtes, 62) Instrumplay Bourdonola Piperola.Har(1).vel = LimitHar (gem, bourdonola.hightes, xy.lowtes) Instrumplay Piperola ELSE Instrumplay Bourdonola END IF ' tempo interaktief afhankelijk van de bewegingssnelheid: Task(%Miked_GestSpek).freq = MAX(@pDoppler.xf/3, @pDoppler.yf/3, @pDoppler.zf/3, 1.5) INCR cnt END SUB SUB Miked_Stop () IF Task(%Miked_FFT).tog THEN stoptask %Miked_FFT IF Task(%Miked_GestSpek).tog THEN stoptask %Miked_GestSpek IF Task(%AI_4).tog THEN stoptask %AI_4 MM_AllOff stoptask %Miked_Stop END SUB '-----Namuda Study #15: Early birds ------------------------------------------------------------------------------------ ' may 2011 - for Dominica Eyckmans and the avant-premiere of the robot ' demonstrates tremolo and fingered vibrato. ' Gesture proporties Speedup and Slowdown. ' 15.05.2011: First rehearsal with Dominica Eyckmans SUB E_Birds_Start () ' 05.2011 ' this starts the piece. ' is switched on first, then it starts moving ' yellow lights switched on ' after viola intro, E_Birds_Slow is started. ' 06.10.2012: NoteL movement in Fa is temporarely disabled on the robot now. IF ISFALSE Task(%E_Birds_Start).tog THEN MM_Fa_On Fa.ctrl(66) = 127 IF fa.ctrl(7) <> 80 THEN Controller Fa.channel, 7, 80 : Fa.ctrl(7) = 80 IF fa.ctrl(16) <> 60 THEN Controller Fa.channel, 16, 60 : Fa.ctrl(16) = 60 IF fa.ctrl(17) <> 127 THEN Controller Fa.channel, 17, 127 : Fa.ctrl(17) = 127 IF fa.ctrl(18) <> 70 THEN Controller Fa.channel, 18, 70 : Fa.ctrl(18) = 70 IF fa.ctrl(19) <> 115 THEN Controller Fa.channel, 19, 115 : Fa.ctrl(19) = 115 IF fa.ctrl(1) <> 1 THEN Controller Fa.channel, 1, 1 : Fa.ctrl(1) = 1 ' ruis IF fa.ctrl(20) <> 64 THEN Controller Fa.channel, 20, 64 : Fa.ctrl(20) = 64 ' tuning MM_Fa_On %MM_Yellow Task(%E_Birds_Start).tog = %True END IF ' gele lampjes modulatie mPlay Fa.channel, 0, 90 + (RND(1) * 35) mPlay Fa.channel, 1, 90 + (RND(1) * 35) Task(%E_Birds_Start).freq = 1 + (RND(1) * 2) IF Task(%E_Birds_Slow).tog THEN MM_Fa_On %MM_Yellow StopTask %E_Birds_Start END IF END SUB SUB E_Birds () ' for the robot - based on: Domi_SpeedUp_Trig () ' 06.10.2012: Note: needs reviewing of controllers as was upgraded since the premiere performance. STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot, eyes, slnr, udnr AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%E_Birds).tog THEN IF ISFALSE Task(%E_Birds).hParam THEN DIM TaskParamLabels(1) AS ASCIIZ * 8 TaskParamLabels(0)="speed" TaskParamLabels(1)="hold" MakeTaskParameterDialog %E_Birds,1, Slider(),1,UdCtrl(), TaskParamLabels() slnr = TaskEX(%E_Birds).SliderNumbers(0) Slider(slnr).value = 127 SendMessage Slider(Slnr).h, %TBM_SETPOS,%True, Slider(Slnr).value IF udnr = %False THEN udnr = TaskEX(%E_Birds).UpDownNumbers(0) UDctrl(udnr).cptr = CODEPTR(E_Birds_UD0) ' peak or continous mode UDctrl(udnr).value = 1 UDctrl(udnr).minval = 0 UDctrl(udnr).maxval = 1 UDctrl(udnr).stap = 1 SetDlgItemText Task(%E_Birds).hparam, %GMT_TEXT0_ID + 16, STR$(1) END IF END IF sens = 18 'in Hz units eyes = %False 'MM_Fa_On ' updated 06.10.2012 'IF fa.ctrl(7) <> 80 THEN Controller Fa.channel, 7, 80 : Fa.ctrl(7) = 80 'IF fa.ctrl(16) <> 60 THEN Controller Fa.channel, 16, 60 : Fa.ctrl(16) = 60 'IF fa.ctrl(17) <> 127 THEN Controller Fa.channel, 17, 127 : Fa.ctrl(17) = 127 'IF fa.ctrl(18) <> 70 THEN Controller Fa.channel, 18, 70 : Fa.ctrl(18) = 70 'IF fa.ctrl(19) <> 115 THEN Controller Fa.channel, 19, 115 : Fa.ctrl(19) = 115 'IF fa.ctrl(1) <> 1 THEN Controller Fa.channel, 1, 1 : Fa.ctrl(1) = 1 ' ruis 'IF fa.ctrl(20) <> 64 THEN Controller Fa.channel, 20, 64 : Fa.ctrl(20) = 64 ' tuning MM_Fa_On %MM_Yellow IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%E_Birds).tog = %True END IF ' on accelerating body speed, play in the very high register ' X-vektor: ' frequency is unipolar data, not normalized IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF UDCtrl(udnr).value = 0 THEN ' very fast mapping xnoot = 91 + sens - gesture.speedup(0)/2 ' * 1.5 IF xnoot <> Task(%E_Birds).pan THEN mPlay Fa.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) ' was: MIN(gesture.speedup_val(0) * 8, 127) Task(%E_Birds).pan = xnoot ' storage for other tasks END IF xtrig = %True ELSE IF ISFALSE xtrig THEN ' following only peak values xnoot = 91 + sens - gesture.speedup(0)/2 ' * 1.5 IF xnoot <> Task(%E_Birds).pan THEN mPlay Fa.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) ' was * 8 Task(%E_Birds).pan = xnoot ' storage for other tasks END IF xtrig = %True END IF END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN ' mPlay Fa.channel, xnoot, %False RESET xnoot END IF END IF END IF IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN IF ISFALSE xnoot THEN ynoot = 91 + sens - (gesture.speedup(1)/2) IF ynoot <> Task(%E_Birds).pan THEN mPlay Fa.channel, ynoot,MIN(gesture.speedup_val(1) * 2, 127) ' was * 8 Task(%E_Birds).pan = ynoot END IF ytrig = %True END IF END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN ' NoteOff Fa.channel, ynoot RESET ynoot END IF END IF RESET ytrig END IF ' this didn't look like working... ' IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN ' 'IF (xnoot> 0) OR (ynoot > 0) THEN ' IF Task(%E_Birds).pan > 0 then ' Aftertouch Fa.channel,MIN(gesture.speedup_val(2)/64, 12) ' fingered vibrato ' ' maybe better to do tremolo here... ' ztrig = %True ' ELSE ' IF ztrig THEN ' AfterTouch Fa.channel, %False ' RESET ztrig ' END IF ' END IF ' END IF IF (Gesture.speedup(3) > sens) AND (Gesture.speedup(3) > Gesture.slowdown(3)) THEN IF ISFALSE eyes THEN MM_Fa_On %MM_Blue ' mPlay Fa.channel, 4, min(gesture.speedup(3), 127) ' mPlay Fa.channel, 5, MIN(gesture.speedup(3), 127) eyes = %True END IF ELSE IF eyes THEN MM_Fa_Off %MM_Blue eyes = %False END IF END IF IF Gesture.speedup(3) > (sens * 10) THEN IF gesture.speedup(3) > (gesture.slowdown(3) + (sens * 10)) THEN mPlay Tubi.channel, MIN(Tubi.lowtes + gesture.speedup(3) - (sens*10),Tubi.Hightes), MIN(@pDoppler.zf , 127) 'experiment END IF END IF ' noteoff condition: IF (gesture.slowdown(3) < sens) AND (gesture.speedup(3) < sens) THEN IF Task(%E_Birds).pan THEN NoteOff Fa.channel, Task(%E_Birds).pan Task(%E_Birds).pan = %False END IF END IF Task(%E_Birds).freq = Slider(slnr).value OR 1 END SUB FUNCTION E_Birds_UD0 () AS LONG ' callback on parameter UpDowns LOCAL value AS BYTE LOCAL udnr AS DWORD udnr = TaskEX(%E_Birds).UpdownNumbers(0) value = UDCtrl(udnr).value IF value > 11 THEN UDctrl(udnr).value = 1 : value = 1 IF value < 0 THEN UDCTRL(udnr).value = 0 : value = 0 SetDlgItemText Task(%E_Birds).hparam, %GMT_TEXT0_ID + 16, STR$(value) END FUNCTION SUB E_Birds_Slow () ' based on Domi_Slowdown_Trig () ' 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 ' 12.05.2011: Mapping on Fa, low register for Early Birds ' 14.05.2011: Needs manual interaction with UD and slider ' 06.10.2012: Revision in function of Version 1.1 STATIC xtrig, ytrig, ztrig, slnr, udnr AS LONG STATIC xnoot, ynoot, znoot, lites, snelheid AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%E_Birds_Slow).tog THEN IF ISFALSE Task(%E_Birds_Slow).hParam THEN DIM TaskParamLabels(1) AS ASCIIZ * 8 TaskParamLabels(0)="speed" TaskParamLabels(1)="hold" MakeTaskParameterDialog %E_Birds_Slow,1, Slider(),1,UdCtrl(), TaskParamLabels() slnr = TaskEX(%E_Birds_Slow).SliderNumbers(0) Slider(slnr).value = 111 SendMessage Slider(Slnr).h, %TBM_SETPOS,%True, Slider(Slnr).value IF udnr = %False THEN udnr = TaskEX(%E_Birds_Slow).UpDownNumbers(0) UDctrl(udnr).cptr = CODEPTR(E_Birds_Slow_UD0) ' peak or continous mode UDctrl(udnr).value = 1 ' startup in peak mode UDctrl(udnr).minval = 0 UDctrl(udnr).maxval = 1 UDctrl(udnr).stap = 1 SetDlgItemText Task(%E_Birds_Slow).hparam, %GMT_TEXT0_ID + 16, STR$(1) END IF END IF sens = 12 'IF fa.ctrl(7) <> 80 THEN Controller Fa.channel, 7, 80 : Fa.ctrl(7) = 80 'IF fa.ctrl(16) <> 60 THEN Controller Fa.channel, 16, 60 : Fa.ctrl(16) = 60 'IF fa.ctrl(17) <> 127 THEN Controller Fa.channel, 17, 127 : Fa.ctrl(17) = 127 'IF fa.ctrl(18) <> 70 THEN Controller Fa.channel, 18, 70 : Fa.ctrl(18) = 70 'IF fa.ctrl(19) <> 115 THEN Controller Fa.channel, 19, 115 : Fa.ctrl(19) = 115 'IF fa.ctrl(1) <> 1 THEN Controller Fa.channel, 1, 1 : Fa.ctrl(1) = 1 ' ruis 'IF fa.ctrl(20) <> 64 THEN Controller Fa.channel, 20, 64 : Fa.ctrl(20) = 64 ' tuning IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%E_Birds_Slow).tog = %True END IF IF Gesture.slowdown(0) > sens THEN ' frequency is unipolar data, can go up to 230 IF ISFALSE UDCtrl(udnr).value THEN 'independent from sens xnoot = MIN(Fa.lowtes - sens + (gesture.slowdown_val(0)/3), 48) IF xnoot <> Task(%E_Birds).pan THEN 'version 1.0: mPlay Fa.channel, xnoot, MAX(MIN(@pDoppler.xa * 1024, 127), 96) mPlay Fa.channel, xnoot, MAX(MIN(@pDoppler.xa * 256, 127), 18) Task(%E_Birds).pan = xnoot END IF xtrig = %True ELSE IF ISFALSE xtrig THEN 'independent from sens xnoot = MIN(Fa.lowtes - sens + (gesture.slowdown_val(0)/3), 48) IF xnoot <> Task(%E_Birds).pan THEN ' version 1.0: mPlay Fa.channel, xnoot, MAX(MIN(@pDoppler.xa * 1024, 127), 96) mPlay Fa.channel, xnoot, MAX(MIN(@pDoppler.xa * 256, 127), 18) Task(%E_Birds).pan = xnoot END IF xtrig = %True END IF END IF ELSE IF xtrig THEN IF xnoot THEN 'NoteOff Fa.channel, xnoot RESET xnoot END IF END IF RESET xtrig END IF IF Gesture.slowdown(1) > sens THEN IF ISFALSE ytrig THEN ynoot = MIN(Fa.lowtes - sens + (gesture.slowdown_val(1)/3), 48) IF ISFALSE xnoot THEN IF ynoot <> Task(%E_Birds).pan THEN 'version 1.0: mPlay Fa.channel, ynoot, MAX( MIN(@pDoppler.ya * 1024, 127),100) mPlay Fa.channel, ynoot, MAX( MIN(@pDoppler.ya * 256, 127),18) Task(%E_Birds).pan = ynoot END IF ytrig = %true END IF END IF ELSE IF ytrig THEN IF ynoot THEN 'NoteOff Fa.channel, ynoot RESET ynoot END IF END IF RESET ytrig END IF IF (gesture.slowdown(3) > sens) AND (gesture.slowdown(3) > gesture.speedup(3)) THEN IF ISFALSE lites THEN MM_Fa_On %MM_Red lites = %True END IF ELSE IF lites THEN MM_Fa_Off %MM_Red RESET lites END IF END IF ' noteoff condition: IF (gesture.slowdown(3) < sens) AND (gesture.speedup(3) < sens) THEN IF Task(%E_Birds).pan THEN NoteOff Fa.channel, Task(%E_Birds).pan Task(%E_Birds).pan = %False END IF END IF Task(%E_Birds_Slow).freq = Slider(slnr).value OR 1 END SUB FUNCTION E_Birds_Slow_UD0 () AS LONG ' callback on parameter UpDowns LOCAL value AS BYTE LOCAL udnr AS DWORD udnr = TaskEX(%E_Birds_Slow).UpdownNumbers(0) value = UDCtrl(udnr).value IF value > 1 THEN UDctrl(udnr).value = 1 : value = 1 IF value < 0 THEN UDCTRL(udnr).value = 0 : value = 0 SetDlgItemText Task(%E_Birds_Slow).hparam, %GMT_TEXT0_ID + 16, STR$(value) END FUNCTION SUB E_Birds_Tim () ' version 1.0: the note playing on Fa is in Task(%E_Birds).pan ' here we check how long it stays on ' and we also start amplitude modulation/tremolo using controller 7 ' 06.10.2012: revized completely , using the AM control internal to the Fa robot. STATIC note AS BYTE IF ISFALSE Task(%E_Birds_Tim).tog THEN Task(%E_Birds_Tim).freq = 30 Controller Fa.channel, 44, 127 ' wait time for am-modulation Fa.ctrl(44) = 127 note = %False Task(%E_Birds_Tim).tog = %True END IF note = Task(%E_Birds).pan SELECT CASE note CASE %False ' no note playing IF Fa.ctrl(5) <> 0 THEN ' CC5= modulation depth Controller Fa.channel, 5, 0 Fa.ctrl(5) = %False END IF CASE ELSE ' am-frequency: IF Fa.ctrl(6) <> MIN(gesture.fixspeed_val(3)/ 2,127) THEN Controller Fa.channel, 6, MIN(gesture.fixspeed_val(3)/ 2,127) Fa.ctrl(6) = MIN(gesture.fixspeed_val(3)/ 2,127) END IF 'am-depth: IF Fa.ctrl(5) <> gesture.flue_val(3) * 127 THEN Controller Fa.channel, 5, gesture.flue_val(3) * 127 Fa.ctrl(5) = gesture.flue_val(3) * 127 END IF END SELECT END SUB SUB E_Birds_Aft () ' task to steer fingered vibrato ' note that the periodicity is controlled by the aftertouch parameter ' the implementation of ctrl.31 is experimental and may not remain. STATIC sw, snelheid AS LONG IF ISFALSE task(%E_Birds_Aft).tog THEN snelheid = 7 Task(%E_Birds_Aft).tog = %True END IF snelheid = MAX(@pDoppler.xf, @pDoppler.yf, @pDoppler.zf) / 16 IF snelheid < 2 THEN snelheid = 2 IF snelheid > 16 THEN snelheid = 16 IF Task(%E_Birds).pan THEN IF ISFALSE sw THEN 'Aftertouch Fa.channel, snelheid sw = %True END IF IF Fa.ctrl(31) <> snelheid THEN Controller Fa.channel, 31, snelheid Fa.ctrl(31) = snelheid END IF ELSE IF sw THEN 'Aftertouch Fa.channel, %False Controller Fa.channel, 31, %False Fa.ctrl(31) = %False sw = %False END IF END IF END SUB SUB E_Birds_Off () IF Task(%E_Birds).pan THEN NoteOff Fa.channel, Task(%E_Birds).pan Task(%E_Birds).pan = %False END IF AfterTouch Fa.channel, %False Controller Fa.channel, 31, %False ' fingered vibrato Fa.ctrl(31) = %False Controller Fa.channel, 66, %False ' resets all controllers RESET Task(%E_Birds).pan END SUB '-------------------------------------------------------------------------------------------------------- FUNCTION Init_Tango () AS LONG ' simultaneous with Piazzolla Tristango ' Dominica Eyckmans, dans & altviool, gwr, dans. ' bezetting in file: Autosax, Player piano, vibi, so, korn, qt, toypi, tubi, krum ' humanola, trump, piperola, bourdonola, thunderwood, HarmO ' uses adapted Zwiep & Zwaai procs. ' to do: add note-set derived from player, such that we can add notes to the file... ClearTasks ' ' Task(%freezeOb).naam = "FreezeOb" ' Task(%freezeOb).freq = 12 ' Task(%freezeOb).cptr = CODEPTR(FreezeOb) ' TaskEx(%freezeOb).stopcptr = CODEPTR(MM_Ob_Off) Task(%Move_Puff).naam = "T_Puff" Task(%Move_Puff).freq = 1 Task(%Move_Puff).cptr = CODEPTR(Tango_Puff) TaskEx(%Move_Puff).stopcptr = CODEPTR(MM_Puff_Off) Task(%Move_Simba).naam = "T_Simba" Task(%Move_Simba).freq = 11 Task(%Move_Simba).cptr = CODEPTR(Tango_Simba) TaskEx(%Move_Simba).stopcptr = CODEPTR(MM_Simba_Off) Task(%Move_Psch).naam = "T_Psch" 'works on collision Task(%Move_Psch).freq = 256 Task(%Move_Psch).cptr = CODEPTR(Tango_Psch) TaskEx(%Move_Psch).stopcptr = CODEPTR(MM_Psch_Off) Task(%Move_TW).naam = "T_Spri" 'springers & thunderwood Task(%Move_TW).freq = 256 Task(%Move_TW).cptr = CODEPTR(Tango_TW) TaskEx(%Move_TW).stopcptr = CODEPTR(Tango_TW_Off) END FUNCTION SUB Tango_Puff () ' = %Move_Puff 'orig. for Zwiep en Zwaai 'should activate the Puff eyes with a suitable algo. LOCAL n1,n2,n3 AS CUR LOCAL v AS BYTE LOCAL nt1, nt2 AS INTEGER LOCAL d AS SINGLE IF ISFALSE Task(%Move_Puff).tog THEN IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Controller Puff.channel, 66, 127 Controller Puff.channel, 90, 1 '4 'pir eyes, relaxed algo. Task(%Move_Puff).tog = %True END IF 'some quartertone harmony... ' nt1 = GetHighestNote(Task(%Korn_Pirplay).Har, 48, 100) ' GetStrongest(Task(%Korn_Pirplay).Har) ' IF nt1 = -1 THEN n1=0 ELSE n1= HIBYT(nt1) ' nt2 = GetHighestNote(Task(%FreezeOb).Har, 55, 120) ' GetStrongest(Task(%FreezeOb).Har) ' IF nt2 = -1 THEN n2 = 0 ELSE n2= HIBYT(nt2) ' IF n1 AND n2 THEN ' v = LOBYT(nt2) ' d = HH_Triad(50,n1,n2,n3, 0.1) 'this will calculate a note n3 ' AddNote2Qhar Puff.Qhar(1), n3, v / 2 ' QInstrumplay Puff ' END IF END SUB SUB Tango_Simba () 'same constant for task as %Move_Simba 'for Zwiep en Zwaai STATIC ztrig AS LONG IF ISFALSE Task(%Move_Simba).tog THEN ztrig = %False MM_Simba_On Task(%Move_Simba).tog = %True END IF IF gesture.edgy_dur(2) THEN IF ISFALSE ztrig THEN MM_Simba_On %MM_Yellow MM_Simba_Off %MM_White mPlay Simba.channel, 58, MIN(gesture.edgy(2) * 127, 127) 'Left arm motor mPlay Simba.channel, 59, 127 ztrig = %True END IF ELSE IF ztrig THEN MM_Simba_On %MM_White MM_Simba_Off %MM_Yellow NoteOff Simba.channel, 58 NoteOff Simba.channel, 59 ztrig = %False END IF END IF END SUB SUB Tango_Psch () 'same constant as %Move_psch 'orig. 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 STATIC xtrig, ytrig, ztrig, strig, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Move_Psch).tog THEN 'start gesture analyser!!! IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser RESET lites sens = 1.4 '14/10 Task(%Move_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 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 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 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 Tango_TW () ' same task constant as %Move_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(%Move_TW).tog THEN sens = 0.1 RESET xtrig, ytrig, ztrig, lites MM_Thunderwood_On ' may overwrite fileplayer... MM_Springers_On IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Move_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 Thunderwood.channel, 17, MIN(gesture.explo_val(0) * 127, 127) ' windchimes 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, 25, MIN((gesture.explo_val(1) ^ 1.5) * 127 , 127 ) ' stormwind ytrig = %True END IF ELSE IF ytrig THEN mPlay Thunderwood.channel, 25, %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 Tango_TW_Off () 'MM_Thunderwood_Off MM_Springers_Off END SUB '--------------------------------------- ' Colors - Spiro study for Dominica ' september 2011 FUNCTION Init_Colors () AS LONG ClearTasks '---------------------------------------------------------------------------------- '- for 20.09.2011 Task(%SpiroSpek).naam = "SpiSpek" Task(%SpiroSpek).cptr = CODEPTR(SpiroSpek) Task(%SpiroSpek).freq = 10 Task(%SpiroSpek).flags = %False TaskEX(%SpiroSpek).stopcptr = CODEPTR(SpiroSpek_Stop) Task(%SpiroColors2).naam = "SpiCo2" Task(%SpiroColors2).cptr = CODEPTR(SpiroColors2) Task(%SpiroColors2).freq = 10 Task(%SpiroColors2).flags = %False TaskEX(%SpiroColors2).stopcptr = CODEPTR(SpiroColors2_Stop) Task(%SpiroColors3).naam = "SpiCo3" Task(%SpiroColors3).cptr = CODEPTR(SpiroColors3) Task(%SpiroColors3).freq = 129 Task(%SpiroColors3).flags = %PERTIM_Task TaskEX(%SpiroColors3).stopcptr = CODEPTR(SpiroColors3_Stop) Task(%SpiroColors4).naam = "SpiCo4" Task(%SpiroColors4).cptr = CODEPTR(SpiroMuf) Task(%SpiroColors4).freq = 130 Task(%SpiroColors4).flags = %PERTIM_Task TaskEX(%SpiroColors4).stopcptr = CODEPTR(SpiroColors3_Stop) 'sic END FUNCTION SUB SpiroSpek () ' based on Butoh_Spek (in namuda.inc) ' spectral mapping on spiro ' in the performance we bring the spektrum slider gradually down to 56 (reaching low A on the spinet) STATIC xh AS harmtype STATIC yh AS Qharmtype STATIC ynh AS harmtype STATIC zh AS harmtype STATIC gem AS harmtype 'STATIC cnt AS DWORD LOCAL i AS LONG LOCAL mx AS SINGLE STATIC slnr AS DWORD STATIC ysint AS SINGLE ' integrated volumes for qt STATIC zsint AS SINGLE ' integrated volumes for harma STATIC onoff AS LONG IF ISFALSE Task(%SpiroSpek).tog THEN DIM Sp(128) AS STATIC SINGLE xh.vel = NUL$(128) yh.vel = NUL$(256) zh.vel = NUL$(128) ' medium time buffers: 256 S/s - 1 s timeframe DIM spx(127) AS STATIC DOUBLE AT gesture.pspm(0) DIM spy(127) AS STATIC DOUBLE AT gesture.pspm(1) DIM spz(127) AS STATIC DOUBLE AT gesture.pspm(2) DIM aro(127) AS STATIC SINGLE ' MM_Qt_On ' MM_Harma_On ' MM_Piperola_On ' MM_Bourdonola_On 'Progchange Piano.channel, 0 MM_Spiro_On Progchange Spiro.channel, 122 IF ISFALSE Task(%SpiroSpek).hParam THEN DIM TaskParamLabels(0 TO 1) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "map-f" ' spectral mapping. TaskParamLabels(1) = "sens" ' minimum required amplitude MakeTaskParameterDialog %SpiroSpek,2,Slider(),0,UDctrl(),TaskParamLabels() ' 2 sliders! END IF IF ISFALSE slnr THEN slnr = TaskEX(%SpiroSpek).SliderNumbers(0) Slider(slnr).value = 120 ' was 36 in de versie met Emilie. ' met Dominika lopen we hiermee van hoog naar laag. SendMessage Slider(slnr).h, %TBM_SETPOS,%True, Slider(slnr).value slider(slnr+1).value = 5 SendMessage Slider(slnr+1).h, %TBM_SETPOS,%True, Slider(slnr+1).value END IF ysint = 0.9 zsint = 0.9 RESET Spiro.ctrl(120), Spiro.ctrl(121) Task(%SpiroSpek).freq = 20 'slider(slnr).value / 2 Task(%SpiroSpek).tog = %True EXIT SUB END IF IF @pDoppler.xa > (Slider(slnr+1).value / 128) THEN FOR i = 0 TO 127 mx = MAX(mx,spx(i)) ' find the maximum value in spx() NEXT i IF ISFALSE mx THEN warning "Empty X spectrum..." ELSE FOR i = 0 TO 127 Sp(i) = spx(i) * @pDoppler.xa/ mx ' Sp() must be normalized now NEXT i END IF IF gh.melpat THEN ShowNormArray gh.melpat,sp() END IF ArrayReduce_SNG (sp(), 8, aro()) ' in g_indep, returns the 8 strongest components in aro() LinSpec2Har (aro(), xh, Slider(slnr).value) '20) ' in g_mus with 1 instead of 20, we work in 1Hz steps Spiro.har(1).vel = ReScaleHarvel (xh, 6) ' velo waarden * 6 - moet nu weer omlaag! InstrumPlay Spiro INCR onoff ELSE InstrumPlay Spiro RESET onoff END IF ' light flashing frequency: ysint = ((ysint * 3) + @pDoppler.ya)/ 4 IF ysint THEN IF ISFALSE Spiro.ctrl(120) THEN mPlay Spiro.channel, 120, ysint * 127 Spiro.ctrl(120) = ysint * 127 ELSE IF ysint * 127 <> Spiro.ctrl(120) THEN KeyPress Spiro.channel, 120, ysint * 127 Spiro.ctrl(120) = ysint * 127 END IF END IF ELSE IF Spiro.ctrl(120) THEN NoteOff Spiro.channel, 120 Spiro.ctrl(120) = %False END IF END IF ' IF @pDoppler.ya > (Slider(slnr+1).value / 128) THEN ' FOR i = 0 TO 127 ' mx = MAX(mx,spy(i)) ' NEXT i ' IF ISFALSE mx THEN ' warning "Empty Y spectrum" ' ELSE ' FOR i = 0 TO 127 ' Sp(i) = spy(i) * @pDoppler.ya/mx ' NEXT i ' END IF ' ArrayReduce_SNG (sp(), 8, aro()) ' 'LinSpec2QHar (Sp(), Qt.Qhar(1), 20) ' in g_har - dit gaat niet ' LinSpec2QHar (aro(), yh, Slider(slnr).value) '20) ' in g_har ' LinSpec2Har (aro(),ynh, Slider(slnr).value) '20) ' for use in determination of common spectral lines/notes ' Qt.Qhar(1).vel = yh.vel ' QInstrumplay Qt ' INCR onoff ' ELSE ' QInstrumplay Qt ' RESET onoff ' END IF zsint = ((zsint * 3) + @pDoppler.za)/4 IF zsint THEN IF ISFALSE Spiro.ctrl(121) THEN mPlay Spiro.channel, 121, zsint * 127 Spiro.ctrl(121) = zsint * 127 ELSE IF zsint * 127 <> Spiro.ctrl(121) THEN KeyPress Spiro.channel, 121, zsint * 127 Spiro.ctrl(121) = zsint * 127 END IF END IF ELSE IF spiro.ctrl(121) THEN NoteOff Spiro.channel, 121 Spiro.ctrl(121) = %False END IF END IF ' IF @pDoppler.za > (Slider(slnr+1).value / 128) THEN ' FOR i = 0 TO 127 ' mx = MAX(mx, spz(i)) ' NEXT i ' IF ISFALSE mx THEN ' warning "Empty Z spectrum" ' ELSE ' FOR i = 0 TO 127 ' Sp(i) = spz(i) * @pDoppler.za/mx ' NEXT i ' END IF ' ArrayReduce_SNG (sp(), 8, aro()) ' LinSpec2Har (aro(), zh, Slider(slnr).value) ' in g_mus ' Harma.Har(1).vel = zh.vel ' InstrumPlay Harma ' INCR onoff ' ELSE ' InstrumPlay Harma ' RESET onoff ' END IF ' following not required nor functional here, unless we add more instruments. ' IF onoff >= 3 THEN ' ' nu nog iets doen met gemeenschappelijke noten in xh,yh en zh: ' gem.vel = CommonHar$ (zh, xh) ' ' yh is kwarttoons en moet dus eerst gereduceerd worden. ' ' vandaar de introduktie van ynh... ' gem.vel = CommonHar$ (gem, ynh) ' gem.vel = ReScaleHarvel (gem, 5) ' Xy.Har(1).vel = LimitHar (gem, xy.lowtes, xy.hightes) ' Instrumplay Xy ' Bourdonola.Har(1).vel = LimitHar (gem, bourdonola.lowtes, 62) ' Instrumplay Bourdonola ' Piperola.Har(1).vel = LimitHar (gem, bourdonola.hightes, xy.lowtes) ' Instrumplay Piperola ' ELSE ' Instrumplay Bourdonola ' END IF ' ' tempo interaktief afhankelijk van de bewegingssnelheid: Task(%Spirospek).freq = MAX(@pDoppler.xf/3, @pDoppler.yF/3, @pDoppler.zf/3, 1.5) END SUB SUB SpiroSpek_Stop () MM_Spiro_Off %MM_Notes ' MM_Qt_Off ' MM_Harma_Off MM_Piperola_Off MM_Bourdonola_Off END SUB SUB SpiroColors2 () 'based on 'Features' code , %Robofeat2 - edgy property 'modified for use with Spiro, replacing Bomi 'has bug: cnt is not incremented... '09/11/2011: further work and rehearsal , cnt now timedependent STATIC noot AS CURRENCY STATIC wind, Spekfak AS SINGLE STATIC t, cnt, xtrig, ytrig, ztrig, Basenote, Noot1, Noot12, Noot13 AS LONG IF ISFALSE Task(%SpiroColors2).tog THEN IF ISFALSE cnt THEN t = timegettime ' in ms Basenote = 20 spekfak = 1.3 ' ELSE ' Basenote = Basenote + 8 'augmented fifth (20 semitones) ' IF Basenote > 35 THEN ' Basenote = 24 + ( Basenote MOD 12) ' END IF END IF IF ISFALSE cnt THEN INCR cnt 'MM_Piano_On 'MM_Simba_On 'MM_Bomi_On MM_Spiro_On RESET Noot1, Noot12, Noot13 Task(%SpiroColors2).pan = %True Task(%SpiroColors2).tog = %True END IF IF gesture.edgy_dur(0) THEN IF ISFALSE xtrig THEN MM_Piano_On %MM_Yellow MM_Piano_Off %MM_Blue MM_Spiro_Off %MM_Blue xtrig = %True END IF ELSE IF xtrig THEN MM_Piano_On %MM_Blue MM_Piano_Off %MM_Yellow MM_Spiro_On %MM_Blue xtrig = %False END IF END IF cnt = (timegettime - t) / 10000 ' increments every 10 seconds IF ISFALSE cnt MOD 10 THEN Basenote += 8 ' augmented fifth (20 semitones) IF Basenote > 35 THEN Basenote = 24 + ( Basenote MOD 12) END IF ' we can also modulate spekfak END IF IF gesture.edgy_dur(1) THEN 'IF ISFALSE ytrig THEN IF Noot1 THEN NoteOff Spiro.channel, Noot1 : RESET Noot1 IF Noot12 THEN NoteOff Spiro.channel,Noot12 : RESET Noot12 IF Noot13 THEN NoteOff Spiro.channel, Noot13 : RESET Noot13 SELECT CASE cnt CASE <5 Noot1 = Spiro.lowtes + (@pDoppler.xa * 40) Noot12 = Spiro.lowtes + (@pDoppler.ya * 40) IF Noot12 = Noot1 THEN Noot12 += 12 mPlay Spiro.channel, Noot1, 48 mPlay Spiro.channel, Noot12, 48 CASE 5, 6 Noot1 = 60 + (Basenote MOD 24) Noot12 = Matchspecnote(MIN(Spiro.lowtes+ (gesture.edgy(1) *28 ), Spiro.hightes),BaseNote, Spekfak) IF Noot12 = Noot1 THEN Noot12 += 12 mPlay Spiro.channel, Noot1, 48 mPlay Spiro.channel, Noot12, 48 ' Controller Bomi.channel, 1, 90 ' Controller Bomi.channel, 11, 100 + (cnt MOD 9) 'speed ' Controller Bomi.channel, 12, 38 CASE 7, 8 Noot1 = Matchspecnote(MIN(Spiro.lowtes+ (gesture.edgy(0) *28 ), Spiro.hightes),BaseNote, Spekfak) Noot12 = Matchspecnote(MIN(Spiro.lowtes+ (gesture.edgy(1) *28 ), Spiro.hightes),BaseNote, Spekfak) IF Noot12 = Noot1 THEN Noot12 += 12 mPlay Spiro.channel, Noot1, 48 mPlay Spiro.channel, Noot12, 48 'Controller Bomi.channel, 1, 90 'Controller Bomi.channel, 11, 100 + (cnt MOD 9) 'speed 'Controller Bomi.channel, 12, 38 CASE > 8 Noot1 = Matchspecnote(MIN(Spiro.lowtes+ (gesture.edgy(0) *28 ), Spiro.hightes),BaseNote, Spekfak) Noot12 = Matchspecnote(MIN(Spiro.lowtes+ (gesture.edgy(1) *28 ), Spiro.hightes),BaseNote, Spekfak) IF Noot12 = Noot1 THEN Noot12 += 12 Noot13 = Matchspecnote(MIN(Spiro.lowtes+ (gesture.edgy(2) *28 ), Spiro.hightes),BaseNote, Spekfak) IF Noot13 = Noot1 THEN Noot13 += 10 mPlay Spiro.channel, Noot1, 48 mPlay Spiro.channel, Noot12, 48 mPlay Spiro.channel, Noot13, 48 ' Controller Bomi.channel, 1, 90 ' Controller Bomi.channel, 11, 100 + (cnt MOD 9) 'speed ' Controller Bomi.channel, 12, 38 END SELECT ytrig = %True 'END IF ELSE IF ytrig THEN IF Noot1 THEN NoteOff Spiro.channel, Noot1 : RESET Noot1 IF Noot12 THEN NoteOff Spiro.channel,Noot12 : RESET Noot12 IF Noot13 THEN NoteOff Spiro.channel, Noot13 : RESET Noot13 ytrig = %False END IF END IF IF gesture.edgy_dur(2) THEN IF ISFALSE ztrig THEN MM_Simba_On %MM_Yellow MM_Simba_Off %MM_White 'mPlay Simba.channel, 58, MIN(gesture.edgy(2) * 127, 127) 'Left arm motor 'mPlay Simba.channel, 59, 127 ztrig = %True END IF ELSE IF ztrig THEN MM_Simba_On %MM_White MM_Simba_Off %MM_Yellow 'NoteOff Simba.channel, 58 'NoteOff Simba.channel, 59 ztrig = %False END IF END IF IF gesture.edgy_dur(3) THEN 'if edgy, we select toypi noot = Matchspecnote(MIN(toypi.lowtes + 7 + (gesture.edgy(0) *28 ), toypi.hightes),BaseNote, Spekfak) AddNote2Har Toypi.Har(1), noot,@pDoppler.xa * 100 noot = Matchspecnote(MIN(toypi.lowtes + 7 + (gesture.edgy(1) *28 ), toypi.hightes),BaseNote, Spekfak) AddNote2Har Toypi.Har(1), noot,@pDoppler.xa * 100 noot = Matchspecnote(MIN(toypi.lowtes + 7 + (gesture.edgy(2) *28 ), toypi.hightes),BaseNote, Spekfak) AddNote2Har Toypi.Har(1), noot,@pDoppler.xa * 100 InstrumPlay Toypi MM_Toypi_On %MM_Lights MM_Vibi_On %MM_Lights ELSE MM_Toypi_Off MM_Vibi_Off %MM_Lights END IF END SUB SUB SpiroColors2_Stop () 'Controller Bomi.channel, 1, 0 'Controller Bomi.channel, 11, 0 'Controller Bomi.channel, 12, 0 MM_Toypi_Off MM_Simba_Off %MM_Lights 'MM_Bomi_Off 'MM_Piano_Off MM_Spiro_Off %MM_Notes MM_Vibi_Off %MM_Lights END SUB SUB SpiroColors3 () ' here we look only into the frequency data in order to detect accelerating gesture '11.09.2011 - rehearsed. This will be the start of the choreography. STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%SpiroColors3).tog THEN MM_Spiro_On sens = 16 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Spirocolors3).tog = %True 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 xnoot = MIN(Spiro.lowtes - sens + (gesture.speedup(0)* 1.5), Spiro.Hightes) IF (xnoot <> ynoot) AND (xnoot <> znoot) THEN mPlay Spiro.channel,xnoot, MIN(gesture.speedup_val(0), 48) xtrig = %True ELSE xnoot = %False END IF END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN NoteOff Spiro.channel, xnoot RESET xnoot END IF END IF END IF IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN ynoot = MIN(Spiro.lowtes - sens + (gesture.speedup(1)* 1.5), Spiro.Hightes) IF (ynoot <> xnoot) AND (ynoot <> znoot) THEN mPlay Spiro.channel,ynoot , MIN(gesture.speedup_val(1), 48) ytrig = %true ELSE ynoot = %False END IF END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN NoteOff Spiro.channel, ynoot RESET ynoot END IF END IF RESET ytrig END IF IF gesture.speedup(2) > gesture.slowdown(2) + sens THEN IF ISFALSE ztrig THEN znoot = MIN(Spiro.lowtes - sens + (gesture.speedup(2)* 1.5), Spiro.Hightes) IF (znoot <> ynoot) AND (znoot <> xnoot) THEN mPlay Spiro.channel, znoot, MIN(gesture.speedup_val(2), 48) ztrig = %True ELSE znoot = %False END IF END IF ELSE IF znoot THEN IF ISFALSE gesture.speedup_dur(2) THEN NoteOff Spiro.channel, znoot RESET znoot END IF END IF RESET ztrig END IF IF Gesture.speedup(3) > (sens * 10) THEN 'was * 6 ' IF gesture.speedup(3) > (gesture.slowdown(3) + (sens * 4)) THEN ' mPlay Llor.channel, MIN(Llor.lowtes + gesture.speedup(3) - (sens*10),Llor.Hightes), MIN(@pDoppler.zf , 127) 'experiment ' END IF END IF END SUB SUB SpiroColors3_Stop () MM_Spiro_Off Controller Spiro.channel, 28, 0 Controller Spiro.channel, 29, 0 END SUB SUB SpiroMuf () ' section with muffler modulation ' spiro controllers 28 and 29 (bass and trebble) STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot, oldval28, oldval29 AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%SpiroColors4).tog THEN MM_Spiro_On sens = 8 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%Spirocolors4).tog = %True END IF ' on decelerating body speed, do something... ' X-vektor: ' frequency is unipolar data, not normalized IF gesture.slowdown(0) > gesture.speedup(0) + sens THEN IF ISFALSE xtrig THEN xnoot = MAX(Spiro.hightes + sens - (gesture.slowdown(0)* 2), Spiro.lowtes) IF (xnoot <> ynoot) AND (xnoot <> znoot) THEN mPlay Spiro.channel,xnoot, MIN(gesture.slowdown_val(0), 48) logfile "ON1:"+ STR$(xnoot) xtrig = %True ELSE xnoot = %False END IF END IF ELSE IF xnoot THEN 'IF ISFALSE gesture.slowdown_dur(0) THEN IF ytrig THEN RESET xtrig NoteOff Spiro.channel, xnoot ' logfile "OFF1:"+ STR$(xnoot) RESET xnoot END IF END IF END IF IF gesture.slowdown(1) > gesture.speedup(1) + sens THEN IF ISFALSE ytrig THEN ynoot = MAX(Spiro.hightes + sens - (gesture.slowdown(1)* 2), Spiro.lowtes) IF (xnoot <> ynoot) AND (ynoot <> znoot) THEN mPlay Spiro.channel,ynoot, MIN(gesture.slowdown_val(1), 48) logfile "ON2:"+ STR$(ynoot) ytrig = %True ELSE ynoot = %False END IF END IF ELSE IF ynoot THEN 'IF ISFALSE gesture.slowdown_dur(1) THEN IF ytrig THEN RESET ytrig NoteOff Spiro.channel, ynoot ' logfile "OFF2:"+ STR$(ynoot) RESET ynoot END IF END IF END IF IF gesture.slowdown(2) > gesture.speedup(2) + sens THEN IF ISFALSE ztrig THEN znoot = MAX(Spiro.hightes + sens - (gesture.slowdown(2)* 2), Spiro.lowtes) IF (xnoot <> znoot) AND (ynoot <> znoot) THEN mPlay Spiro.channel,znoot, MIN(gesture.slowdown_val(2), 48) logfile "ON3:"+ STR$(znoot) ztrig = %True ELSE znoot = %False END IF END IF ELSE IF znoot THEN IF ztrig THEN 'IF ISFALSE gesture.slowdown_dur(2) THEN RESET ztrig NoteOff Spiro.channel, znoot 'logfile "OFF3:"+ STR$(znoot) RESET znoot END IF END IF END IF 'demper op x/y Spiro.ctrl(28) = MAX(MIN((4 * Spiro.ctrl(28) + gesture.slowdown_val(0)) / 5, 127), 48) IF Spiro.ctrl(28) <> oldval28 THEN Controller Spiro.channel, 28, Spiro.ctrl(28) oldval28 = Spiro.ctrl(28) END IF Spiro.ctrl(29) = MAX(MIN((4 * Spiro.ctrl(29) + gesture.slowdown_val(1)) / 5, 127), 48) IF spiro.ctrl(29) <> oldval29 THEN Controller Spiro.channel, 29, Spiro.ctrl(29) oldval29 = Spiro.ctrl(29) END IF END SUB '***************************************************************************** SUB Init_LowLevel () ClearTasks '- for 19/10/2011 Task(%LoLeA).naam = "Algo1" Task(%LoLeA).cptr = CODEPTR(LowLevAlgo) Task(%LoLeA).freq = 100 TaskEX(%LoLeA).stopcptr = CODEPTR(LowLevAlgo_Stop) Task(%LoLeB).naam = "Algo2" Task(%LoLeB).cptr = CODEPTR(LowLevAlgo2) Task(%LoLeB).freq = 100 TaskEX(%LoLeB).stopcptr = CODEPTR(LowLevAlgo2_Stop) Task(%LoLeC).naam = "Algo3" ' quartertone Task(%LoLeC).cptr = CODEPTR(LowLevAlgo3) Task(%LoLeC).freq = 100 TaskEX(%LoLeC).stopcptr = CODEPTR(LowLevAlgo3_Stop) Task(%LoLeD).naam = "Algo4" Task(%LoLeD).cptr = CODEPTR(LowLevAlgo4) Task(%LoLeD).freq = 100 TaskEX(%LoLeD).stopcptr = CODEPTR(LowLevAlgo4_Stop) Task(%LoLeE).naam = "Algo5" Task(%LoLeE).cptr = CODEPTR(LowLevAlgo5) Task(%LoLeE).freq = 100 TaskEX(%LoLeE).stopcptr = CODEPTR(LowLevAlgo5_Stop) Task(%LoLeF).naam = "Algo6" Task(%LoLeF).cptr = CODEPTR(LowLevAlgo6) Task(%LoLeF).freq = 100 TaskEX(%LoLeF).stopcptr = CODEPTR(LowLevAlgo6_Stop) Task(%LoLeI).naam = "Gesti" Task(%LoLeI).cptr = CODEPTR(LowLevInteract) Task(%LoLeI).freq = 100 LoL.normspeed = 1 LoL.normbody = 0.5 Task(%LoLeS).naam = "Score" Task(%LoLeS).cptr = CODEPTR(LowLevScoring) Task(%LoLeS).freq = 50 Task(%LoLeZ).naam = "Ending" Task(%LoLeZ).cptr = CODEPTR(LowLevEnd) Task(%LoLeZ).freq = 1 TaskEX(%LoLeZ).stopcptr = CODEPTR(LowLevEnd_Stop) END SUB SUB LowLevAlgo () ' 1 x 8 + 1 = 9 ' 12 x 8 + 2 = 98 ' 123 x 8 + 3 = 987 ' 1234 x 8 + 4 = 9876 ' 12345 x 8 + 5 = 98765 ' 123456 x 8 + 6 = 987654 ' 1234567 x 8 + 7 = 9876543 ' 12345678 x 8 + 8 = 98765432 ' 123456789 x 8 + 9 = 987654321 ' This mapping is for 1232456789 on succesive notes. Multiplication = repetition. Addition = add tonestep STATIC sektie, cnt, maat, rep AS DWORD STATIC ref, oldnoot, minv, maxv, flag AS INTEGER STATIC k AS WORD IF ISFALSE Task(%LoLeA).tog THEN SELECT CASE rep MOD 4 CASE 0 k = Spiro.channel MM_Spiro_On minv = 12 '70 maxv = 48 '120 MM_Spiro_On %MM_Blue ProgChange Spiro.channel, 122 CASE 1 k = Ob.channel MM_Ob_On minv = 60 maxv = 127 MM_Ob_On %MM_Lights CASE 2 k = Korn.channel MM_Korn_On minv = 64 maxv = 127 MM_Korn_On %MM_Lights CASE 3 k = Vibi.channel MM_Vibi_On minv = 12 maxv = 127 MM_Vibi_On %MM_Lights END SELECT ref = 60 RESET maat, cnt sektie = 1 IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%LoLeA).tog = %True INCR rep END IF IF oldnoot THEN Noteoff k, oldnoot ' avoiding held note at the start of spiro IF (maat = 0) AND (sektie = 1) AND (flag = 1) THEN RESET flag EXIT SUB END IF 'RESET oldnoot mag niet!!! IF sektie = 10 THEN stoptask %LoLeA EXIT SUB END IF END IF SELECT CASE maat CASE 0 Task(%LoLeA).freq = 3 + (sektie * 2 / 3 ) ' 4 oldnoot = ref + (cnt MOD sektie) mPlay k, oldnoot, Rangelimit(minv, maxv, LoL.normbody) '64 flag = %True 'PRINT ref + (cnt MOD sektie); INCR cnt IF cnt = (8 * sektie) THEN INCR maat RESET cnt END IF CASE 1 Task(%LoLeA).freq = 0.5 oldnoot = oldnoot + sektie mPlay k, oldnoot, Rangelimit(minv + 20, maxv, LoL.normbody) '82 'PRINT ref + sektie; INCR maat CASE 2 Task(%LoLeA).freq = (9 - cnt)/4 oldnoot = ref + 8 - (cnt MOD sektie) mPlay k, oldnoot , Rangelimit(minv, maxv - cnt, LoL.normbody) ' 64 - cnt 'PRINT ref + 8 - (cnt MOD sektie); INCR cnt IF cnt = sektie THEN RESET maat RESET cnt INCR sektie 'PRINT " " END IF END SELECT Task(%LoLeA).freq *= LoL.normspeed END SUB SUB LowLevAlgo_Stop () MM_Spiro_Off %MM_Notes MM_Spiro_Off %MM_Lights MM_Ob_Off %MM_Notes OR %MM_Lights MM_Vibi_Off %MM_Notes OR %MM_Lights MM_Korn_Off %MM_Notes OR %MM_Lights END SUB SUB LowLevAlgo2 () ' 1 x 8 + 1 = 9 ' 12 x 8 + 2 = 98 ' 123 x 8 + 3 = 987 ' 1234 x 8 + 4 = 9876 ' 12345 x 8 + 5 = 98765 ' 123456 x 8 + 6 = 987654 ' 1234567 x 8 + 7 = 9876543 ' 12345678 x 8 + 8 = 98765432 ' 123456789 x 8 + 9 = 987654321 ' This mapping is for 1232456789 on increasing intervals. Multiplication = repetition. Addition = add tonestep STATIC sektie, cnt, maat, rep, minv, maxv AS DWORD STATIC ref, oldnoot AS INTEGER STATIC k AS WORD LOCAL i, j AS INTEGER IF ISFALSE Task(%LoLeB).tog THEN SELECT CASE rep MOD 4 CASE 0 k = Spiro.channel MM_Spiro_On ref = 36 minv = 12 '70 maxv = 46 '127 MM_Spiro_On %MM_Lights ProgChange Spiro.channel, 122 CASE 1 k = Bono.channel MM_Bono_On ref = 36 minv = 24 maxv = 120 MM_Bono_On %MM_Lights CASE 2 k = Heli.channel MM_Heli_On ref = 36 minv = 24 maxv = 127 MM_Heli_On %MM_Lights CASE 3 k = Piano.channel MM_Piano_On ref = 36 minv = 14 maxv = 120 MM_Piano_On %MM_Lights END SELECT RESET maat, cnt, oldnoot sektie = 1 Task(%LoLeB).tog = %True ' DIM Map(ref TO ref + 9) AS STATIC INTEGER REDIM Map(ref TO ref + 9) AS STATIC INTEGER ' 17/10/2011 this may explain the crashes during uesterdays rehearsals.. j = 0 Map(ref) = ref FOR i = ref + 1 TO ref + 9 INCR j Map(i) = Map(i-1) + j NEXT i INCR rep IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser END IF IF oldnoot THEN Noteoff k, oldnoot 'RESET oldnoot - mag niet want leidt tot nul-noot in case 1 IF sektie = 10 THEN stoptask %LoLeB : EXIT SUB END IF SELECT CASE maat CASE 0 Task(%LoLeB).freq = 3 + (sektie * 2 / 3 ) ' 4 oldnoot = ref + (cnt MOD sektie) oldnoot = Map(oldnoot) ' remap mPlay k, oldnoot, Rangelimit(minv, maxv, LoL.normbody) 'LoL.normbody * 80 ' 64 INCR cnt IF cnt = (8 * sektie) THEN INCR maat RESET cnt END IF CASE 1 Task(%LoLeB).freq = 0.5 oldnoot = oldnoot + sektie mPlay k, oldnoot, Rangelimit(minv+ 20 , maxv, LoL.normbody) 'LoL.normbody * 127 ' 82 INCR maat CASE 2 Task(%LoLeB).freq = (9 - cnt)/4 oldnoot = ref + 8 - (cnt MOD sektie) oldnoot = Map(oldnoot) mPlay k, oldnoot , Rangelimit(minv, maxv-cnt, LoL.normbody) 'LoL.normbody * (64 - cnt) INCR cnt IF cnt = sektie THEN RESET maat RESET cnt INCR sektie END IF END SELECT Task(%LoLeB).freq *= LoL.normspeed END SUB SUB LowLevAlgo2_Stop () MM_Spiro_Off %MM_Notes OR %MM_Lights MM_Bono_Off %MM_Notes OR %MM_Lights MM_Heli_Off %MM_Notes OR %MM_Lights mPlay Heli.Channel, 127, %False ' wit licht uit. MM_Piano_Off %MM_Notes OR %MM_Lights END SUB SUB LowLevAlgo3 () ' 1 x 8 + 1 = 9 ' 12 x 8 + 2 = 98 ' 123 x 8 + 3 = 987 ' 1234 x 8 + 4 = 9876 ' 12345 x 8 + 5 = 98765 ' 123456 x 8 + 6 = 987654 ' 1234567 x 8 + 7 = 9876543 ' 12345678 x 8 + 8 = 98765432 ' 123456789 x 8 + 9 = 987654321 ' This mapping is for 123456789 on increasing intervals. Multiplication = repetition. Addition = add quartertonestep ' quartertone version STATIC sektie, cnt, maat, rep, minv, maxv AS DWORD STATIC ref, oldnoot AS CUR STATIC k AS WORD STATIC M AS musician STATIC velfak AS SINGLE LOCAL i, j AS CUR IF ISFALSE Task(%LoLeC).tog THEN SELECT CASE rep MOD 4 CASE 0 M = Xy ref = Xy.lowtes k = Xy.channel MM_Xy_On 'velfak = 0.3 minv = 15 maxv = 82 MM_Xy_On %MM_Lights CASE 1 M = Tubi ref = 72 'Tubi.lowtes k = Tubi.channel MM_Tubi_On 'velfak = 0.6 minv = 30 maxv = 100 MM_Tubi_On %MM_Lights ' not implemented yet CASE 2 M = Qt ref = 48 k = Qt.channel MM_Qt_On 'velfak = 0.8 minv = 24 maxv = 64 MM_Qt_On %MM_Lights CASE 3 M = Puff ref = 55 'Puff.lowtes MM_Qt_Off k = Puff.channel 'velfak = 0.4 minv = 10 maxv = 64 MM_Puff_On %MM_Lights END SELECT RESET maat, cnt , oldnoot sektie = 1 Task(%LoLeC).tog = %True ' DIM Map(ref TO ref + 9) AS STATIC CUR REDIM Map(ref TO ref + 9) AS STATIC CUR j = 0 Map(ref) = ref FOR i = ref + 1 TO ref + 9 j = j + 0.5 'INCR j Map(i) = Map(i-1) + j NEXT i INCR rep IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser END IF IF oldnoot THEN 'Noteoff k, oldnoot ' must be Q-tone version QInstrumplay M 'RESET oldnoot IF sektie = 10 THEN stoptask %LoLeC : EXIT SUB END IF SELECT CASE maat CASE 0 Task(%LoLeC).freq = 3 + (sektie * 2 / 3 ) ' 4 oldnoot = ref + (cnt MOD sektie) oldnoot = Map(oldnoot) ' remap ' quartertone play function: AddNote2Qhar M.qhar(1),oldnoot, Rangelimit(minv, maxv, LoL.normbody) ' 64 * velfak * LoL.normbody QInstrumplay M INCR cnt IF cnt = (8 * sektie) THEN INCR maat RESET cnt END IF CASE 1 Task(%LoLeC).freq = 0.5 oldnoot = oldnoot + sektie ' quartertone play function: AddNote2Qhar M.qhar(1),oldnoot, Rangelimit(minv+ 12, maxv, LoL.normbody) '82 * velfak * LoL.normbody QInstrumplay M INCR maat CASE 2 Task(%LoLeC).freq = (9 - cnt)/4 oldnoot = ref + 8 - (cnt MOD sektie) oldnoot = Map(oldnoot) ' quartertone play function: AddNote2Qhar M.qhar(1),oldnoot, Rangelimit(minv, maxv- cnt, LoL.normbody) '(64 - cnt) * velfak * LoL.normbody QInstrumplay M INCR cnt IF cnt = sektie THEN RESET maat RESET cnt INCR sektie END IF END SELECT Task(%LoLeC).freq *= LoL.normspeed END SUB SUB LowLevAlgo3_Stop () MM_Qt_Off %MM_Motor MM_Tubi_Off MM_Puff_Off %MM_Lights MM_Xy_Off %MM_Lights END SUB SUB LowLevAlgo4 () ' 1 x 8 + 1 = 9 ' 12 x 8 + 2 = 98 ' 123 x 8 + 3 = 987 ' 1234 x 8 + 4 = 9876 ' 12345 x 8 + 5 = 98765 ' 123456 x 8 + 6 = 987654 ' 1234567 x 8 + 7 = 9876543 ' 12345678 x 8 + 8 = 98765432 ' 123456789 x 8 + 9 = 987654321 ' This mapping is for 1232456789 on increasing intervals. Multiplication = repetition. Addition = add tonestep ' same as algo2 STATIC sektie, cnt, maat, rep, minv, maxv AS DWORD STATIC ref, oldnoot AS INTEGER STATIC k AS WORD LOCAL i, j AS INTEGER IF ISFALSE Task(%LoLeD).tog THEN SELECT CASE rep MOD 4 CASE 0 k = Aeio.channel MM_Aeio_On ref = 36 minv = 64 maxv=127 MM_Aeio_On %MM_Lights CASE 1 k = Bomi.channel MM_Bomi_On ref = 55 minv = 20 maxv = 64 MM_Bomi_On %MM_Lights CASE 2 k = Piperola.channel MM_Piperola_On ref = 60 minv = 20 maxv = 100 MM_Piperola_On %MM_Lights CASE 3 k = Harma.channel MM_Harma_On ref = 36 minv = 20 maxv = 120 MM_Harma_On %MM_Lights END SELECT RESET maat, cnt, oldnoot sektie = 1 Task(%LoLeD).tog = %True ' DIM Map(ref TO ref + 9) AS STATIC INTEGER REDIM Map(ref TO ref + 9) AS STATIC INTEGER j = 0 Map(ref) = ref FOR i = ref + 1 TO ref + 9 INCR j Map(i) = Map(i-1) + j NEXT i INCR rep IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser END IF IF oldnoot THEN Noteoff k, oldnoot 'RESET oldnoot - mag niet want leidt tot nul-noot in case 1 IF sektie = 10 THEN stoptask %LoLeD : EXIT SUB END IF SELECT CASE maat CASE 0 Task(%LoLeD).freq = 3 + (sektie * 2 / 3 ) ' 4 oldnoot = ref + (cnt MOD sektie) oldnoot = Map(oldnoot) ' remap mPlay k, oldnoot, Rangelimit(minv, maxv, LoL.normbody) '64 INCR cnt IF cnt = (8 * sektie) THEN INCR maat RESET cnt END IF CASE 1 Task(%LoLeD).freq = 0.5 oldnoot = oldnoot + sektie mPlay k, oldnoot, Rangelimit(minv+ 12, maxv, LoL.normbody)' 82 INCR maat CASE 2 Task(%LoLeD).freq = (9 - cnt)/4 oldnoot = ref + 8 - (cnt MOD sektie) oldnoot = Map(oldnoot) mPlay k, oldnoot , Rangelimit(minv, maxv- cnt, LoL.normbody) ' 64 - cnt INCR cnt IF cnt = sektie THEN RESET maat RESET cnt INCR sektie END IF END SELECT Task(%LoLeD).freq *= LoL.normspeed END SUB SUB LowLevAlgo4_Stop () MM_Bomi_Off %MM_Notes OR %MM_Lights OR %MM_Motor MM_Piperola_Off %MM_Notes OR %MM_Lights MM_Aeio_Off %MM_Notes OR %MM_Lights MM_Harma_Off %MM_Notes OR %MM_Lights OR %MM_Motor END SUB SUB LowLevAlgo5 () ' 1 x 8 + 1 = 9 ' 12 x 8 + 2 = 98 ' 123 x 8 + 3 = 987 ' 1234 x 8 + 4 = 9876 ' 12345 x 8 + 5 = 98765 ' 123456 x 8 + 6 = 987654 ' 1234567 x 8 + 7 = 9876543 ' 12345678 x 8 + 8 = 98765432 ' 123456789 x 8 + 9 = 987654321 ' This mapping is for 1232456789 on increasing intervals. Multiplication = repetition. Addition = add tonestep ' same as algo2 STATIC sektie, cnt, maat, rep, minv, maxv AS DWORD STATIC ref, oldnoot AS INTEGER STATIC k AS WORD LOCAL i, j AS INTEGER IF ISFALSE Task(%LoLeE).tog THEN SELECT CASE rep MOD 4 CASE 0 k = Fa.channel MM_Fa_On Controller Fa.channel, 17, 80 'Controller Fa.channel, 18, 100 Controller Fa.channel, 19, 18 ref = 36 minv = 96 maxv = 127 MM_Fa_On %MM_Lights CASE 1 k = HarmO.channel MM_HarmO_On ref = 36 minv = 20 maxv = 64 MM_HarmO_On %MM_Lights MM_HarmO_On %MM_Regs CASE 2 k = Vacca.channel 'MM_Vacca_On ref = Vacca.lowtes minv = 26 maxv = 100 ' no lights on vacca... CASE 3 k = Autosax.channel MM_Autosax_On ref = 36 minv = 48 maxv = 125 MM_Autosax_On %MM_Lights END SELECT RESET maat, cnt, oldnoot sektie = 1 Task(%LoLeE).tog = %True ' DIM Map(ref TO ref + 9) AS STATIC INTEGER REDIM Map(ref TO ref + 9) AS STATIC INTEGER j = 0 Map(ref) = ref FOR i = ref + 1 TO ref + 9 INCR j Map(i) = Map(i-1) + j NEXT i INCR rep IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser END IF IF oldnoot THEN Noteoff k, oldnoot 'RESET oldnoot - mag niet want leidt tot nul-noot in case 1 IF sektie = 10 THEN stoptask %LoLeE : EXIT SUB END IF SELECT CASE maat CASE 0 Task(%LoLeE).freq = 3 + (sektie * 2 / 3 ) ' 4 oldnoot = ref + (cnt MOD sektie) oldnoot = Map(oldnoot) ' remap mPlay k, oldnoot, Rangelimit(minv, maxv, LoL.normbody) '64 INCR cnt IF cnt = (8 * sektie) THEN INCR maat RESET cnt END IF CASE 1 Task(%LoLeE).freq = 0.5 oldnoot = oldnoot + sektie mPlay k, oldnoot, Rangelimit(minv+ 12, maxv, LoL.normbody)' 82 INCR maat CASE 2 Task(%LoLeE).freq = (9 - cnt)/4 oldnoot = ref + 8 - (cnt MOD sektie) oldnoot = Map(oldnoot) mPlay k, oldnoot , Rangelimit(minv, maxv- cnt, LoL.normbody) ' 64 - cnt INCR cnt IF cnt = sektie THEN RESET maat RESET cnt INCR sektie END IF END SELECT Task(%LoLeE).freq *= LoL.normspeed END SUB SUB LowLevAlgo5_Stop () MM_Fa_Off %MM_Notes OR %MM_Lights MM_HarmO_Off %MM_Notes OR %MM_Lights OR %MM_Motor 'MM_Vacca_Off %MM_Notes MM_Autosax_Off %MM_Notes OR %MM_Lights END SUB SUB LowLevAlgo6 () ' klung, casta, toypi, bourdonola... ' This mapping is for 1232456789 on succesive notes. Multiplication = repetition. Addition = add tonestep STATIC sektie, cnt, maat, rep AS DWORD STATIC ref, oldnoot, minv, maxv AS INTEGER STATIC k AS WORD IF ISFALSE Task(%LoLeF).tog THEN SELECT CASE rep MOD 4 CASE 0 k = Klung.channel MM_Klung_On ref = Klung.lowtes minv = 30 maxv = 120 MM_Klung_On %MM_Lights CASE 1 k = Casta.channel ' casta uno MM_Casta_On ref = Casta.lowtes minv = 48 maxv = 127 ' lights cause distortion here... CASE 2 k = Toypi.channel MM_Toypi_On ref = Toypi.lowtes minv = 16 maxv = 72 MM_Toypi_On %MM_Lights CASE 3 k = Bourdonola.channel MM_Bourdonola_On ref = Bourdonola.lowtes minv = 12 maxv = 127 MM_Bourdonola_On %MM_Lights END SELECT RESET maat, cnt sektie = 1 IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%LoLeF).tog = %True INCR rep END IF IF oldnoot THEN Noteoff k, oldnoot 'RESET oldnoot mag niet!!! IF sektie = 10 THEN stoptask %LoLeF EXIT SUB END IF END IF SELECT CASE maat CASE 0 Task(%LoLeF).freq = 3 + (sektie * 2 / 3 ) ' 4 oldnoot = ref + (cnt MOD sektie) mPlay k, oldnoot, Rangelimit(minv, maxv, LoL.normbody) '64 IF rep MOD 4 = 1 THEN mPlay Casta2.channel, oldnoot, Rangelimit(minv, maxv, LoL.normbody) INCR cnt IF cnt = (8 * sektie) THEN INCR maat RESET cnt END IF CASE 1 Task(%LoLeF).freq = 0.5 oldnoot = MIN(oldnoot + sektie, 127) mPlay k, oldnoot, Rangelimit(minv + 20, maxv, LoL.normbody) '82 IF rep MOD 4 = 1 THEN mPlay Casta2.channel, oldnoot,Rangelimit(minv + 20, maxv, LoL.normbody) INCR maat CASE 2 Task(%LoLeF).freq = (9 - cnt)/4 oldnoot = ref + 8 - (cnt MOD sektie) mPlay k, oldnoot , Rangelimit(minv, maxv - cnt, LoL.normbody) ' 64 - cnt IF rep MOD 4 = 1 THEN mPlay Casta2.channel, oldnoot , Rangelimit(minv, maxv - cnt, LoL.normbody) INCR cnt IF cnt = sektie THEN RESET maat RESET cnt INCR sektie END IF END SELECT Task(%LoLeF).freq *= LoL.normspeed END SUB SUB LowLevAlgo6_Stop () MM_Bourdonola_Off MM_Klung_Off MM_Toypi_Off MM_Casta_Off END SUB SUB LowLevInteract () ' sets interactivity parameters for above tasks IF ISFALSE Task(%LoLeI).tog THEN IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%LoLeI).tog = %True END IF ' vf = (@pDoppler.xa + @pDoppler.ya + @pDoppler.za) / 3 ' normalized average surface LoL.normbody = gesture.flue_val(3) LoL.normspeed = 1 + MAX( MIN (gesture.fixspeed_val(3) / 200, 1), 0) ' loopt tussen 1 en 2 END SUB SUB LowLevScoring () ' this proc. starts playing tasks on collision triggers LOCAL i, cnt AS DWORD STATIC prev AS DWORD IF ISFALSE Task(%LoLeS).tog THEN IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%LoLeS).tog = %True END IF ' first count how many tasks are active: cnt = %False FOR i = %LoLea TO %LoLef IF Task(i).tog THEN INCR cnt NEXT i IF cnt < 4 THEN DO i = %LoLea + (RND(1) * (%LoLeF- %LoLea)) LOOP UNTIL Task(i).tog = %False ELSE EXIT SUB END IF IF gesture.collision(3) THEN IF i <> prev THEN IF ISFALSE Task(i).tog THEN starttask i prev = i Task(%LoLeS).freq = 0.2 ' 5 seconds wait time EXIT SUB END IF END IF END IF Task(%LoLeS).freq = 50 END SUB SUB LowLevEnd () ' finale for Low Level study #18 - Namuda ' added 16.10.2011 STATIC note1,n1, note2, n2, note3, n3, note4, n4, cnt, minv, maxv AS INTEGER LOCAL i, j AS DWORD IF ISFALSE Task(%LoLeZ).tog THEN IF Task(%LoLeS).tog THEN stoptask %LoLeS ' stop scoring! MM_Humanola_On MM_Krum_On MM_Trump_On MM_So_On MM_So_On %MM_Lights MM_Krum_On %MM_Lights MM_Humanola_On %MM_Lights RESET cnt note1 = 24 note2 = 36 'note3 = 36 note4 = 36 minv = 64 maxv = 127 REDIM Map(note2 TO note2 + 9) AS STATIC INTEGER j = 0 Map(note2) = 36 FOR i = note2 + 1 TO note2 + 9 INCR j Map(i) = Map(i-1) + j 'logfile STR$(Map(i)) NEXT i Task(%LoLeZ).tog = %True RESET i,j ' logfile Funcname$ END IF ' wait to start until other playing tasks run out: RESET j FOR i = %LoLeA TO %LoLeF j += Task(i).tog NEXT i IF j THEN Task(%LoLeZ).freq = 5 EXIT SUB END IF IF cnt < 9 THEN IF cnt > 0 THEN NoteOff So.channel, n1 NoteOff Humanola.channel, n2 NoteOff Krum.channel, n3 NoteOff Trump.channel, n4 END IF ELSE Task(%LoLeZ).freq = 0.2 ' nonsense... stopTask %LoLeZ EXIT SUB END IF ' herneming van maat 3, het 'besluit' van het algoritme Task(%LoLeZ).freq = (9 - cnt)/6 n1 = note1 + (8 - cnt) '32,31,30,29,28,27,26,25,24 mPlay So.channel,n1 , Rangelimit(minv, maxv - cnt, LoL.normbody) n2 = note2 + (8 - cnt) '44,43,42,41,40,39,38,37,36 n2 = Map(n2) '72,64,57,51,46,42,39,37,36 mPlay Humanola.channel, n2 , Rangelimit(minv, maxv - cnt, LoL.normbody) n3 = n2 + 8 - cnt ' 80,71,63,56,50,45,41,38, 36 mPlay Krum.channel, n3, Rangelimit(minv, maxv-cnt, LoL.normbody) n4 = n1 + 12 + (8-cnt) '52,50,48,46,44,42,40,38,36 - o.k. mPlay Trump.channel, n4, Rangelimit(minv, maxv-cnt, LoL.normbody) 'logfile str$(n1) & STR$(n2) & STR$(n3) & STR$(n4) INCR cnt Task(%LoLeZ).freq *= LoL.normspeed END SUB SUB LowLevEnd_Stop () ' does not switch off notes!!! MM_Trump_Off %MM_Motor MM_Humanola_Off %MM_Motor MM_Krum_Off %MM_Motor MM_So_Off MM_So_Off %MM_Lights END SUB '---------------------------------------------------------------------------------------- ' Namuda study #20 - solstice ' 11.12.2011: First full rehearsals with Dominica. SUB Init_Solstice () ClearTasks ' solstice kode : Namuda Study #20 Task(%toneclocktest).naam="tstToCl" Task(%toneclocktest).freq = 2 Task(%toneclocktest).cptr = CODEPTR(ToneClockTest) TaskEx(%toneclocktest).stopcptr = CODEPTR(MM_Qt_Off) Task(%tcchordtest).naam="ToClChor" Task(%tcchordtest).freq = 2 Task(%tcchordtest).cptr = CODEPTR(ToneClockChordTest) TaskEx(%tcchordtest).stopcptr = CODEPTR(MM_Qt_Off) '------------------------------------------------------------ Task(%Solstart).naam = "Solstart" Task(%Solstart).freq = 1 Task(%Solstart).cptr = CODEPTR(SolStart) Task(%Solstart).flags = %False Task(%SolsTim).naam = "SolTim" Task(%SolsTim).freq = 1 Task(%SolsTim).cptr = CODEPTR(SolsTim) Task(%Sols0).naam = "Sols0" Task(%Sols0).freq = 10 Task(%Sols0).Cptr = CODEPTR(Sols0) TaskEx(%Sols0).stopCptr = CODEPTR(MM_Piano_Off) Task(%Sols1).naam = "Solspi" Task(%Sols1).freq = 20 Task(%Sols1).Cptr = CODEPTR(Sols1) TaskEx(%Sols1).stopCptr = CODEPTR(MM_Spiro_Off) Task(%Sols2).naam = "SolBomi" Task(%Sols2).freq = 25 Task(%Sols2).Cptr = CODEPTR(Sols2) TaskEX(%Sols2).stopCptr= CODEPTR(MM_Bomi_Off) Task(%Sols3).naam = "SolFa" Task(%Sols3).freq = 25 Task(%Sols3).Cptr = CODEPTR(Sols3) TaskEX(%Sols3).stopCptr= CODEPTR(MM_Fa_Off) Task(%Sols4).naam = "SolXy" Task(%Sols4).freq = 256 Task(%Sols4).Cptr = CODEPTR(Sols4) 'TaskEX(%Sols4).stopCptr= CODEPTR(MM_Xy_Off) Task(%SolsInt).naam = "SolInt" ' interaction Task(%SolsInt).freq = 50 Task(%SolsInt).cptr = CODEPTR(SolsInt) Task(%Solsend).naam = "SolEnd" ' finale Task(%Solsend).freq = 10 Task(%SolsEnd).cptr = CODEPTR(SolsEnd) END SUB SUB SolStart () STATIC tim AS DWORD IF ISFALSE Task(%Solstart).tog THEN RESET tim Sol.tc = 60 MM_Bourdonola_On IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%Solstart).tog = %True END IF SELECT CASE tim CASE 0 IF ISFALSE Task(%SolsInt).tog THEN starttask %Solsint CASE 2 mPlay Bourdonola.channel, 36, 64 CASE 3 IF ISFALSE Task(%Sols0).tog THEN starttask %Sols0 CASE 4 IF ISFALSE Task(%SolsTim).tog THEN starttask %Solstim CASE 5 NoteOff Bourdonola.channel, 36 mPlay Bourdonola.channel, 37, 64 CASE 7 NoteOff Bourdonola.channel, 37 CASE 8 IF ISFALSE Task(%Sols1).tog THEN starttask %Sols1 ' spiro CASE 30 stoptask %Solstart END SELECT INCR tim END SUB SUB Sols0 () ' for 21.12.2011 ' idea : let energy (body mass * speed) determine the hour in the tone clock (1-12) ' this was not convincing. so we dropped the idea. STATIC uur, tc, velo, omker, ligging, vari AS WORD IF ISFALSE Task(%Sols0).tog THEN IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser ligging = 0 omker = 0 Sol.tc = 60 MM_Piano_On Task(%Sols0).tog = %True END IF ligging = MIN(gesture.edgy(3) * 5, 3) Task(%Sols0).Har.vel = ToneclockChord (sol.tc, Lol.normbody * 74, sol.uur, omker,ligging) ' velo's afhankelijk van body surface INCR omker omker = omker MOD 3 ' vaste permutaties van de akkoordligging: 'IF ISFALSE omker THEN INCR ligging 'uur 'ligging = ligging MOD 4 ' interaktief bepaalde permutaties van de akkoordligging: 'ligging = MIN(gesture.edgy(3) * 4, 3) Piano.Har(1).vel = Task(%Sols0).Har InstrumPlay Piano Task(%Sols0).freq = 1 + (Lol.normspeed * 4) END SUB SUB Sols1 () ' melody line for Spiro STATIC cnt, retval, vari AS LONG IF ISFALSE Task(%Sols1).tog THEN REDIM n(11) AS STATIC WORD RESET cnt MM_Spiro_On MM_Vibi_On Task(%Sols1).tog = %True END IF IF ISFALSE cnt THEN retval = ToneClockSeries (Sol.tc + 12, Sol.uur, vari, n()) IF vari > retval THEN RESET vari ELSE INCR vari END IF END IF INCR cnt cnt = cnt MOD 14 IF cnt < 12 THEN ' speel Addnote2Har Spiro.Har(1), n(cnt), 24 IF Sol.uur = 10 THEN ' transponeer na elk groepje van 4 noten IF ISFALSE cnt MOD 4 THEN Sol.tc = ((Sol.tc \ 12) * 12) + (n(cnt) MOD 12) mPlay Vibi.channel, 60 + (Sol.tc MOD 12), MAX(30, LoL.normbody * 127) END IF ELSE ' transponeer na elk groepje van 3 noten IF ISFALSE cnt MOD 3 THEN Sol.tc = ((Sol.tc \ 12) * 12) + (n(cnt) MOD 12) mPlay Vibi.channel, 60 + (Sol.tc MOD 12) ,MAX(30, LoL.normbody * 127) END IF END IF ELSE ' rust Sol.tc = ((Sol.tc \ 12) * 12) + (n(0) MOD 12) END IF InstrumPlay Spiro Task(%Sols1).freq = (1 + (Lol.normspeed * 5)) * 2 ' this works fine, range could be larger END SUB SUB Sols2 () ' tegenstem STATIC cnt, vari, retval AS LONG STATIC n() AS WORD IF ISFALSE task(%Sols2).tog THEN REDIM n(11) AS STATIC WORD RESET cnt vari = 1 MM_Bomi_On Task(%Sols2).tog = %True END IF IF ISFALSE cnt THEN retval = ToneClockSeries (Sol.tc , Sol.uur, vari, n()) IF vari > retval THEN RESET vari ELSE INCR vari END IF END IF INCR cnt cnt = cnt MOD 17 IF cnt < 12 THEN ' speel Addnote2Har Bomi.Har(1), n(cnt), 24 ELSE ' rust END IF InstrumPlay Bomi Task(%Sols2).freq = (1 + (Lol.normspeed * 4)) * 3 END SUB SUB sols3 () ' tegenstem STATIC cnt, vari, retval, Fa_Noot AS LONG STATIC n() AS WORD IF ISFALSE task(%Sols3).tog THEN REDIM n(11) AS STATIC WORD RESET cnt vari = 1 MM_Fa_On Fa.ctrl(66) = 127 IF fa.ctrl(7) <> 80 THEN Controller Fa.channel, 7, 80 : Fa.ctrl(7) = 80 IF fa.ctrl(16) <> 60 THEN Controller Fa.channel, 16, 60 : Fa.ctrl(16) = 60 IF fa.ctrl(17) <> 127 THEN Controller Fa.channel, 17, 127 : Fa.ctrl(17) = 127 IF fa.ctrl(18) <> 70 THEN Controller Fa.channel, 18, 70 : Fa.ctrl(18) = 70 IF fa.ctrl(19) <> 115 THEN Controller Fa.channel, 19, 115 : Fa.ctrl(19) = 115 IF fa.ctrl(1) <> 1 THEN Controller Fa.channel, 1, 1 : Fa.ctrl(1) = 1 ' ruis IF fa.ctrl(20) <> 64 THEN Controller Fa.channel, 20, 64 : Fa.ctrl(20) = 64 ' tuning 'Controller Fa.channel, 7, 127 : Fa.ctrl(7) = 127 'Controller Fa.channel, 17, 127 : Fa.ctrl(17) = 127 'Controller Fa.channel, 18, 104 : Fa.ctrl(18) = 104 'Controller Fa.channel, 19, 115 : Fa.ctrl(19) = 115 'Controller Fa.channel, 1, 18 : Fa.ctrl(1) = 18 ' ruis 'Controller Fa.channel, 20, 20 : Fa.ctrl(20) = 20 ' tuning Task(%Sols3).tog = %True END IF IF ISFALSE cnt THEN retval = ToneClockSeries (Sol.tc - 12 , Sol.uur, vari, n()) IF vari > retval THEN RESET vari ELSE INCR vari END IF END IF INCR cnt cnt = cnt MOD 19 IF cnt < 12 THEN ' speel Fa_noot = n(cnt) mPlay Fa.channel, n(cnt), @pDoppler.xa * 127 ELSE ' rust IF Fa_noot THEN NoteOff Fa.channel, Fa_noot Fa_Noot = %False END IF END IF Task(%Sols3).freq = (1 + (Lol.normspeed * 5)) * 3 END SUB SUB SolsInt () ' bepaling van het uur volgens de toonklok ' for 21.12.2011 ' idea : let energy (body mass * speed) determine the hour in the tone clock (1-12) LOCAL e AS SINGLE IF ISFALSE Task(%SolsInt).tog THEN IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser Task(%SolsInt).freq = 50 Task(%SolsInt).tog = %True END IF ' get global interactive parameters: ' here we need very long integration times ( 2 seconds here) LoL.normbody = gesture.flue_val(3) LoL.normspeed = (MAX( MIN (gesture.fixspeed_val(3) / 200, 1), 0)) 'e = SQR( (LoL.normbody^2) + (LoL.normspeed^2)) ' stays too low e = SQR(SQR(Lol.normbody) * SQR(LoL.normspeed)) Sol.energy = (Sol.energy * 99 / 100) + (e/100) ' integrator 'LoL.normbody = (LoL.normbody/100 + gesture.flue_val(3))/99 'LoL.normspeed = LoL.normspeed + (MAX( MIN (gesture.fixspeed_val(3) / 200, 1), 0)/99) ' loopt tussen 0 en 1 'Sol.uur = 1 + ((LoL.normbody * LoL.normspeed) * 11) ' 1-12 'Sol.uur = MAX(Sol.uur + (Sol.energy * 11), Sol.uur) - not convincing... END SUB SUB SolsTim () ' time dependent procedure - general scoring ' auditieve time markers via Llor ' moet de toonklok transpo's volgen! STATIC tim, duur, bnoot, bnoot_tim, cnoot AS DWORD LOCAL u$ LOCAL n AS LONG IF ISFALSE Task(%Solstim).tog THEN 'tstart = timegettime sol.uur = 1 tim = %False duur = 420 ' 7' 'MM_Bourdonola_On Task(%Solstim).freq = 1 Task(%Solstim).tog = %True END IF SELECT CASE tim CASE duur / 12 '30 Sol.uur = 2 mPlay Llor.channel, 36, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 1 cnoot = bnoot + 3 CASE duur * 2/12 '60 Sol.uur =3 mPlay Llor.channel, 37, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 2 cnoot = bnoot + 4 CASE duur * 3/12 '90 Sol.uur = 4 mPlay Llor.channel, 38, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 3 cnoot = bnoot + 5 CASE duur * 4/12 '120 Sol.uur = 5 mPlay Llor.channel, 39, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 4 cnoot = bnoot + 6 CASE duur * 5/12 ' 150 Sol.uur = 6 mPlay Llor.channel, 40, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 5 cnoot = bnoot + 4 CASE duur / 2 '180 Sol.uur = 7 mPlay Llor.channel, 41, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 6 cnoot = bnoot + 5 CASE duur * 7/12 ' 210 Sol.uur = 8 mPlay Llor.channel, 42, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 7 cnoot = bnoot + 6 CASE duur * 8/12 '240 Sol.uur = 9 mPlay Llor.channel, 43, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 8 cnoot = bnoot + 7 CASE duur * 9/12 '270 Sol.uur = 10 mPlay Llor.channel, 44, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 9 cnoot = bnoot + 6 CASE duur * 10/ 12 '300 Sol.uur = 11 mPlay Llor.channel, 45, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 10 cnoot = bnoot + 7 CASE duur * 11/ 12 '330 Sol.uur = 12 mPlay Llor.channel, 46, 127 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 bnoot_tim = tim + 11 cnoot = bnoot + 8 CASE duur Stoptask %Solstim StartTask %SolsEnd CASE ELSE IF bnoot THEN IF tim > bnoot_tim THEN NoteOff Bourdonola.channel, bnoot RESET bnoot IF cnoot THEN mPlay Bourdonola.channel, cnoot, 64 END IF ELSE IF cnoot THEN IF tim > bnoot_tim + 1 THEN NoteOff Bourdonola.channel, cnoot RESET cnoot END IF END IF END IF IF (tim MOD 30) > 5 THEN ' so not if we just changed the clock hour IF ISFALSE (tim MOD 6) THEN u$ = Steeredhour (sol.uur) ' check this n = LEN(u$) 'sol.uur = asc(Mid$(u$,rnd(1,n),1)) IF n >= 1 THEN sol.uur = ASC(u$,RND(1,n)) END IF END IF END IF END SELECT INCR tim END SUB SUB Sols4 () ' collision detector ' here we look only into the acceleration data in order to detect collisions. ' the task frequency is 256Hz ' Plays toneclock chords on Xy STATIC xtrig, ytrig, ztrig, strig, lites AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%Sols4).tog THEN 'start gesture analyser IF ISFALSE Task(%Gesture_analyser).tog THEN starttask %Gesture_Analyser MM_Thunderwood_On MM_Xy_On RESET lites sens = 1.4 '14/10 Task(%Sols4).tog = %True END IF ' on collision, do... IF Gesture.collision(0) > sens THEN IF ISFALSE xtrig THEN Xy.Har(1).vel = ToneclockChord(sol.tc+ 24, MIN(Gesture.impact(0) * 127,64),sol.uur,2,MIN(Gesture.collision(0)*4,3)) InstrumPlay Xy xtrig = %True END IF ELSE RESET xtrig END IF IF Gesture.collision(1) > sens THEN IF ISFALSE ytrig THEN Xyq.Har(1).vel = ToneclockChord(sol.tc+ 24, MIN(Gesture.impact(1) * 127,64),sol.uur,0,MIN(Gesture.collision(1)*4,3)) InstrumPlay XyQ 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 Psch.channel, MIN(72 + ((Gesture.collision(2))*3),83), MIN(Gesture.impact(2) * 160, 127) ztrig = %True END IF ELSE RESET ztrig END IF IF gesture.collision(3) THEN IF ISFALSE lites THEN 'licht MM_So_On %MM_White MM_Troms_On %MM_Lights MM_Xy_On %MM_White MM_Vibi_On %MM_White MM_Bono_On %MM_White MM_Bomi_On %MM_White mPlay Thunderwood.channel, 0, 127 lites = %True END IF ELSE IF lites THEN 'licht uit. MM_So_Off %MM_White MM_Troms_Off %MM_Lights MM_Xy_Off %MM_White MM_Vibi_Off %MM_White MM_Bono_Off %MM_White MM_Bomi_Off %MM_White mPlay Thunderwood.channel, 0, %False RESET lites END IF IF strig THEN IF gesture.collision(3) > sens THEN RESET strig END IF END IF END IF END SUB SUB SolsEnd () ' to do: write a finale. ' task-freq = 10Hz STATIC bnoot, cnt AS INTEGER IF ISFALSE Task(%SolsEnd).tog THEN RESET cnt Sol.uur = 12 StopTask %Sols1 ' spiro & tranpositions Task(%SolsEnd).tog = %True END IF SELECT CASE cnt CASE 10 bnoot = 36 + (sol.tc MOD 12) mPlay Bourdonola.channel, bnoot, 64 CASE 20 Stoptask %Sols0 CASE 30 Piano.Har(1).vel = ToneclockChord (sol.tc, 64, sol.uur, 2, 3) InstrumPlay Piano CASE 40 Stoptask %Sols2 CASE 50 StopTask %Sols3 CASE 60 StopTask %Sols4 CASE 70 MM_Bourdonola_Off %MM_Motor CASE 200 MM_AllOff StopTask %SolsInt Stoptask %Solsend END SELECT INCR cnt END SUB '-------------------------------------------------------------------------------------------------------------- SUB Toneclocktest () STATIC hour AS BYTE STATIC vari AS BYTE STATIC n() AS WORD STATIC hw AS DWORD STATIC hdc AS DWORD STATIC c AS LONG STATIC Staff AS stafftype LOCAL ret AS WORD IF ISFALSE Task(%toneclocktest).tog THEN ' DIALOG NEW 0, "toneclock test",50, 50, 300, 50 TO hw ' ' control add graphic, hw, 1, "", 1, 1, 498, 298 ' DIALOG SHOW MODELESS hw ' hdc = GetDC(hw) ' Staff.hor = 1 ' Staff.length = 498 ' Staff.ver = 1 ' Staff.lijnafstand = 1 ' DrawStaff(Staff, hDc) REDIM n(11) AS STATIC WORD ' crash zonder dit Xtof! - dit was een oude versie.. de laatste was getest en werkte MM_Qt_On %MM_Wind OR %MM_Motor hour = 1 Task(%toneclocktest).tog = %True ' dit was ook vergeten xtof. END IF IF c = -1 THEN 'rest in between different variations InstrumPlay Qt c = 0 EXIT SUB END IF IF ISFALSE c THEN ret = ToneClockSeries(60, hour, BYVAL vari, n()) INCR vari IF vari > ret THEN INCR hour IF hour >= 12 THEN hour = 1 ret = 0 END IF 'show notes END IF AddNote2Har Qt.har(1), n(c), 20 InstrumPlay Qt INCR c IF c> UBOUND(n) THEN c = -1 END SUB SUB ToneClockChordTest STATIC h AS BYTE STATIC o AS INTEGER STATIC l AS INTEGER STATIC oo AS BYTE IF ISFALSE task(%tcchordtest).tog THEN task(%tcchordtest).tog = 1 MM_Qt_On %MM_Wind OR %MM_Motor h = 1 END IF IF oo THEN 'non legato InstrumPlay Qt oo = 0 EXIT SUB END IF oo = 1 IF l <= -1 THEN 'rust na iedere omkering InstrumPlay qt l = 0 EXIT SUB END IF IF o <= -1 THEN 'extra rust na ider uur InstrumPlay qt o = 0 EXIT SUB END IF qt.Har(1).vel = ToneClockChord(60, 20, h, o, l) ShowHar Qt.Har(1), 1,140,2! InstrumPlay Qt CONTROL SET TEXT gh.cockpit, %GMT_MSG1, "uur:" + STR$(h) + " omkering:" + STR$(o) + " ligging:" + STR$(l) INCR l IF l > 3 THEN l = - 1 INCR o IF o > 2 THEN o = -1 INCR h IF h > 12 THEN h = 1 END IF END IF END SUB SUB testbend() 'test for NoteFOn and NoteFOff in g_midi.inc, g_lib.dll STATIC cc AS DWORD STATIC s AS DWORD LOCAL n AS CURRENCY STATIC oln AS CURRENCY IF ISFALSE cc THEN DIM TaskParamLabels(1) AS STATIC ASCIIZ * 8 TaskParamLabels(0) = "int" ' noot TaskParamLabels(1) = "frac" ' cents MakeTaskParameterDialog %testbend,2,Slider(),0,UDctrl(),TaskParamLabels() ' 2 sliders! s = TaskEX(%testbend).SliderNumbers(0) END IF n = slider(s).value + (slider(s + 1).value/127 ) CONTROL SET TEXT gh.cockpit, %GMT_MSG1, "note;" + STR$(n) INCR cc SELECT CASE cc MOD 7 CASE 0 NoteFOff ob, oln IF n < So.LowTes OR n > So.HighTes THEN EXIT SELECT NoteFOn So, n, 64 CASE 1 NoteFOff So, oln IF n < Heli.LowTes OR n > Heli.HighTes THEN EXIT SELECT NoteFOn Heli, n, 64 CASE 2 NoteFOff Heli, oln IF n < Bono.LowTes OR n > Bono.HighTes THEN EXIT SELECT NoteFon Bono, n, 64 CASE 3 NoteFOff Bono, oln IF n < Fa.LowTes OR n > Fa.HighTes THEN EXIT SELECT NoteFOn Fa, n, 64 CASE 4 NoteFOff Fa, oln IF n < Autosax.LowTes OR n > Autosax.HighTes THEN EXIT SELECT NoteFOn Autosax, n, 64 CASE 5 NoteFOff Autosax, oln IF n < Korn.LowTes OR n > Korn.HighTes THEN EXIT SELECT NoteFon Korn, n, 64 CASE 6 NoteFOff Korn, n IF n < Ob.LowTes OR n > Ob.HighTes THEN EXIT SELECT NoteFOn Ob, n, 64 END SELECT oln = n END SUB SUB Oorsprong_speedup () 'remapping van de originele Namuda Speedup recognition kode. ' en 'STATIC slnr AS DWORD STATIC xtrig, ytrig, ztrig, xnoot, ynoot, znoot AS LONG STATIC sens AS SINGLE IF ISFALSE Task(%ospu).tog THEN sens = 18 'in Hz units MM_Qt_On %MM_WIND OR %MM_MOTOR MM_Hybr_On IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser Task(%ospu).tog = %True END IF ' on accelerating body speed, do something... ' X-vektor: 'IF gesture.speedup(0) > sens and gesture.speedup(0) > gesture.slowdown(0) THEN ' frequency is unipolar data, not normalized IF gesture.speedup(0) > gesture.slowdown(0) + sens THEN IF ISFALSE xtrig THEN IF xnoot THEN mPlay Qt.channel, xnoot, %False xnoot = MIN(Qt.LowTes - sens + (gesture.speedup(0)* 1.5), Qt.Hightes) mPlay Qt.channel,xnoot, MIN(gesture.speedup_val(0) * 2, 127) xtrig = %True END IF ELSE RESET xtrig IF xnoot THEN IF ISFALSE gesture.speedup_dur(0) THEN mPlay Qt.channel, xnoot, %False RESET xnoot END IF END IF END IF ' IF gesture.speedup(1) > sens THEN IF gesture.speedup(1) > gesture.slowdown(1) + sens THEN IF ISFALSE ytrig THEN IF ynoot THEN mPlay hybr.channel, ynoot, %False ynoot = MIN(Hybr.LowTes - sens + (gesture.speedup(1) * 1.5), 72) 'just hybr, hybrhi is use din loods mPlay Hybr.channel, ynoot, MIN(Gesture.speedup_val(1) * 2, 127) ytrig = %true END IF ELSE IF ynoot THEN IF ISFALSE gesture.speedup_dur(1) THEN mPlay Hybr.channel, ynoot, %False RESET ynoot END IF END IF RESET ytrig END IF END SUB SUB Oorsprong_Speedup_Stop () MM_Qt_Off MM_Hybr_Off END SUB SUB Oorsprong_SlowDown () ' added for Nam.#40, 'Dunkeldark' , nov.2013 STATIC xtrig, ytrig, ztrig AS LONG STATIC xnoot, ynoot, znoot, lites AS WORD STATIC sens AS SINGLE IF ISFALSE Task(%osd).tog THEN sens = 12 MM_Xy_On MM_Vibi_On Controller Vibi.channel, 64, 127 Controller Vibi.channel, 22, 64 Task(%osd).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(Vibi.lowtes - sens + 2+ (gesture.slowdown_val(0)/2), Vibi.hightes) 'independent from sens 15.04 mPlay Vibi.channel, xnoot, 64 xtrig = %True END IF ELSE IF xtrig THEN IF xnoot THEN mPlay Vibi.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(Xy.lowtes - sens + 2+ (gesture.slowdown_val(1)/2), Xy.hightes) mPlay Xy.channel, ynoot, 64 ytrig = %true END IF ELSE IF ytrig THEN IF ynoot THEN mPlay Xy.channel, ynoot, %False RESET ynoot END IF END IF RESET ytrig END IF END SUB SUB Oorsprong_Slowdown_Stop () MM_Xy_Off MM_Vibi_Off END SUB #INCLUDE "C:\b\pb\gmt\namuda\elfjes.inc" #INCLUDE "C:\b\pb\gmt\namuda\emergence.inc" #INCLUDE "C:\b\pb\gmt\namuda\lites.inc" #INCLUDE "C:\b\pb\gmt\namuda\wet.inc" #INCLUDE "C:\b\pb\gmt\namuda\nosi.inc" #INCLUDE "C:\b\pb\gmt\namuda\specs.inc" #INCLUDE "C:\b\pb\gmt\namuda\uni.inc" ' for uni(#28) and dozens(#29) #INCLUDE "C:\b\pb\gmt\namuda\prime.inc" ' for prime(#11) and sense(#31) #INCLUDE "C:\b\pb\gmt\namuda\springs.inc" ' for springs2013 (#32) #INCLUDE "C:\b\pb\gmt\namuda\whispers.inc" ' #38 '=== eof