Commit d686cfd4 authored by Marco Stroppa's avatar Marco Stroppa
Browse files

Added Traj_reader and Traj_looper, corrected several problems of...

Added Traj_reader and Traj_looper, corrected several problems of synchronisation (two messages at the same logical time)
parent cd9fdd77
......@@ -3,7 +3,7 @@
; Include it with the score files
; ACTIVATE THIS IF THE TEST IS LOADED ALONE
;@INSERT "zInclude/Lib_Stroppa-Spat7.txt"
;@insert_once "zInclude/Lib_Stroppa-Spat8.txt"
;;; Initialize sources: syntax is ::InitSources($NumberOfSources, $NumberOfSpeakers, $prefix_namespace)
; Note that the $prefix_namespace should correpond to what you use in your max/pd patch.
......@@ -35,9 +35,9 @@ $initlevels := map {
; TRIPLE ADJACENT LOUDSPEAKERS
("CtrUp3", [0., .5, .5, .5, 0., 0., 0.]),
("Up123", [.5, .5, .5, .7, .7, 0., 0.]),
("Up123", [.5, .5, .5, .0, .0, 0., 0.]),
("CtrDw3", [0., 0., 0., .5, .5, .5, 0.]),
("Dw123", [0., 0.0, 0., 0., .5, .5, .5]),
("Dw123", [0., 0., 0., 0., .5, .5, .5]),
; QUADRUPLE ADJACENT LOUDSPEAKERS
("CtrUp4", [.4, .4, .4, .4, 0., 0., 0.]),
......@@ -45,7 +45,7 @@ $initlevels := map {
; EVEN/ODD LOUDSPEAKERS
("Odd", [.3, 0., .3, 0., .3, 0., .3]),
("Even", [0., .4, 0., .4, 0., .4, 0.]),
("Even", [0., .4, 0., .4, 0., .4, 0.])
}
......
; 7-POINT TOTEM FOR DONAU 2016
; TESTS OF THE SETUP'S INTERPOLATION SCHEMES
; WHEN USING TRAJ_READER
BPM 60
;@insert_once "zInclude/Lib_Stroppa-Spat8.txt"
@insert "zInclude/Lib_Stroppa-Spat8.txt"
;;; Initialize sources: syntax is ::InitSources($NumberOfSources, $NumberOfSpeakers, $prefix_namespace)
; Note that the $prefix_namespace should correpond to what you use in your max/pd patch.
; It'll be used to construct (e.g.) "src1-spat" receivers automatically for message passing in
::InitSources(10, 7, "src")
;@insert_once "SpatLib-7_Totem_configs.txt"
@insert "SpatLib-7_Totem_configs.txt"
;**********************************************************************
; TEST OF TRAJECTORY READER
$T_001 := [[ 0, "Up3" ], [ 2, "Ctr"], [4, "Dw3"], [6, "Up3"]]
$T_002 := [[ 0, "Up3" ], [ 2, "Ctr"], [4, "Dw3"]]
NOTE C2 4.0 linear
print "TRAJECTORY ACROSS 3 LSP"
print "TEST OF THE INTERPOLATION STRATEGIES"
print "linear"
::Traj_reader (1, $T_001, 4.0, "linear")
print "sine"
NOTE C2 4.0 sine_in
print "sine_in"
::Traj_reader (1, $T_001, 4.0, "sine_in")
NOTE C2 4.0 sine_in_out
print "sine_in_out"
::Traj_reader (1, $T_001, 4.0, "sine_in_out")
NOTE C2 4.0 sine_out
print "sine_out"
::Traj_reader (1, $T_001, 4.0, "sine_out")
print "quad"
NOTE C2 4.0 quad_in
print "quad_in"
::Traj_reader (1, $T_001, 4.0, "quad_in")
NOTE C2 4.0 quad_in_out
print "quad_in_out"
::Traj_reader (1, $T_001, 4.0, "quad_in_out")
NOTE C2 4.0 quad_out
print "quad_out"
::Traj_reader (1, $T_001, 4.0, "quad_out")
print "cubic"
NOTE C2 4.0 cubic_in
print "cubic_in"
::Traj_reader (1, $T_001, 4.0, "cubic_in")
NOTE C2 4.0 cubic_in_out
print "cubic_in_out"
::Traj_reader (1, $T_001, 4.0, "cubic_in_out")
NOTE C2 4.0 cubic_out
print "cubic_out"
::Traj_reader (1, $T_001, 4.0, "cubic_out")
print "circ"
NOTE C2 4.0 circ_in
print "circ_in"
::Traj_reader (1, $T_001, 4.0, "circ_in")
NOTE C2 4.0 circ_in_out
print "circ_in_out"
::Traj_reader (1, $T_001, 4.0, "circ_in_out")
NOTE C2 4.0 circ_out
print "circ_out"
::Traj_reader (1, $T_001, 4.0, "circ_out")
print "quart"
NOTE C2 4.0 quart_in
print "quart_in"
::Traj_reader (1, $T_001, 4.0, "quart_in")
NOTE C2 4.0 quart_in_out
print "quart_in_out"
::Traj_reader (1, $T_001, 4.0, "quart_in_out")
NOTE C2 4.0 quart_out
print "quart_out"
::Traj_reader (1, $T_001, 4.0, "quart_out")
print "quint"
NOTE C2 4.0 quint_in
print "quint_in"
::Traj_reader (1, $T_001, 4.0, "quint_in")
NOTE C2 4.0 quint_in_out
print "quint_in_out"
::Traj_reader (1, $T_001, 4.0, "quint_in_out")
NOTE C2 4.0 quint_out
print "quint_out"
::Traj_reader (1, $T_001, 4.0, "quint_out")
print "exp"
NOTE C2 4.0 exp_in
print "exp_in"
::Traj_reader (1, $T_001, 4.0, "exp_in")
NOTE C2 4.0 exp_in_out
print "exp_in_out"
::Traj_reader (1, $T_001, 4.0, "exp_in_out")
NOTE C2 4.0 exp_out
print "exp_out"
::Traj_reader (1, $T_001, 4.0, "exp_out")
;**********************************************************************
NOTE C2 4.0 linear
print "LEAVING POSITION INCREASINGLY FASTER"
print "linear"
::Traj_reader (1, $T_001, 4.0, "linear")
NOTE C2 4.0 sine_in
print "sine_in"
::Traj_reader (1, $T_001, 4.0, "sine_in")
NOTE C2 4.0 quad_in
print "quad_in"
::Traj_reader (1, $T_001, 4.0, "quad_in")
NOTE C2 4.0 cubic_in
print "cubic_in"
::Traj_reader (1, $T_001, 4.0, "cubic_in")
NOTE C2 4.0 circ_in
print "circ_in"
::Traj_reader (1, $T_001, 4.0, "circ_in")
NOTE C2 4.0 quart_in
print "quart_in"
::Traj_reader (1, $T_001, 4.0, "quart_in")
NOTE C2 4.0 quint_in
print "quint_in"
::Traj_reader (1, $T_001, 4.0, "quint_in")
NOTE C2 4.0 exp_in
print "exp_in"
::Traj_reader (1, $T_001, 4.0, "exp_in")
; this value of dur more or less correponds to the feeling of exp_in
NOTE C2 4.0 Lsp_up_down
print "All the loudspeakers from up to down"
loop Lsp_updw 3.0 @tempo := 30.0
{
@Space(1, "Up3", 0.4)
1.0 @Space(1, "Ctr", 0.4)
1.0 @Space(1, "Dw3", 0.4)
}
NOTE C#2 4.0 Lsp_updw_stop
abort Lsp_updw
@FadeOut(1, 0.1)
;**********************************************************************
NOTE C2 4.0 linear
print "INCREASINGLY FASTER (VERTICAL) CHANGE OF POSITION"
print "linear"
::Traj_reader (1, $T_001, 4.0, "linear")
NOTE C2 4.0 sine_in_out
print "sine_in_out"
::Traj_reader (1, $T_001, 4.0, "sine_in_out")
NOTE C2 4.0 quad_in_out
print "quad_in_out"
::Traj_reader (1, $T_001, 4.0, "quad_in_out")
NOTE C2 4.0 cubic_in_out
print "cubic_in_out"
::Traj_reader (1, $T_001, 4.0, "cubic_in_out")
NOTE C2 4.0 circ_in_out
print "circ_in_out"
::Traj_reader (1, $T_001, 4.0, "circ_in_out")
NOTE C2 4.0 quart_in_out
print "quart_in_out"
::Traj_reader (1, $T_001, 4.0, "quart_in_out")
NOTE C2 4.0 quint_in_out
print "quint_in_out"
::Traj_reader (1, $T_001, 4.0, "quint_in_out")
NOTE C2 4.0 exp_in_out
print "exp_in_out"
::Traj_reader (1, $T_001, 4.0, "exp_in_out")
; this value of dur more or less correponds to the feeling of exp_in_out
NOTE C2 4.0 Lsp_up_down
print "All the loudspeakers from up to down"
loop Lsp_updw 3.0 @tempo := 30.0
{
@Space(1, "Up3", 0.5)
1.0 @Space(1, "Ctr", 0.5)
1.0 @Space(1, "Dw3", 0.5)
}
NOTE C#2 4.0 Lsp_updw_stop
abort Lsp_updw
@FadeOut(1, 0.1)
;**********************************************************************
NOTE C2 4.0 linear
print "LEAVING POSITION INCREASINGLY MORE SLOWLY"
print "linear"
::Traj_reader (1, $T_001, 4.0, "linear")
NOTE C2 4.0 sine_out
print "sine_out"
::Traj_reader (1, $T_001, 4.0, "sine_out")
NOTE C2 4.0 quad_out
print "quad_out"
::Traj_reader (1, $T_001, 4.0, "quad_out")
NOTE C2 4.0 cubic_out
print "cubic_out"
::Traj_reader (1, $T_001, 4.0, "cubic_out")
NOTE C2 4.0 circ_out
print "circ_out"
::Traj_reader (1, $T_001, 4.0, "circ_out")
NOTE C2 4.0 quart_out
print "quart_out"
::Traj_reader (1, $T_001, 4.0, "quart_out")
NOTE C2 4.0 quint_out
print "quint_out"
::Traj_reader (1, $T_001, 4.0, "quint_out")
NOTE C2 4.0 exp_out
print "exp_out"
::Traj_reader (1, $T_001, 4.0, "exp_out")
; this value of dur more or less correponds to the feeling of exp_out
NOTE C2 4.0 Lsp_up_down
print "All the loudspeakers from up to down"
loop Lsp_updw 3.0 @tempo := 30.0 ; match the duration of 6 beats
{
@Space(1, "Up3", 0.7)
1.0 @Space(1, "Ctr", 0.7)
1.0 @Space(1, "Dw3", 0.7)
}
NOTE C#2 4.0 Lsp_updw_stop
abort Lsp_updw
@FadeOut(1, 0.1)
;**********************************************************************
\ No newline at end of file
; 7-POINT TOTEM FOR DONAU 2016
; TESTS OF THE SETUP'S INTERPOLATION SCHEMES
; WHEN USING TRAJ_LOOPER
BPM 60
;@insert_once "zInclude/Lib_Stroppa-Spat8.txt"
@insert "zInclude/Lib_Stroppa-Spat8.txt"
;;; Initialize sources: syntax is ::InitSources($NumberOfSources, $NumberOfSpeakers, $prefix_namespace)
; Note that the $prefix_namespace should correpond to what you use in your max/pd patch.
; It'll be used to construct (e.g.) "src1-spat" receivers automatically for message passing in
::InitSources(10, 7, "src")
;@insert_once "SpatLib-7_Totem_configs.txt"
@insert "SpatLib-7_Totem_configs.txt"
;$curr_itp := "linear"
;$curr_itp := "sine_in"
$curr_itp := "sine_in_out"
;$curr_itp := "sine_out"
;$curr_itp := "quad_in"
;$curr_itp := "quad_in_out"
;$curr_itp := "quad_out"
;$curr_itp := "cubic_in"
;$curr_itp := "cubic_in_out"
;$curr_itp := "cubic_out"
;$curr_itp := "circ_in"
;$curr_itp := "circ_in_out"
;$curr_itp := "circ_out"
;$curr_itp := "quart_in"
;$curr_itp := "quart_in_out"
;$curr_itp := "quart_out"
;$curr_itp := "quint_in"
;$curr_itp := "quint_in_out"
;$curr_itp := "quint_out"
;$curr_itp := "exp_in"
;$curr_itp := "exp_in_out"
;$curr_itp := "exp_out"
;**********************************************************************
; TEST OF TRAJECTORY LOOPER: INTERPOLATION IS SINE_IN_OUT
$T_001 := [[ 0, "Up3" ], [ 2, "Ctr"], [4, "Dw3"], [6, "Up3"]]
$T_002 := [[ 0, "Up3" ], [ 2, "Ctr"], [4, "Dw3"]]
NOTE C2 4.0 loop4
print "Starting loop across 3 Lsp, dur = 4.0, period = 4.0, should click"
$x_loop := ::Traj_looper (1, $T_002, 4.0, $curr_itp, 4.0)
NOTE C2 1.0
print "Aborting loop"
abort $x_loop
NOTE C2 4.0 loop5
print "Starting loop across 3 Lsp, period = 6.0, dur = 4.0"
$x_loop := ::Traj_looper (1, $T_002, 4.0, $curr_itp, 6.0)
NOTE C2 1.0
print "Aborting loop"
abort $x_loop
NOTE C2 4.0 loop55
print "Starting loop across 3 Lsp, period = 5.0, dur = 5.0, should also click"
$x_loop := ::Traj_looper (1, $T_002, 5.0, $curr_itp, 5.0)
NOTE C2 1.0
print "Aborting loop"
abort $x_loop
;-----------------------------------------------------------------------
NOTE C2 4.0 loopfast
print "Starting loop across 3 Lsp, dur = 0.2, period = 0.3, very fast!"
$x_loop := ::Traj_looper (1, $T_002, 0.2, $curr_itp, 0.3)
NOTE C2 1.0
print "Aborting loop"
abort $x_loop
;**********************************************************************
......@@ -3,15 +3,20 @@
BPM 60
@INSERT "zInclude/Lib_Stroppa-Spat7.txt"
@INSERT "SpatLib-7_Totem_configs.txt"
@insert_once "zInclude/Lib_Stroppa-Spat8.txt"
;@insert "zInclude/Lib_Stroppa-Spat8.txt"
;;; Initialize sources: syntax is ::InitSources($NumberOfSources, $NumberOfSpeakers, $prefix_namespace)
; Note that the $prefix_namespace should correpond to what you use in your max/pd patch.
; It'll be used to construct (e.g.) "src1-spat" receivers automatically for message passing in
::InitSources(10, 7, "src")
@insert_once "SpatLib-7_Totem_configs.txt"
;@insert "SpatLib-7_Totem_configs.txt"
;**********************************************************************
; BALANCE OF INDIVIDUAL LOUDSPEAKERS
; SEND A NOISE FROM MAX
......@@ -21,13 +26,13 @@ print "BALANCE OF INDIVIDUAL LOUDSPEAKERS"
print "All the loudspeakers from up to down"
loop Lsp_updw 7.0 @tempo := 90.0
{
@Space(1, "Up3", 0.5)
1.0 @Space(1, "Up2", 0.5)
1.0 @Space(1, "Up1", 0.5)
1.0 @Space(1, "Ctr", 0.5)
1.0 @Space(1, "Dw1", 0.5)
1.0 @Space(1, "Dw2", 0.5)
1.0 @Space(1, "Dw3", 0.5)
@Space(1, "Up3", 1.0)
1.0 @Space(1, "Up2", 1.0)
1.0 @Space(1, "Up1", 1.0)
1.0 @Space(1, "Ctr", 1.0)
1.0 @Space(1, "Dw1", 1.0)
1.0 @Space(1, "Dw2", 1.0)
1.0 @Space(1, "Dw3", 1.0)
}
NOTE C#2 4.0 Lsp_updw_stop
......@@ -40,12 +45,12 @@ print "BALANCE OF DOUBLE LOUDSPEAKERS"
print "All the loudspeakers from up to down by 2 adjacent ones"
loop Lsp_updw_2 6.0 @tempo := 90.0
{
@Space(1, "Up23", 0.5)
1.0 @Space(1, "Up12", 0.5)
1.0 @Space(1, "CtrUp", 0.5)
1.0 @Space(1, "CtrDw", 0.5)
1.0 @Space(1, "Dw12", 0.5)
1.0 @Space(1, "Dw23", 0.5)
@Space(1, "Up23", 1.0)
1.0 @Space(1, "Up12", 1.0)
1.0 @Space(1, "CtrUp", 1.0)
1.0 @Space(1, "CtrDw", 1.0)
1.0 @Space(1, "Dw12", 1.0)
1.0 @Space(1, "Dw23", 1.0)
}
NOTE C#2 4.0 Lsp_updw_2_stop
......@@ -59,11 +64,11 @@ print "BALANCE OF TRIPLE LOUDSPEAKERS"
print "All the loudspeakers from up to down by 3 adjacent ones"
loop Lsp_updw_3 5.0 @tempo := 90.0
{
@Space(1, "Up23", 0.5)
1.0 @Space(1, "Up123", 0.5)
1.0 @Space(1, "CtrUp3", 0.5)
1.0 @Space(1, "CtrDw3", 0.5)
1.0 @Space(1, "Dw123", 0.5)
@Space(1, "Up23", 1.0)
1.0 @Space(1, "Up123", 1.0)
1.0 @Space(1, "CtrUp3", 1.0)
1.0 @Space(1, "CtrDw3", 1.0)
1.0 @Space(1, "Dw123", 1.0)
}
NOTE Eb2 4.0 Lsp_updw_3_stop
......@@ -77,8 +82,8 @@ print "BALANCE OF QUADRUPLE LOUDSPEAKERS"
print "All the loudspeakers from up to down by 4 adjacent ones"
loop Lsp_updw_4 2.0 @tempo := 90.0
{
@Space(1, "CtrUp4", 0.5)
1.0 @Space(1, "CtrDw4", 0.5)
@Space(1, "CtrUp4", 1.0)
1.0 @Space(1, "CtrDw4", 1.0)
}
NOTE F#2 4.0 Lsp_updw_4_stop
......@@ -92,8 +97,8 @@ print "BALANCE OF ODD VS. EVEN LOUDSPEAKERS"
print "All the odd vs. even loudspeakers"
loop Lsp_oddeven 2.0 @tempo := 90.0
{
@Space(1, "Odd", 0.5)
1.0 @Space(1, "Even", 0.5)
@Space(1, "Odd", 1.0)
1.0 @Space(1, "Even", 1.0)
}
NOTE F#2 4.0 Lsp_oddeven_stop
......@@ -101,6 +106,29 @@ abort Lsp_oddeven
@FadeOut(1, 0.1)
;**********************************************************************
; TEST OF DIFFERENT KINDS OF INTERPOLATION
; SEND A NOISE FROM MAX
; All the loudspeakers from up [1] to down [7]
NOTE C4 4.0 Linear
print "ALL LOUDSPEAKERS"
print "Linear Interpolation"
loop Linear 7.0 @tempo := 90.0
{
@Space_i(1, "Up3", 1.0, "linear")
1.0 @Space_i(1, "Up2", 1.0, "linear")
1.0 @Space_i(1, "Up1", 1.0, "linear")
1.0 @Space_i(1, "Ctr", 1.0, "linear")
1.0 @Space_i(1, "Dw1", 1.0, "linear")
1.0 @Space_i(1, "Dw2", 1.0, "linear")
1.0 @Space_i(1, "Dw3", 1.0, "linear")
}
NOTE C#4 4.0 Linear
abort Linear
@FadeOut(1, 0.1)
;**********************************************************************
;;; A RandomSpace method is defined in the source Object!
; Use without moderation and see its documentation in Lib
......@@ -127,7 +155,6 @@ abort ($source[1])
;----------------------------------------------------------------------
@FadeOut(1,0.1)
@FadeOut(2,0.1)
;**********************************************************************
......
; SPATIAL LIBRARY FOR STROPPA ANTESCOFO/MAX LIBRARIES
; Last update: 25/02/2016
; Last update: 26/02/2016
/* NOTES:
This library uses an Antescofo map called $initlevels that contains destinations (as key strings)
and their coordinates (as value tables).
It should be defined by user.
It should be defined by the user.
Definition example:
$initlevels := map {
......@@ -43,12 +43,12 @@ if (@is_undef($source))
$source := [0.0 | (10)]
}
; SOURCE Object Definition
; SOURCE Object Definition
@obj_def source($idn, $npoints, $namespace)
{
; Create local variables that are specific to each instance of the object
@local $coordinates, $idnum, $last_action, $prefix_namespace
@local $coordinates, $idnum, $last_action, $prefix_namespace, $last_igoto
;@local $coordinates ; This is where we store local coordinates of this source.
; This is always a variable table whose length is equal to # of speakers
;@local $idnum ; ID Number of the receiver in patch
......@@ -61,6 +61,9 @@ if (@is_undef($source))
$idnum := $idn
$coordinates := [0.0 | ($npoints)] ; create a table of zeros
$prefix_namespace := $namespace
; last_igoto: initialize memory of the pointer to the last curve run by igoto
; (to avoid superposing points at the same logical time)
$last_igoto := 0
}
;; A broadcasted signal to all instances of source objects. Useful in panics!
......@@ -71,41 +74,58 @@ if (@is_undef($source))
}
;; Defining an abort will do additional actions when this object is aborted/killed.
; Useful for specific temrinal operations.
; Useful for specific terminal operations.
@abort
{
print "Source " ($idnum) " is killed!"
abort $last_action
}
;;;;;;;; User defined methods
;; goto method will create a curve that goes from $coordinates to $destination in $dur time
;;;;;;;; USER-DEFINED METHODS
;; SPACE_JUMP: immediately go to $destination and save the position that was reached
@proc_def space_jump($destination)
{
$coordinates := ($initlevels($destination))
@command($prefix_namespace+$idnum+"-spat") ($initlevels($destination))
}
;; GOTO: create a curve that goes from $coordinates to $destination in $dur time
;; this method uses a default interpolation (sine_in_out)
;; use IGOTO if you want to choose another interpolation method
@proc_def goto($destination, $dur)
{
THISOBJ.igoto ($destination, $dur, "sine_in_out")
_ := $THISOBJ.igoto( $destination, $dur, "sine_in_out" )
}
;; igoto method: same as goto, but with the possibility to specify the kind of interpolation
;; IGOTO method: same as goto, but with the possibility to specify a type of interpolation
@proc_def igoto($destination, $dur, $itp)
{
curve FlyingEngine @Grain := 0.05s,
@Action :=
{
$coordinates := $x ; store in internal/local coordinates of this source to keep track
@command($prefix_namespace+$idnum+"-spat") ($x)
}
{
$x
; print debut FlyingEngine $NOW for $dur seconds
; make sure that, if a previous curve was running, it is killed before the new one starts.
abort $last_igoto
$last_igoto := {
curve FlyingEngine
@Grain := 0.05s,
@Action :=
{
$coordinates := $x ; store in internal/local coordinates of this source to keep track
@command($prefix_namespace+$idnum+"-spat") ($x)
}
{
{ ($coordinates) } @type "sine_in_out"
$dur { ($initlevels($destination)) } @type $itp
$x
{
{ ($coordinates) } @type "sine_in_out"
; to avoid the superposition of the last point of a previously running curve, with the first point
; of the current curve, arrive a little earlier at the end of the curve
($dur - 0.01) { ($initlevels($destination)) } @type $itp
}
}
}
$dur ;print end FlyingEngine $NOW
}