// SC /// maps @set_osc_handling_tab(1) ///SuperCollider a diferencia de antescofo/sclang $groups := map{} $tracks := map{} $sc_group_struct := map{ } // $SC_Servers := map{} $Servers := map{} $SC_Groups := map{} $synths_map := map{} $track_proc := map{} $sc_struct := map{} $sc_group_id := 300 // $sc_id := 0 $node_id := 100 $bus_index := 86 // depende de los IN/out de la carte son $sc_server_notifications := 0 /// Max interaction /// envoie liste serveurs actives vers Max "servers_max" $cu_servers := 0 $cu_tracks := 0 $from_sc_server := 0 $status_report := 0 /// functions // MaxMsp modern scale mode @fun_def @scale($x, $in_low, $in_high, $out_low, $out_high, $power) { if(($x-$in_low)/($in_high-$in_low) == 0) { $out_low } else { if((($x-$in_low)/($in_high-$in_low)) > 0) { ($out_low + ($out_high-$out_low) * @pow((($x-$in_low)/($in_high-$in_low)), $power)) } else { ( $out_low + ($out_high-$out_low) * -(@pow(((-$x+$in_low)/($in_high-$in_low)), $power))) } } } @fun_def @choose($tab) { return $tab[@rand_int(@size($tab))] } @fun_def @rand_range($min, $max) {@rand($max-$min)+$min} @fun_def @rand_range_int($min, $max) {@rand_int($max-$min)+$min} @fun_def @rand2($val) {@rand_range($val.neg(), $val)} @fun_def @dur2sec($val) {$val*(60/$RT_TEMPO)} @fun_def @true ($x) {return true} @fun_def clip($x, $l, $h) { if(($x >= $l)&&($x <= $h)) { return $x }else{ if($x <= $l) { return $l }else{ return $h } } } @fun_def build_nim_from_bpf($bpf) // crea NIM a partir de bpf tab [v0, t0, (type0), v1, t1, (type1), v2, t2, (type2)....] { @local $i, $period, $val0, $val1, $type, $duree, $nim $i := 0 $val1 := $bpf[0] $period := $bpf[1] ; because it appears in the Loop period $nim := NIM{ 0 $val1, 0 $val1 } Loop //@exclusive { $val0 := $bpf[$i] $period := $bpf[$i+1] $duree := $period - 0.001 if (@is_string($bpf[$i+2])) { $type := $bpf[$i+2] $val1 := $bpf[$i+3] $i := $i + 3; } else { $type := "linear" $val1 := $bpf[$i+2] $i := $i + 2; } $nim.push_back($val0, $period, $val1, $type) } while ($i+2 < @size($bpf)) return $nim } ////////// Capteurs // obj captation gestuelle @obj_def test_osc($osc1) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data @command($pre) $tab // print $pre $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } $obj_dispatch_map := map{} @obj_def osc_dispatch($port, $prefix, $riot_pref) { @local $listener, $receive, $name @init { $listener := MAP{} oscrecv osc $port $prefix $receive $name := $riot_pref($prefix) $obj_dispatch_map.add_pair($name, $THISOBJ) // print name1 $name $port $prefix } @whenever ($receive == $receive) { // forall $obj in $listener forall $k, $obj in $listener { _ := $obj.new_data($name, $receive) // print $receive /* switch ($riot_pref($prefix)) { case "/1/intensity2": $obj.handle_intensity2($receive) } */ } } @fun_def suscribe($obj) { // $listener := $listener.push_back($obj) // print $listener _ := $listener.add_pair("ob"+$obj, $obj) // print $listener } @fun_def unsuscribe($obj) { // print $listener _ := $listener.remove("ob"+$obj) // print $listener } @fun_def name() { // print $listener // _ := $listener.remove("ob"+$obj) // print $listener return (@take($name, 3)+@last($name)) } @fun_def osc_name() { // print $listener // _ := $listener.remove("ob"+$obj) // print $listener return $name } } @obj_def envfoll_ana_dispatch() { @local $listener @init { $listener := MAP{} } @whenever ($envfoll_ana == $envfoll_ana) { forall $k, $obj in $listener { _ := $obj.new_data($envfoll_ana) } } @fun_def suscribe($obj) { _ := $listener.add_pair("ob"+$obj, $obj) } @fun_def unsuscribe($obj) { _ := $listener.remove("ob"+$obj) } } @obj_def pitch_ana_dispatch() { @local $listener @init { $listener := MAP{} } @whenever ($pitch_ana == $pitch_ana) { forall $k, $obj in $listener { _ := $obj.new_data($pitch_ana) } } @fun_def suscribe($obj) { _ := $listener.add_pair("ob"+$obj, $obj) } @fun_def unsuscribe($obj) { _ := $listener.remove("ob"+$obj) } } @obj_def still_ana_dispatch() { @local $listener @init { $listener := MAP{} } @whenever ($still_ana == $still_ana) { forall $k, $obj in $listener { _ := $obj.new_data($still_ana) } } @fun_def suscribe($obj) { _ := $listener.add_pair("ob"+$obj, $obj) } @fun_def unsuscribe($obj) { _ := $listener.remove("ob"+$obj) } } $ana_envfoll := obj::envfoll_ana_dispatch() $ana_pitch := obj::pitch_ana_dispatch() $ana_still := obj::still_ana_dispatch() @obj_def osc2_max2_intensity($osc1, $command) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data _ := @set_osc_handling_tab(false) max2 $command ($tab[0]) _ := @set_osc_handling_tab(1) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max_scale($osc1, $command, $f1, $f2, $f3, $f4, $f5) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data // _ := @set_osc_handling_tab(false) @command($command) (@scale($tab, $f1, $f2, $f3, $f4, $f5)) // _ := @set_osc_handling_tab(true) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } // $bruno_incl_front_L $bruno_incl_lat_L gizmo1_transp @obj_def osc2_max_modulation($osc1, $osc2, $command, $f1, $f2, $f3, $f4, $vib_scl1, $vib_scl2, $vib_scl3, $vib_scl4) { @local $name1, $name2, $pitch_mod, $vibra_mod := 0, $mod_result := 0 @init { _ := $osc1.suscribe($THISOBJ) _ := $osc2.suscribe($THISOBJ) $name1 := $osc1.osc_name() $name2 := $osc2.osc_name() } @fun_def new_data($pre, $tab) { switch ($pre) { case ($name1): // pitch modulation $pitch_mod := @scale($tab, $f1, $f2, $f3, $f4, 1) $mod_result := $pitch_mod+$vibra_mod @command($command) $mod_result case ($name2): // vibrato modulation $vibra_mod := @scale($tab, $vib_scl1, $vib_scl2, $vib_scl3, $vib_scl4, 1) } } @abort { _ := $osc1.unsuscribe($THISOBJ) _ := $osc2.unsuscribe($THISOBJ) } } @obj_def osc2_max($osc1, $command) { @init { _ := $osc1.suscribe($THISOBJ) print osc2_max } @fun_def new_data($pre, $tab) { ; handling a new data _ := @set_osc_handling_tab(false) @command($command) $tab _ := @set_osc_handling_tab(1) } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max_ana($ana, $command, $command_num) { @init { _ := $ana.suscribe($THISOBJ) print osc2_max } @fun_def new_data($data) { ; handling a new data // _ := @set_osc_handling_tab(false) @command($command) $data @command($command_num) $desc_tab_ana // _ := @set_osc_handling_tab(true) } @abort { _ := $ana.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_trigger_one($osc_perc) { @local $name //, $onebang := true @init { $osc_perc.suscribe($THISOBJ) $name := $osc_perc.osc_name() } @fun_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ($name): $kick_trigger_one := 1 print kick $name // $onebang := false abort $THISOBJ } } @abort { $osc_perc.unsuscribe($THISOBJ) abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample($osc_perc, $sound, $amp, $chnl, $index) { @init { $osc_perc.suscribe($THISOBJ) } @fun_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ("kick_"+$index): // playsample_solo_G @choose($samples_hang) 0 $amp @rand_range(0.8, 1.2) Samples sample $sound $amp $chnl // print sample $sound $amp $chnl // _ := $sc_track_play_samp.play_sample($sound_tab[$inc], $nim_map_lat($incli_l), @rand_int(2)) print kick $index } } @abort { $osc_perc.unsuscribe($THISOBJ) abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_one($osc_perc, $sound, $amp, $chnl, $index) { @local $onebang := true @init { $osc_perc.suscribe($THISOBJ) } @fun_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ("kick_"+$index): // playsample_solo_G @choose($samples_hang) 0 $amp @rand_range(0.8, 1.2) Samples if($onebang) { sample $sound $amp $chnl // print sample $sound $amp $chnl // _ := $sc_track_play_samp.play_sample($sound_tab[$inc], $nim_map_lat($incli_l), @rand_int(2)) print kick $index $onebang := false abort $THISOBJ } } } @abort { $osc_perc.unsuscribe($THISOBJ) abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_one_all($qui, $sound, $amp) { @local $onebang := true, $mainL, $mainR, $map_mains := map {} @init { $mainL := $qui+"_kick_L" $mainR := $qui+"_kick_R" $map_mains.add_pair($mainL, 1) $map_mains.add_pair($mainR, 2) $obj_dispatch_map($mainL).suscribe($THISOBJ) $obj_dispatch_map($mainR).suscribe($THISOBJ) } @fun_def new_data($prepend, $tab) { // print $prepend if (($prepend == $mainL) || ($prepend == $mainR)) { sample $sound $amp ($map_mains($prepend)) } print kick $prepend $onebang := false abort $THISOBJ } @abort { $obj_dispatch_map($mainL).unsuscribe($THISOBJ) $obj_dispatch_map($mainR).unsuscribe($THISOBJ) 0.1 abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_list($osc_perc, $sound_list, $amp, $chnl, $index, $boucle = 0) { @local $inc := 0, $list_size @init { _ := $osc_perc.suscribe($THISOBJ) $list_size := $sound_list.size() } @fun_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ("kick_"+$index): // playsample_solo_G @choose($samples_hang) 0 $amp @rand_range(0.8, 1.2) Samples if($inc < $list_size) { sample ($sound_list[$inc]) $amp $chnl // print sample $sound $amp $chnl // _ := $sc_track_play_samp.play_sample($sound_tab[$inc], $nim_map_lat($incli_l), @rand_int(2)) print kick $index if($boucle == 0) { $inc += 1 } else { $inc := ($inc + 1) % $list_size } } // else // { // @abort($THISOBJ) // } } } @abort { _ := $osc_perc.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_list_2M($qui, $sound_list, $amp, $boucle = 0) { @local $inc := 0, $list_size, $mainL, $mainR, $map_mains := map {} @init { $mainL := $qui+"_kick_L" $mainR := $qui+"_kick_R" $map_mains.add_pair($mainL, 1) $map_mains.add_pair($mainR, 2) $obj_dispatch_map($mainL).suscribe($THISOBJ) $obj_dispatch_map($mainR).suscribe($THISOBJ) $list_size := $sound_list.size() } @fun_def new_data($prepend, $tab) { print $prepend if (($prepend == $mainL) || ($prepend == $mainR)) { if($inc < $list_size) { if($sound_list[$inc].is_tab()) { forall $s in $sound_list[$inc] // si c'est une liste { sample $s $amp ($map_mains($prepend)) print sampe_multi $s } } else { sample ($sound_list[$inc]) $amp ($map_mains($prepend)) print sampe_solo ($sound_list[$inc]) } print kick $prepend if($boucle == 0) { $inc += 1 } else { $inc := ($inc + 1) % $list_size } } else { abort $THISOBJ } } } @abort { $obj_dispatch_map($mainL).unsuscribe($THISOBJ) $obj_dispatch_map($mainR).unsuscribe($THISOBJ) // _ := $osc_perc.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_list_2M2($qui, $sound_list, $amp, $boucle = 0) { @local $inc := 0, $list_size, $mainL, $mainR, $map_mains := map {} @init { $mainL := $qui+"_kick_L" $mainR := $qui+"_kick_R" $map_mains.add_pair($mainL, 1) $map_mains.add_pair($mainR, 2) $obj_dispatch_map($mainL).suscribe($THISOBJ) $obj_dispatch_map($mainR).suscribe($THISOBJ) $list_size := $sound_list.size() } @fun_def new_data($prepend, $tab) { print $prepend if (($prepend == $mainL) || ($prepend == $mainR)) { if($inc < $list_size) { if($sound_list[$inc].is_tab()) { forall $s in $sound_list[$inc] // si c'est une liste { sample $s $amp ($map_mains($prepend)) print sampe_multi $s } } else { sample ($sound_list[$inc]) $amp ($map_mains($prepend)) print sampe_solo ($sound_list[$inc]) } print kick $prepend if($boucle == 0) { $inc += 1 } else { $inc := ($inc + 1) % $list_size } } // abort $THISOBJ } } @abort { $obj_dispatch_map($mainL).unsuscribe($THISOBJ) $obj_dispatch_map($mainR).unsuscribe($THISOBJ) // _ := $osc_perc.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_list_2M2_pos($qui, $sound_list, $amp, $seuil, $boucle = 0) { @local $inc := 0, $list_size, $mainL, $mainR, $front_posL, $front_posR, $rt_posL := 0, $rt_posR := 0, $map_mains := map {} @init { $mainL := $qui+"_kick_L" $mainR := $qui+"_kick_R" $front_posL := $qui+"_incl_front_L" $front_posR := $qui+"_incl_front_R" $map_mains.add_pair($mainL, 2) $map_mains.add_pair($mainR, 1) $obj_dispatch_map($mainL).suscribe($THISOBJ) $obj_dispatch_map($mainR).suscribe($THISOBJ) $obj_dispatch_map($front_posL).suscribe($THISOBJ) $obj_dispatch_map($front_posR).suscribe($THISOBJ) $list_size := $sound_list.size() } @fun_def new_data($prepend, $tab) { // print $prepend switch($prepend) { case $front_posL: $rt_posL := $tab case $front_posR: $rt_posR := $tab } if (($prepend == $mainL) && ($rt_posL > $seuil)) { if($inc < $list_size) { if($sound_list[$inc].is_tab()) { forall $s in $sound_list[$inc] // si c'est une liste { sample $s $amp ($map_mains($prepend)) print sampe_multi $s } } else { sample ($sound_list[$inc]) $amp ($map_mains($prepend)) print sampe_solo ($sound_list[$inc]) } print kick $prepend if($boucle == 0) { $inc += 1 } else { $inc := ($inc + 1) % $list_size } } } else { if (($prepend == $mainR) && ($rt_posR > $seuil)) { if($inc < $list_size) { if($sound_list[$inc].is_tab()) { forall $s in $sound_list[$inc] // si c'est une liste { sample $s $amp ($map_mains($prepend)) print sampe_multi $s } } else { sample ($sound_list[$inc]) $amp ($map_mains($prepend)) print sampe_solo ($sound_list[$inc]) } print kick $prepend if($boucle == 0) { $inc += 1 } else { $inc := ($inc + 1) % $list_size } } } } } @abort { $obj_dispatch_map($mainL).unsuscribe($THISOBJ) $obj_dispatch_map($mainR).unsuscribe($THISOBJ) $obj_dispatch_map($front_posL).unsuscribe($THISOBJ) $obj_dispatch_map($front_posR).unsuscribe($THISOBJ) // _ := $osc_perc.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_list_1M_pos($qui, $sound_list, $amp, $seuil, $boucle = 0) { @local $inc := 0, $list_size, $mainL, $mainR, $front_posL, $front_posR, $rt_posL := 0, $rt_posR := 0, $map_mains := map {} @init { // $mainL := $qui+"_kick_L" $mainR := $qui+"_kick_R" // $front_posL := $qui+"_incl_front_L" $front_posR := $qui+"_incl_front_R" // $map_mains.add_pair($mainL, 2) $map_mains.add_pair($mainR, 1) // $obj_dispatch_map($mainL).suscribe($THISOBJ) $obj_dispatch_map($mainR).suscribe($THISOBJ) // $obj_dispatch_map($front_posL).suscribe($THISOBJ) $obj_dispatch_map($front_posR).suscribe($THISOBJ) $list_size := $sound_list.size() } @fun_def new_data($prepend, $tab) { // print $prepend switch($prepend) { // case $front_posL: // $rt_posL := $tab case $front_posR: $rt_posR := $tab } // if (($prepend == $mainL) && ($rt_posL > $seuil)) // { // if($inc < $list_size) // { // if($sound_list[$inc].is_tab()) // { // forall $s in $sound_list[$inc] // si c'est une liste // { // sample $s $amp ($map_mains($prepend)) // print sampe_multi $s // } // } // else // { // sample ($sound_list[$inc]) $amp ($map_mains($prepend)) // print sampe_solo ($sound_list[$inc]) // } // print kick $prepend // if($boucle == 0) // { // $inc += 1 // } // else // { // $inc := ($inc + 1) % $list_size // } // } // } // else // { if (($prepend == $mainR) && ($rt_posR > $seuil)) { if($inc < $list_size) { if($sound_list[$inc].is_tab()) { forall $s in $sound_list[$inc] // si c'est une liste { sample $s $amp @rand_range_int(7, 8) print sampe_multi $s } } else { sample ($sound_list[$inc]) $amp @rand_range_int(7, 8) print sampe_solo ($sound_list[$inc]) } print kick $prepend if($boucle == 0) { $inc += 1 } else { $inc := ($inc + 1) % $list_size } } } // } } @abort { // $obj_dispatch_map($mainL).unsuscribe($THISOBJ) $obj_dispatch_map($mainR).unsuscribe($THISOBJ) // $obj_dispatch_map($front_posL).unsuscribe($THISOBJ) $obj_dispatch_map($front_posR).unsuscribe($THISOBJ) // _ := $osc_perc.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def kick_sample_rand($osc_perc, $sound_list, $amp, $chnl, $index) { // @local $inc := 0 @init { _ := $osc_perc.suscribe($THISOBJ) } @fun_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ("kick_"+$index): // playsample_solo_G @choose($samples_hang) 0 $amp @rand_range(0.8, 1.2) Samples sample ($sound_list.choose()) $amp (@rand_int($chnl)+1) // print sample $sound $amp $chnl // _ := $sc_track_play_samp.play_sample($sound_tab[$inc], $nim_map_lat($incli_l), @rand_int(2)) print kick $index // else // { // $THISOBJ.abort() // } } } @abort { _ := $osc_perc.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } // obj::pedal_freeze("freeze1", 1, 20) @obj_def pedal_freeze($freeze, $amp, $dur) { @local $onebang := true, $name, $freeze_num, $val, $proc := 0 @init { // _ := $osc_perc.suscribe($THISOBJ) // $name := $osc_perc.osc_name() // print osc_name $name $freeze_num := @to_num($freeze.last()) print freeze_num $freeze_num if ($onebang) { $onebang := false // print kick $name // abort $proc // $proc := { group { Freeze ("freeze"+$freeze_num) curve @action := { @command("sogs-"+$freeze_num+"-lev") $val} , @grain := 0.1s { $val { { ($amp-3) } 1s { $amp } ($dur)s { -75 } } } ($dur+1)s Freeze ("freeze"+$freeze_num) off // $onebang := true // abort $proc // } } } } @abort { // _ := $osc_perc.unsuscribe($THISOBJ) 0.1 abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } // obj::kick_freeze($bruno_kick_L, "freeze1", 1, 20, 1) @obj_def kick_freeze($osc_perc, $freeze, $amp, $dur) { @local $onebang := true, $name, $freeze_num, $val, $proc := 0 @init { _ := $osc_perc.suscribe($THISOBJ) $name := $osc_perc.osc_name() print osc_name $name $freeze_num := @to_num($freeze.last()) print freeze_num $freeze_num } @proc_def new_data($prepend, $tab) { if ($onebang) { // print $prepend switch ($prepend) { case ($name): $onebang := false print kick $name print val $tab abort $proc $proc := { group { Freeze ("freeze"+$freeze_num) curve @action := {@command("sogs-"+$freeze_num+"-lev") $val} , @grain := 0.1s { $val { { ($amp-3) } 1s { $amp } ($dur)s { -75 } } } ($dur+1)s Freeze ("freeze"+$freeze_num) off $onebang := true abort $proc } } // abort $THISOBJ // } } } } @abort { _ := $osc_perc.unsuscribe($THISOBJ) 0.1 abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } // obj::kick_freeze($bruno_kick_L, "freeze1", 1, 20, 1) @obj_def kick_freeze2($osc_perc, $freeze, $amp, $dur) { @local $onebang := true, $name, $freeze_num, $val, $proc := 0 @init { _ := $osc_perc.suscribe($THISOBJ) $name := $osc_perc.osc_name() print osc_name $name $freeze_num := @to_num($freeze.last()) print freeze_num $freeze_num } @proc_def new_data($prepend, $tab) { if ($onebang) { $onebang := false // print $prepend switch ($prepend) { case ($name): group { print kick $name // abort $proc $proc := { Freeze ("freeze"+$freeze_num) curve @action := {@command("sogs-"+$freeze_num+"-lev") $val} , @grain := 0.1 { $val { { ($amp-3) } 1 { $amp } 3 { -75 } } } 3 Freeze ("freeze"+$freeze_num) off $onebang := true // abort $proc } } // abort $THISOBJ // } } } } @abort { _ := $osc_perc.unsuscribe($THISOBJ) 0.1 abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } // obj::kick_freeze($bruno_kick_L, "freeze1", 1, 20, 1, main_direction) @obj_def kick_freeze_spat($osc_perc, $freeze, $amp, $dur, $main_L_R, $dur_spat) { @local $onebang := true, $name, $freeze_num, $val, $proc := 0, $x, $y, $z @init { _ := $osc_perc.suscribe($THISOBJ) $name := $osc_perc.osc_name() print osc_name $name $freeze_num := @to_num($freeze.last()) print freeze_num $freeze_num } @proc_def new_data($prepend, $tab) { if ($onebang) { // print $prepend switch ($prepend) { case ($name): $onebang := false print kick $name abort $proc $proc := { group { Freeze ("freeze"+$freeze_num) curve @action := {@command("sogs-"+$freeze_num+"-lev") $val} , @grain := 0.1s { $val { { ($amp-3) } 1s { $amp } ($dur)s { -75 } } } ($dur+1)s Freeze ("freeze"+$freeze_num) off $onebang := true abort $proc } if($main_L_R == "R") { curve @action := {spat-oper-command ("/source/"+($freeze_num+4)+"/xyz") $x $y $z} , @grain := 0.1s { $x, $y, $z { { 0.978684, 0.021131, 0.204281 } $dur_spat { -0.985828, 0.041215, 0.162618 } } } } else { curve @action := {spat-oper-command ("/source/"+($freeze_num+4)+"/xyz") $x $y $z} , @grain := 0.1s { $x, $y, $z { { -0.985828, 0.041215, 0.162618 } $dur_spat { 0.978684, 0.021131, 0.204281 } } } } } // abort $THISOBJ // } } } } @abort { _ := $osc_perc.unsuscribe($THISOBJ) 0.1 abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } // obj::kick_freeze($bruno_kick_L, "freeze1", 1, 20, 1) @obj_def kick_freeze_one($osc_perc, $freeze, $amp, $dur) { @local $onebang := true, $name, $freeze_num @init { _ := $osc_perc.suscribe($THISOBJ) $name := $osc_perc.osc_name() print osc_name $name $freeze_num := @to_num($freeze.last()) print freeze_num $freeze_num } @proc_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ($name): if ($onebang) { Freeze ("freeze"+$freeze_num) $onebang := false print kick $name curve @action := {@command("sogs-"+$freeze_num+"-lev") $x} , @grain := 0.1s { $x { { $amp } 1s { $amp } ($dur)s { -75 } } } ($dur+1)s Freeze ("freeze"+$freeze_num) off abort $THISOBJ } } } @abort { _ := $osc_perc.unsuscribe($THISOBJ) abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } // $descriptors := ["Duration", "Frequency-mean", "Energy-mean", "Periodicity-mean", "AC1-mean", "Loudness-mean", "Centroid-mean", "Spread-mean", "Skewness-mean", "Kurtosis-mean"] $descriptors := MAP {("Duration", 0), ("Frequency-mean", 1), ("Energy-mean", 2), ("Periodicity-mean", 3), ("AC1-mean", 4), ("Loudness-mean", 5), ("Centroid-mean", 6), ("Spread-mean", 7), ("Skewness-mean", 8), ("Kurtosis-mean", 9)} $desc_tab := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] $desc_tab_ana := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] $weights_chop := MAP {("bruL", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("bruR", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("adeL", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("adeR", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("aurL", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("aurR", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])} $weights_onseg := MAP {("bruL", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("bruR", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("adeL", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("adeR", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("aurL", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ("aurR", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])} @proc_def weights($command_num, $descs) { @local $list_weights := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // $weights_chop.add_pair($command_num, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) // reset list forall $d in $descs { $list_weights[$descriptors($d)] := 1 // print weights_chop ($weights_chop($command_num)) // $weights[$descriptors($d)] := 1 @command($command_num) weights $list_weights } // @abort { // // _ := $osc1.unsuscribe($THISOBJ) // // _ := $osc_gest.unsuscribe($THISOBJ) // } } // obj::osc2_max_descriptors($bruno_incl_lat_L, "concat_onseg_1", "Duration", $weights_onseg, 1) // trabaja con nim $quart_intensity_all // print ("adelaide_L".last()) // print ("adelaide_L".take(3)) @obj_def osc2_max_descriptors($osc1, $command_num, $desc, $weights) { @local $name @init { $osc1.suscribe($THISOBJ) $name := $osc1.name() print name_name $name } @fun_def new_data($pre, $tab) { $weights($name)[$descriptors($desc)] := $tab @command($command_num) ($weights($name)) // print $desc_tab // _ := @set_osc_handling_tab(true) } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max_descriptors_ana($ana_obj, $desc) { @local $name @init { $ana_obj.suscribe($THISOBJ) // $name := $osc1.name() // print name_name $name } @fun_def new_data($data) { $desc_tab_ana[$descriptors($desc)] := $data // print $desc_tab // _ := @set_osc_handling_tab(true) } @abort { _ := $ana_obj.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max_descriptors_intensity($osc1, $command_num, $desc, $weights) { @local $name @init { $osc1.suscribe($THISOBJ) $name := $osc1.name() print name_name $name } @fun_def new_data($pre, $tab) { ; handling a new data // _ := @set_osc_handling_tab(false) $weights($name)[$descriptors($desc)] := $quart_intensity_all2($tab[0]) @command($command_num) ($weights($name)) // @command($command_num) ($quart_intensity_all2($tab[0])) // print $tab // _ := @set_osc_handling_tab(true) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max2($osc1, $command) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data _ := @set_osc_handling_tab(false) max2 $command $tab _ := @set_osc_handling_tab(1) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max2_nim($osc1, $command, $nim) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data // _ := @set_osc_handling_tab(false) max2 $command ($nim($tab)) // print $tab // _ := @set_osc_handling_tab(true) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } // $quart_intensity_all2 := NIM { 0 -120, 0.001 -16 "exp_out",0.1 0 "exp_out", 3 10 "linear" } //"exp_out" $quart_intensity_all2 := NIM { 0 0, 0.01 0.3 "exp_out", 0.5 0.7 "exp_out", 1.1 1 "linear" } //"exp_out" @obj_def osc2_max2_nim_intensity($osc1, $command) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data // _ := @set_osc_handling_tab(false) max2 $command ($quart_intensity_all2($tab[0])) // print $tab // _ := @set_osc_handling_tab(true) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max_nim_intensity($osc1, $command_num) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data // _ := @set_osc_handling_tab(false) @command($command_num) ($quart_intensity_all2($tab[0])) // print $tab // _ := @set_osc_handling_tab(true) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def osc2_max2_still($osc1, $command, $f3, $f4) { @init { _ := $osc1.suscribe($THISOBJ) } @fun_def new_data($pre, $tab) { ; handling a new data // _ := @set_osc_handling_tab(false) max2 $command (@scale($tab[1], 0, 1, $f3, $f4, 1)) // print $tab // _ := @set_osc_handling_tab(true) // print $tab } @abort { _ := $osc1.unsuscribe($THISOBJ) // _ := $osc_gest.unsuscribe($THISOBJ) } } //bruno_L port 8880 router_ssid riot_1 //bruno_R port 8881 router_ssid riot_1 //adelaide_L port 8882 router_ssid riot_1 //adelaide_R port 8883 router_ssid riot_2 //aurelien_L port 8884 router_ssid riot_2 //aurelien_R port 8884 router_ssid riot_2 $bruno_prefix_L := map {("/0/raw", "raw_L"), ("/0/incl_front", "bruno_incl_front_L"), ("/0/incl_lat", "bruno_incl_lat_L"), ("/0/still", "bruno_still_L"), ("/0/intensity2", "bruno_intensity2_L"), ("/0/acc-intensity", "bruno_acc-intensity_L"), ("/0/kick", "bruno_kick_L"), ("/0/kick2", "bruno_kick2_L"), ("/0/kickdir", "bruno_kickdir_L"), ("/0/kickpos", "bruno_kickpos_L"), ("/0/gyrkick", "bruno_gyrkick_L"), ("/0/dir_deriv", "bruno_dir_reriv_L"), ("/0/direction", "bruno_direction_L"), ("/0/mov_horiz", "bruno_mov_horiz_L"), ("/0/pitchrollyaw", "bruno_pitchrollyaw_L"), ("/0/dir_reriv", "bruno_dir_reriv_L")} $bruno_prefix_R := map {("/0/incl_front", "bruno_incl_front_R"), ("/0/incl_lat", "bruno_incl_lat_R"), ("/0/still", "bruno_still_R"), ("/0/intensity2", "bruno_intensity2_R"), ("/0/acc-intensity", "bruno_acc-intensity_R"), ("/0/kick", "bruno_kick_R"), ("/0/kick2", "bruno_kick2_R"), ("/0/kickdir", "bruno_kickdir_R"), ("/0/kickpos", "bruno_kickpos_R"), ("/0/gyrkick", "bruno_gyrkick_R"), ("/0/dir_deriv", "bruno_dir_reriv_R"), ("/0/direction", "bruno_direction_R"), ("/0/mov_horiz", "bruno_mov_horiz_R"), ("/0/pitchrollyaw", "bruno_pitchrollyaw_R"), ("/0/dir_reriv", "bruno_dir_reriv_L")} $adelaide_prefix_L := map {("/0/incl_front", "adelaide_incl_front_L"), ("/0/incl_lat", "adelaide_incl_lat_L"), ("/0/still", "adelaide_still_L"), ("/0/intensity2", "adelaide_intensity2_L"), ("/0/acc-intensity", "adelaide_acc-intensity_L"), ("/0/kick", "adelaide_kick_L"), ("/0/kick2", "adelaide_kick2_L"), ("/0/kickdir", "adelaide_kickdir_L"), ("/0/kickpos", "adelaide_kickpos_L"), ("/0/gyrkick", "adelaide_gyrkick_L"), ("/0/dir_deriv", "adelaide_dir_reriv_L"), ("/0/direction", "adelaide_direction_L"), ("/0/mov_horiz", "adelaide_mov_horiz_L"), ("/0/pitchrollyaw", "adelaide_pitchrollyaw_L"), ("/0/dir_reriv", "adelaide_dir_reriv_L")} $adelaide_prefix_R := map {("/0/incl_front", "adelaide_incl_front_R"), ("/0/incl_lat", "adelaide_incl_lat_R"), ("/0/still", "adelaide_still_R"), ("/0/intensity2", "adelaide_intensity2_R"), ("/0/acc-intensity", "adelaide_acc-intensity_R"), ("/0/kick", "adelaide_kick_R"), ("/0/kick2", "adelaide_kick2_R"), ("/0/kickdir", "adelaide_kickdir_R"), ("/0/kickpos", "adelaide_kickpos_R"), ("/0/gyrkick", "adelaide_gyrkick_R"), ("/0/dir_deriv", "adelaide_dir_reriv_R"), ("/0/direction", "adelaide_direction_R"), ("/0/mov_horiz", "adelaide_mov_horiz_R"), ("/0/pitchrollyaw", "adelaide_pitchrollyaw_R"), ("/0/dir_reriv", "adelaide_dir_reriv_R")} $aurelien_prefix_L := map {("/0/incl_front", "aurelien_incl_front_L"), ("/0/incl_lat", "aurelien_incl_lat_L"), ("/0/still", "aurelien_still_L"), ("/0/intensity2", "aurelien_intensity2_L"), ("/0/acc-intensity", "aurelien_acc-intensity_L"), ("/0/kick", "aurelien_kick_L"), ("/0/kick2", "aurelien_kick2_L"), ("/0/kickdir", "aurelien_kickdir_L"), ("/0/kickpos", "aurelien_kickpos_L"), ("/0/gyrkick", "aurelien_gyrkick_L"), ("/0/dir_deriv", "aurelien_dir_reriv_L"), ("/0/direction", "aurelien_direction_L"), ("/0/mov_horiz", "aurelien_mov_horiz_L"), ("/0/pitchrollyaw", "aurelien_pitchrollyaw_L"), ("/0/dir_reriv", "aurelian_dir_reriv_L")} $aurelien_prefix_R := map {("/0/incl_front", "aurelien_incl_front_R"), ("/0/incl_lat", "aurelien_incl_lat_R"), ("/0/still", "aurelien_still_R"), ("/0/intensity2", "aurelien_intensity2_R"), ("/0/acc-intensity", "aurelien_acc-intensity_R"), ("/0/kick", "aurelien_kick_R"), ("/0/kick2", "aurelien_kick2_R"), ("/0/kickdir", "aurelien_kickdir_R"), ("/0/kickpos", "aurelien_kickpos_R"), ("/0/gyrkick", "aurelien_gyrkick_R"), ("/0/dir_deriv", "aurelien_dir_reriv_R"), ("/0/direction", "aurelien_direction_R"), ("/0/mov_horiz", "aurelien_mov_horiz_R"), ("/0/pitchrollyaw", "aurelien_pitchrollyaw_R"), ("/0/dir_reriv", "aurelian_dir_reriv_R")} // $riot_prefix_1 := map {("/3/intensity2", "intensity2_1"), ("/3/kickpos", "kickpos_1"), ("/3/mov_horiz", "mov_horiz_1"), ("/3/pitchrollyaw", "pitchrollyaw_1"), ("/3/kick", "kick_1"), ("/3/acc-intensity", "acc_1-intensity"), ("/3/incl_front", "incl_front_1"), ("/3/incl_lat", "incl_lat_1"), ("/3/still", "still_1"), ("/3/kickdir", "kickdir_1"), ("/3/direction", "direction_1"), ("/3/gyrkick", "gyrkick_1"), ("/3/dir_reriv", "dir_reriv_1") , ("/3/kick2", "kick2_1"), ("/3/kick", "kick_1")} // $riot_prefix_2 := map {("/4/intensity2", "intensity2_2"), ("/4/kickpos", "kickpos_2"), ("/4/mov_horiz", "mov_horiz_2"), ("/4/pitchrollyaw", "pitchrollyaw_2"), ("/4/kick", "kick_2"), ("/4/acc-intensity", "acc_2-intensity"), ("/4/incl_front", "incl_front_2"), ("/4/incl_lat", "incl_lat_2"), ("/4/still", "still_2"), ("/4/kickdir", "kickdir_2"), ("/4/direction", "direction_2"), ("/4/gyrkick", "gyrkick_2"), ("/4/dir_reriv", "dir_reriv_2") , ("/4/kick2", "kick2_2"), ("/4/kick", "kick_2")} // $riot_prefix_3 := map {("/5/intensity2", "intensity2_3"), ("/5/kickpos", "kickpos_3"), ("/5/mov_horiz", "mov_horiz_3"), ("/5/pitchrollyaw", "pitchrollyaw_3"), ("/5/kick", "kick_3"), ("/5/acc-intensity", "acc_3-intensity"), ("/5/incl_front", "incl_front_3"), ("/5/incl_lat", "incl_lat_3"), ("/5/still", "still_3"), ("/5/kickdir", "kickdir_3"), ("/5/direction", "direction_3"), ("/5/gyrkick", "gyrkick_3"), ("/5/dir_reriv", "dir_reriv_3") , ("/5/kick2", "kick2_3"), ("/5/kick", "kick_3")} // $riot_prefix_4 := map {("/6/intensity2", "intensity2_4"), ("/6/kickpos", "kickpos_4"), ("/6/mov_horiz", "mov_horiz_4"), ("/6/pitchrollyaw", "pitchrollyaw_4"), ("/6/kick", "kick_4"), ("/6/acc-intensity", "acc_4-intensity"), ("/6/incl_front", "incl_front_4"), ("/6/incl_lat", "incl_lat_4"), ("/6/still", "still_4"), ("/6/kickdir", "kickdir_4"), ("/6/direction", "direction_4"), ("/6/gyrkick", "gyrkick_4"), ("/6/dir_reriv", "dir_reriv_4") , ("/6/kick2", "kick2_4"), ("/6/kick", "kick_4")} // $riot_prefix_5 := map {("/7/intensity2", "intensity2_5"), ("/7/kickpos", "kickpos_5"), ("/7/mov_horiz", "mov_horiz_5"), ("/7/pitchrollyaw", "pitchrollyaw_5"), ("/7/kick", "kick_5"), ("/7/acc-intensity", "acc_5-intensity"), ("/7/incl_front", "incl_front_5"), ("/7/incl_lat", "incl_lat_5"), ("/7/still", "still_5"), ("/7/kickdir", "kickdir_5"), ("/7/direction", "direction_5"), ("/7/gyrkick", "gyrkick_5"), ("/7/dir_reriv", "dir_reriv_5") , ("/7/kick2", "kick2_5"), ("/7/kick", "kick_5")} // // $riot_prefix := ["/0/raw", "/1/quat", "/1/euler", "/1/kick", "/1/acc-intensity", "/1/incl_front", "/1/incl_lat", "/1/still", "/1/kickdir", "/1/direction", "/1/gyrkick", "/1/dir_reriv", "/1/kick2"] // $riot_label := ["raw", "quat", "euler", "kick", "acc-intensity", "incl_front", "incl_lat", "still", "kickdir", "direction", "gyrkick", "dir_reriv", "kick2"] ///bruno $bruno_raw := obj::osc_dispatch(8880, "/0/raw", $bruno_prefix_L) $bruno_incl_front_L := obj::osc_dispatch(8880, "/0/incl_front", $bruno_prefix_L) $bruno_incl_lat_L := obj::osc_dispatch(8880, "/0/incl_lat", $bruno_prefix_L) $bruno_mov_L := obj::osc_dispatch(8880, "/0/still", $bruno_prefix_L) $bruno_intensity2_L := obj::osc_dispatch(8880, "/0/intensity2", $bruno_prefix_L) $bruno_acc_intensity_L := obj::osc_dispatch(8880, "/0/acc-intensity", $bruno_prefix_L) $bruno_kick_L := obj::osc_dispatch(8880, "/0/kick", $bruno_prefix_L) $bruno_kick2_L := obj::osc_dispatch(8880, "/0/kick2", $bruno_prefix_L) $bruno_dir_deriv_L := obj::osc_dispatch(8880, "/0/dir_deriv", $bruno_prefix_L) $bruno_kickdir_L := obj::osc_dispatch(8880, "/0/kickdir", $bruno_prefix_L) $bruno_gyrkick_L := obj::osc_dispatch(8880, "/0/gyrkick", $bruno_prefix_L) $bruno_kickpos_L := obj::osc_dispatch(8880, "/0/kickpos", $bruno_prefix_L) $bruno_dir_L := obj::osc_dispatch(8880, "/0/direction", $bruno_prefix_L) $bruno_mov_horiz_L := obj::osc_dispatch(8880, "/0/mov_horiz", $bruno_prefix_L) $bruno_pitchrollyaw_L := obj::osc_dispatch(8880, "/0/pitchrollyaw", $bruno_prefix_L) $bruno_reriv_R := obj::osc_dispatch(8880, "/0/dir_reriv", $bruno_prefix_R) $bruno_incl_front_R := obj::osc_dispatch(8881, "/0/incl_front", $bruno_prefix_R) $bruno_incl_lat_R := obj::osc_dispatch(8881, "/0/incl_lat", $bruno_prefix_R) $bruno_mov_R := obj::osc_dispatch(8881, "/0/still", $bruno_prefix_R) $bruno_intensity2_R := obj::osc_dispatch(8881, "/0/intensity2", $bruno_prefix_R) $bruno_acc_intensity_R := obj::osc_dispatch(8881, "/0/acc-intensity", $bruno_prefix_R) $bruno_kick_R := obj::osc_dispatch(8881, "/0/kick", $bruno_prefix_R) $bruno_kick2_R := obj::osc_dispatch(8881, "/0/kick2", $bruno_prefix_R) $bruno_dir_deriv_R := obj::osc_dispatch(8881, "/0/dir_deriv", $bruno_prefix_R) $bruno_kickdir_R := obj::osc_dispatch(8881, "/0/kickdir", $bruno_prefix_R) $bruno_gyrkick_R := obj::osc_dispatch(8881, "/0/gyrkick", $bruno_prefix_R) $bruno_kickpos_R := obj::osc_dispatch(8881, "/0/kickpos", $bruno_prefix_R) $bruno_dir_R := obj::osc_dispatch(8881, "/0/direction", $bruno_prefix_R) $bruno_mov_horiz_R := obj::osc_dispatch(8881, "/0/mov_horiz", $bruno_prefix_R) $bruno_pitchrollyaw_R := obj::osc_dispatch(8881, "/0/pitchrollyaw", $bruno_prefix_R) $bruno_reriv_R := obj::osc_dispatch(8881, "/0/dir_reriv", $bruno_prefix_R) ///adelaide $adelaide_incl_front_L := obj::osc_dispatch(8882, "/0/incl_front", $adelaide_prefix_L) $adelaide_incl_lat_L := obj::osc_dispatch(8882, "/0/incl_lat", $adelaide_prefix_L) $adelaide_mov_L := obj::osc_dispatch(8882, "/0/still", $adelaide_prefix_L) $adelaide_intensity2_L := obj::osc_dispatch(8882, "/0/intensity2", $adelaide_prefix_L) $adelaide_acc_intensity_L := obj::osc_dispatch(8882, "/0/acc-intensity", $adelaide_prefix_L) $adelaide_kick_L := obj::osc_dispatch(8882, "/0/kick", $adelaide_prefix_L) $adelaide_kick2_L := obj::osc_dispatch(8882, "/0/kick2", $adelaide_prefix_L) $adelaide_dir_deriv_L := obj::osc_dispatch(8882, "/0/dir_deriv", $adelaide_prefix_L) $adelaide_kickdir_L := obj::osc_dispatch(8882, "/0/kickdir", $adelaide_prefix_L) $adelaide_gyrkick_L := obj::osc_dispatch(8882, "/0/gyrkick", $adelaide_prefix_L) $adelaide_kickpos_L := obj::osc_dispatch(8882, "/0/kickpos", $adelaide_prefix_L) $adelaide_dir_L := obj::osc_dispatch(8882, "/0/direction", $adelaide_prefix_L) $adelaide_mov_horiz_L := obj::osc_dispatch(8882, "/0/mov_horiz", $adelaide_prefix_L) $adelaide_pitchrollyaw_L := obj::osc_dispatch(8882, "/0/pitchrollyaw", $adelaide_prefix_L) $adelaide_reriv_L := obj::osc_dispatch(8882, "/0/dir_reriv", $adelaide_prefix_L) $adelaide_incl_front_R := obj::osc_dispatch(8883, "/0/incl_front", $adelaide_prefix_R) $adelaide_incl_lat_R := obj::osc_dispatch(8883, "/0/incl_lat", $adelaide_prefix_R) $adelaide_mov_R := obj::osc_dispatch(8883, "/0/still", $adelaide_prefix_R) $adelaide_intensity2_R := obj::osc_dispatch(8883, "/0/intensity2", $adelaide_prefix_R) $adelaide_acc_intensity_R := obj::osc_dispatch(8883, "/0/acc-intensity", $adelaide_prefix_R) $adelaide_kick_R := obj::osc_dispatch(8883, "/0/kick", $adelaide_prefix_R) $adelaide_kick2_R := obj::osc_dispatch(8883, "/0/kick2", $adelaide_prefix_R) $adelaide_dir_deriv_R := obj::osc_dispatch(8883, "/0/dir_deriv", $adelaide_prefix_R) $adelaide_kickdir_R := obj::osc_dispatch(8883, "/0/kickdir", $adelaide_prefix_R) $adelaide_gyrkick_R := obj::osc_dispatch(8883, "/0/gyrkick", $adelaide_prefix_R) $adelaide_kickpos_R := obj::osc_dispatch(8883, "/0/kickpos", $adelaide_prefix_R) $adelaide_dir_R := obj::osc_dispatch(8883, "/0/direction", $adelaide_prefix_R) $adelaide_mov_horiz_R := obj::osc_dispatch(8883, "/0/mov_horiz", $adelaide_prefix_R) $adelaide_pitchrollyaw_R := obj::osc_dispatch(8883, "/0/pitchrollyaw", $adelaide_prefix_R) $adelaide_reriv_R := obj::osc_dispatch(8883, "/0/dir_reriv", $adelaide_prefix_R) ///aurelien $aurelien_incl_front_L := obj::osc_dispatch(8884, "/0/incl_front", $aurelien_prefix_L) $aurelien_incl_lat_L := obj::osc_dispatch(8884, "/0/incl_lat", $aurelien_prefix_L) $aurelien_mov_L := obj::osc_dispatch(8884, "/0/still", $aurelien_prefix_L) $aurelien_intensity2_L := obj::osc_dispatch(8884, "/0/intensity2", $aurelien_prefix_L) $aurelien_acc_intensity_L := obj::osc_dispatch(8884, "/0/acc-intensity", $aurelien_prefix_L) $aurelien_kick_L := obj::osc_dispatch(8884, "/0/kick", $aurelien_prefix_L) $aurelien_kick2_L := obj::osc_dispatch(8884, "/0/kick2", $aurelien_prefix_L) $aurelien_dir_deriv_L := obj::osc_dispatch(8884, "/0/dir_deriv", $aurelien_prefix_L) $aurelien_kickdir_L := obj::osc_dispatch(8884, "/0/kickdir", $aurelien_prefix_L) $aurelien_gyrkick_L := obj::osc_dispatch(8884, "/0/gyrkick", $aurelien_prefix_L) $aurelien_kickpos_L := obj::osc_dispatch(8884, "/0/kickpos", $aurelien_prefix_L) $aurelien_dir_L := obj::osc_dispatch(8884, "/0/direction", $aurelien_prefix_L) $aurelien_mov_horiz_L := obj::osc_dispatch(8884, "/0/mov_horiz", $aurelien_prefix_L) $aurelien_pitchrollyaw_L := obj::osc_dispatch(8884, "/0/pitchrollyaw", $aurelien_prefix_L) $aurelien_reriv_R := obj::osc_dispatch(8884, "/0/dir_reriv", $aurelien_prefix_L) $aurelien_incl_front_R := obj::osc_dispatch(8885, "/0/incl_front", $aurelien_prefix_R) $aurelien_incl_lat_R := obj::osc_dispatch(8885, "/0/incl_lat", $aurelien_prefix_R) $aurelien_mov_R := obj::osc_dispatch(8885, "/0/still", $aurelien_prefix_R) $aurelien_intensity2_R := obj::osc_dispatch(8885, "/0/intensity2", $aurelien_prefix_R) $aurelien_acc_intensity_R := obj::osc_dispatch(8885, "/0/acc-intensity", $aurelien_prefix_R) $aurelien_kick_R := obj::osc_dispatch(8885, "/0/kick", $aurelien_prefix_R) $aurelien_kick2_R := obj::osc_dispatch(8885, "/0/kick2", $aurelien_prefix_R) $aurelien_dir_deriv_R := obj::osc_dispatch(8885, "/0/dir_deriv", $aurelien_prefix_R) $aurelien_kickdir_R := obj::osc_dispatch(8885, "/0/kickdir", $aurelien_prefix_R) $aurelien_gyrkick_R := obj::osc_dispatch(8885, "/0/gyrkick", $aurelien_prefix_R) $aurelien_kickpos_R := obj::osc_dispatch(8885, "/0/kickpos", $aurelien_prefix_R) $aurelien_dir_R := obj::osc_dispatch(8885, "/0/direction", $aurelien_prefix_R) $aurelien_mov_horiz_R := obj::osc_dispatch(8885, "/0/mov_horiz", $aurelien_prefix_R) $aurelien_pitchrollyaw_R := obj::osc_dispatch(8885, "/0/pitchrollyaw", $aurelien_prefix_R) $aurelien_reriv_R := obj::osc_dispatch(8885, "/0/dir_reriv", $aurelien_prefix_R) /////////////////// MUBU $mubu_descriptors_map := MAP{} $test_map := NIM{0 0, 1 10, 1 0} @proc_def ::mubu2nim($name) { @local $last_val, $nim, $last_date, $index, $inc := 0 $start_rec := false $last_val := [0, 0, 0, 0, 0, 0, 0, 0, 0] $data := $last_val // $last_date := $NOW whenever ($from_mubu==$from_mubu) { // print mubu $from_mubu if ($from_mubu != "dumpdone") { // if ($from_mubu[0]=="index") // { // $index := $from_mubu[1] // } if ($from_mubu[0] != "index") { // print values $from_mubu if($inc==0) { print from_mubu $from_mubu $nim := NIM {0, $from_mubu 0 $from_mubu } $last_val := $from_mubu $inc += 1 } else { $nim.push_back($last_val, 1, $from_mubu) $last_val := $from_mubu $inc += 1 } } } else { print load_to_nim finish // print (""+$nim) $mubu_descriptors_map.add_pair($name, $nim) print min (@min_val($mubu_descriptors_map($name))) print max (@max_val($mubu_descriptors_map($name))) } } } @proc_def ::play_nim($name, $dur) { @local $nim_rec, $min, $max $nim_rec := $mubu_descriptors_map($name) $min := @min_key($nim_rec)[0] $max := @max_key($nim_rec)[0] // print (@size(@range($nim_rec))) group @tempo := 60 { curve slider @Grain := 0.01s, @Action := { from_antes_descp ($mubu_descriptors_map("test1")($x)) // forall $idx in @size($list_gest) // { // // print ($list_gest[$gestes_index_L($idx)]) ($nim_rec($x)[$gestes_index_L($idx)]) // crea_track8 $synth set ($modules[$idx]) ($params[$idx]) @scale($nim_rec($x)[$gestes_index_L($list_gest[$idx])], 0., 1., 0., 100, 1) // } } { $x { {($min)} ($dur) {($max)} } } } $dur print fin_play } whenever($scrub) { print ($mubu_descriptors_map("test1")($scrub)) } whenever($scrub2) { print ($test_map($scrub2)) } // NOTE 60 1 test1 // ::mubu2nim("test1") // to_mubu_dump bang // NOTE 60 1 test1-play // // print (""+$mubu_descriptors_map("test1")) // ::play_nim("test1", 2.84) // NOTE 60 1 test1-date-capteurs // obj::test_osc($euler_4) // obj::test_osc($incli_lateral_4) // obj::test_osc($incli_front_4) // obj::test_osc($pitchrollyaw_4) // obj::test_osc($mov_horiz_4) // obj::test_osc($kickpos_4) // obj::test_osc($intensity2_4) // obj::test_osc($mov_4) // obj::test_osc($kick_4) @proc_def rand_lfo_spat($source, $min, $max, $init_val, $type, $tpo) @abort { //TODO // $sc_struct($group)($module).add_pair($param, $val) // enregistre la dernière valeur dans la main Map } { @local $v1_1, $v2_1, $v1_2, $v2_2, $v1_3, $v2_3, $duree, $current, $curve_proc, $val1, $val2, $val3, $curve_int_proc, $update $v1_1 := $init_val $v2_1 := $init_val $v1_2 := $init_val $v2_2 := $init_val $v1_3 := $init_val $v2_3 := $init_val $curve_int_proc := 0 $delay := @rand(1.) + 0.5 group @tempo := $tpo { Loop $delay @exclusive //@tempo := $tpo { abort $curve_int_proc $v1_1 := $v2_1 $v2_1 := @rand_range($min, $max) // @rand($max-$min)+$min $v1_2 := $v2_2 $v2_2 := @rand_range($min, $max) // @rand($max-$min)+$min $delay := @rand(1.) + 0.5 $duree := $delay $curve_int_proc := { curve // @tempo := $tpo @Grain := 0.005 //0.01s @action := { $update := 1 // print val1 $val1 } { $val1 { {$v1_1} @type := $type $duree {$v2_1} } } curve // @tempo := $tpo @Grain := 0.005 //0.01s { $val2 { {$v1_2} @type := $type $duree {$v2_2} } } } } whenever ($update) { spat ("/source/"+$source+"/xy") $val1 $val2 } } } // MaxMSP Add_Synth @obj_def add_synth_mod2($osc_gest1, $osc_gest2, $cmd, $nim) { @local $onebang := true, $name1, $name2, $freeze_num @init { $osc_gest1.suscribe($THISOBJ) $osc_gest2.suscribe($THISOBJ) $name1 := $osc_gest1.osc_name() $name2 := $osc_gest2.osc_name() print osc_name1 $name1 print osc_name1 $name2 } @proc_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ($name1): // $tracks($track).set($module, ["amp", @clip(@scale($tab, 0.5, 0.8, -30, 0, 1), -30, 3)]) @command($cmd) ($nim(@clip(@scale($tab, 0.5, 0.8, 0, 1, 1), 0, 1))) case ($name2): // $tracks($track).set($module, ["d", @scale($tab, 0.5, 1, 1, 100, 1), "distor", @scale($tab, 0.5, 1, -0.1, 0.5, 1), "shift", @scale($tab, 0.5, 1, 0, -100, 1)]) // "distor", @scale($tab, 0.5, 1, -0.1, 0.5, 1), "shift", @scale($tab, 0.5, 1, 0, -100, 1)] add_disto (@scale($tab, 0.5, 1, -0.1, 0.5, 1)) add_shift (@scale($tab, 0.5, 1, 0, -100, 1)) } } @abort { $osc_gest1.unsuscribe($THISOBJ) $osc_gest2.unsuscribe($THISOBJ) abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } // // SuperCollider @obj_def add_synth_mod($osc_gest1, $osc_gest2, $track, $module) { @local $onebang := true, $name1, $name2, $freeze_num @init { $osc_gest1.suscribe($THISOBJ) $osc_gest2.suscribe($THISOBJ) $name1 := $osc_gest1.osc_name() $name2 := $osc_gest2.osc_name() print osc_name1 $name1 print osc_name1 $name2 } @proc_def new_data($prepend, $tab) { // print $prepend switch ($prepend) { case ($name1): $tracks($track).set($module, ["amp", @clip(@scale($tab, 0.5, 0.8, -30, 0, 1), -30, 3)]) case ($name2): $tracks($track).set($module, ["d", @scale($tab, 0.5, 1, 1, 100, 1), "distor", @scale($tab, 0.5, 1, -0.1, 0.5, 1), "shift", @scale($tab, 0.5, 1, 0, -100, 1)]) } } @abort { $osc_gest1.unsuscribe($THISOBJ) $osc_gest2.unsuscribe($THISOBJ) abort $THISOBJ // _ := $osc_gest.unsuscribe($THISOBJ) } } @obj_def seuils_mov2($synth_name, $seuil, $sounds, $osc_flux, $osc_flux2, $osc_flux3, $osc_flux4, $osc_flux5, $lr, $group) { @local $temp, $last_level, $level, $val, $incli_f, $incli_l, $nim_map_freq, $nim_map_freq_filt, $nim_map_azi, $nim_map_ele, $intensity_all, $last_still, $mov_horiz @init { $val := 0 $temp := -100 $last_level := -6666666 $level := 0 $incli_f := 0 $incli_l := 0 $intensity_all := 0 $mov_horiz := 0 $last_still := -1 $nim_map_freq := NIM { 0 600, 2.6 1000 "exp_out" } $nim_map_freq_filt := NIM { 0 30, 1 6000 "linear" } $nim_map_azi := NIM { 0 -1, 1 1 "linear" } // $nim_map_ele := NIM { 0 0, 1 90 "linear" } _ := $osc_flux.suscribe($THISOBJ) _ := $osc_flux2.suscribe($THISOBJ) _ := $osc_flux3.suscribe($THISOBJ) _ := $osc_flux4.suscribe($THISOBJ) _ := $osc_flux5.suscribe($THISOBJ) // _ := $_synths.add_pair($synth_name, obj::crea_track8s(0, 0, -120, [["SynthBasic1", "freq", 79.597343444824, "fc", 612.08001708984, "rq", 0.40900000929832, "sawwidth", 0, "pos", 0, "width", 3.1229999065399, "amp", 0, "lag", 0], ["TPan2", "pos", 0.5]], $group)) // _ := $_synths.add_pair($synth_name, obj::crea_track8s(0, 0, -120, [["SynthBasic1", "freq", 79.597343444824, "fc", 612.08001708984, "rq", 0.40900000929832, "sawwidth", 0, "pos", 0, "width", 3.1229999065399, "amp", 0, "lag", 0], ["TPan8", "pos", 0.5]], $group)) obj::crea_track8s($synth_name, 0, 0, -120, [["SynthBasic1", "freq", 79.597343444824, "fc", 612.08001708984, "rq", 0.40900000929832, "sawwidth", 0, "pos", 0, "width", 3.1229999065399, "amp", 0, "lag", 0], ["TPan8", "pos", 0.5]], $group) // crea_track8 L_Mov_synth1 0 0 -120 SynthBasic1 freq 79.597343444824 fc 612.08001708984 rq 0.40900000929832 sawwidth 0 pos 0 width 3.1229999065399 amp 0 lag 0 #-> TVbap4 azi 0 ele 0 spr 0 lag 0 buf 176 amp 0 #group group2 // crea_track8 L_Mov_bow1 0 0.01 -120 Bowed_string amp 0 freq 60 #-> TBandPass freq 775.66864013672 rq 1 amp 3.1 xFade 1 #-> TPan8 pos @rand(2) //#fader ($fader("Synth2")) //freq @clip_low((50+@rand_int(100)+@scale($R_y, 0., 1., 1000, 100, 1)), 10) decay @scale($L_R_dist, 0., 1., 0.1, 5, 1) amp @scale($R_z, 0., 1., -15, 20, 1) // crea_track8 L_Mov_bow2 1 0.01 -120 Bowed_string amp 0 freq 40 #-> TBandPass freq 775.66864013672 rq 1 amp 3.1 xFade 1 #-> TPan8 pos @rand(2) //#fader ($fader("Synth2")) } @fun_def new_data($prepend, $tab) { // print prepend $prepend switch ($prepend) { case ($lr+"_incl_front"): $incli_f := $tab case ($lr+"_incl_lat"): $incli_l := $tab case ($lr+"_intensity2"): $intensity_all := $tab[0] case ($lr+"_euler"): // $mov_horiz := (@scale($tab[0], -180., 180., 360., 0., 1.)) $mov_horiz := @scale($tab[0], 0, 1, -2, 2, 1) // $mov_horiz := $tab[0] // print L_mov $mov_horiz // print intensity $intensity case ($lr+"_still"): if($tab[1]==0) { if ($tab[1] != $last_still) { //change dans Max $tracks($synth_name).amp(-120) } } else { $tracks($synth_name).amp($quart_intensity_all($intensity_all)) // crea_track8 R_Mov_synth1 amp ($quart_intensity_all($intensity_all)) $tracks($synth_name).set("SynthBasic1", ["freq", $nim_map_freq($incli_l)]) // crea_track8 R_Mov_synth1 set 00_SynthBasic1 freq ($nim_map_freq($incli_l)) //freq 50, 80. $tracks($synth_name).set("SynthBasic1", ["fc", $nim_map_freq_filt($incli_f)]) $tracks($synth_name).set("TPan8", ["pos", $mov_horiz]) // crea_track8 L_Mov_synth1 amp ($quart_intensity_all($intensity_all)) // crea_track8 L_Mov_synth1 set 00_SynthBasic1 freq ($nim_map_freq($incli_l)) //freq 50, 80. // crea_track8 L_Mov_synth1 set 00_SynthBasic1 fc ($nim_map_freq_filt($incli_f)) // crea_track8 L_Mov_synth1 set 01_TVbap4 azi $mov_horiz // crea_track8 L_Mov_synth1 set 01_TPan2 pos ($nim_map_azi($mov_horiz)) // crea_track8 L_Mov_synth1 set 01_TVbapKubus ele ($nim_map_ele($incli_f)) // crea_track8 L_Mov_synth1 amp ($quart_intensity_all($intensity_all)) // crea_track8 L_Mov_synth1 set 00_SynthBasic1 freq ($nim_map_freq($incli_l)) //freq 50, 80. // crea_track8 L_Mov_synth1 set 00_SynthBasic1 fc ($nim_map_freq_filt($incli_f)) // crea_track8 L_Mov_synth1 set 00_SynthBasic1 pos ($nim_map_pos($mov_horiz)) // print $intensity // print ($quart_intensity_all($intensity_all)) } //($quart_intensity_all($tab[0])) } //ALL $last_still:= $tab[1] // if($tab[1]<0.001) {crea_track8 track95 amp -120} // else { crea_track8 track95 amp ($quart_intensity_x($tab[1])) } // x // if($tab[2]<0.001) {crea_track8 track24 amp -120} // else { crea_track8 track24 amp ($quart_intensity_y($tab[2])) } // y // if($tab[2]<0.001) {crea_track8 track67 amp -120} // else { crea_track8 track67 amp ($quart_intensity_z($tab[3])) } // z } } @abort { print "abort" // _ := $osc_flux.unsuscribe($THISOBJ) // _ := $osc_flux2.unsuscribe($THISOBJ) // _ := $osc_flux3.unsuscribe($THISOBJ) // _ := $osc_flux4.unsuscribe($THISOBJ) // _ := $osc_flux5.unsuscribe($THISOBJ) // // _ := $osc_gest.unsuscribe($THISOBJ) // // crea_track_kubus L_Mov_synth1 off 1 // _ := $_synths($synth_name).off_track(1) } } // // 4 $iana_ev01_map1 := {@map_gest_t3($iana_ev01, $R_incli_lateral, "00_TAddic_20_8", "d", 6, 100)} // _ := $iana_ev01.add_macro($iana_ev01_map1) // // 0.1 $iana_ev01_map2 := {@map_gest_t3($iana_ev01, $R_incli_lateral, "00_TAddic_20_8", "distor", -0.1, 0.1)} // // 0.1 $iana_ev01_map2 := {@map_gest_t3($iana_ev01, $R_incli_lateral, "00_TAddic_20_8", "shift", -20, 40)} // _ := $iana_ev01.add_macro($iana_ev01_map2) // @proc_def ::iana($track, $fade_in, $amp, $dev) // { // @local $actif, $tab_freqs // $actif := 1 // whenever($actif && ($iana == $iana)) // attend pour le tableau analyse // { // addSynth $track TAddic_20_8 $fade_in $iana // addSynth $track set amp $amp // addSynth $track set d $dev // // addSynth $track setn pos @rand_pos(20) //random space position // $actif := 0 // ne recoit plus analyse = onebang // // $iana_freqs := @insert($iana_freqs, $track, @keep($iana, 20)) // insert real time spectral freqs analysis in map // // $iana_amps := @insert($iana_amps, $track, @keep($iana, -20)) // insert real time spectral amps analysis in map // // print $iana_amps // // $tab_freqs := @keep($iana, 20) // } // }