Commit a27fd360 authored by Carlo Laurenzi's avatar Carlo Laurenzi
Browse files

SoundfilerLib update - SoundfilerLibs for Stereo and 4channels soundfiles

parent cd8ef954
; ============================== Auras Libs : SOUNDFILER 4CH ==================================== (29-01-2015)
;
$svpscrub_instance := 0
; Function to use in @find for map that attempts to find the closest key to input $a
@fun_def @iskeymember($a, $key, $value) { $key = $a }
; =========================== Definition of SuperVP.scrub Process ===========================
;
;;; Arguments: $soundfile = soundfile name (string)
;;
;; If the $soundfile is in $SFPivots, then enters synch mode. Otherwise drives SFPLAY~
;; If in synch mode:
;; - If the content of Pivot map is empty then in SuperVP.PLAY mode (synch to tempo)
;; - If the content is not empty then SuperVP.Scrub mode (synch to pivot + resonance)
@proc_def ::soundfile4ch($destination1, $destination2, $destination3, $destination4, $soundfile, $dblevel)
{
;; To see if $soundfile exists in MAP, we should launch a FIND and see if it is undefined using @is_undef
;; This is because regular @member acts on VALUE and not KEY! (I believe we should reverse this!!!)
@local $notfound
$notfound := @is_undef(@find($SFPivots, @iskeymember($soundfile)))
if ($notfound) ; check if soundfile is a member of pivot list
{
; ====== SFPLAY Mode ======
soundfiler.4ch_poly note sfplay ($soundfile) ($destination1) ($destination2) ($destination3) ($destination4) ($dblevel)
}else
{
;;;; Synchronization mode. Determine which:
if (@size($SFPivots($soundfile))=0)
{
; ====== SuperVP-Play Mode ======
;print SVPLAY for ($soundfile) at sec: $NOW beat: $RNOW
soundfiler.4ch_poly note svplay ($soundfile) ($destination1) ($destination2) ($destination3) ($destination4) ($dblevel)
;; now synch speed with tempo
whenever ($RT_TEMPO)
{
svplay_speed ($RT_TEMPO / $SCORE_TEMPO)
}
}else
{
; ====== SuperVP-Scrub Mode with static target(s) ======
@local $pivot, $delay, $this_scrub_instance
$pivot := $SFPivots($soundfile)[2]
$delay := $SFPivots($soundfile)[3]
soundfiler.4ch_poly note svpscrub ($soundfile) ($destination1) ($destination2) ($destination3) ($destination4) ($dblevel)
whenever ($svpscrub_instance)
{
; Now the $svpscrub_instance should be set!
$this_scrub_instance := $svpscrub_instance
print Scrub instance ($this_scrub_instance) for ($soundfile) pivot ($pivot) at sec: $NOW beat: $RNOW
group svp @target{$pivot} ;, @tight
{
curve svp-target @Grain := 0.05s,
@Action :=
{
@command($this_scrub_instance+"-SVPscrub_pos") $x
}
{
$x
{
{ 0.0}
$delay { ($SFPivots($soundfile)[1]) }
}
}
$delay curve svp-absolute @Grain := 0.05s,
@Action :=
{
@command($this_scrub_instance+"-SVPscrub_pos") $x
}
{
$x
{
{ ($SFPivots($soundfile)[1])}
( ($SFPivots($soundfile)[0])-($SFPivots($soundfile)[1]) )ms { ($SFPivots($soundfile)[0]) }
}
}
print ($soundfile) Resonance launch at sec: ($NOW) beat: ($RNOW)
}
}during[1#]
}
}
}
; ============================== Auras Libs : SOUNDFILER STEREO ==================================== (29-01-2015)
;
$svpscrub_instance := 0
; Function to use in @find for map that attempts to find the closest key to input $a
@fun_def @iskeymember($a, $key, $value) { $key = $a }
; =========================== Definition of SuperVP.scrub Process ===========================
;
;;; Arguments: $soundfile = soundfile name (string)
;;
;; If the $soundfile is in $SFPivots, then enters synch mode. Otherwise drives SFPLAY~
;; If in synch mode:
;; - If the content of Pivot map is empty then in SuperVP.PLAY mode (synch to tempo)
;; - If the content is not empty then SuperVP.Scrub mode (synch to pivot + resonance)
@proc_def ::soundfileST($destinationL, $destinationR, $soundfile, $dblevel)
{
;; To see if $soundfile exists in MAP, we should launch a FIND and see if it is undefined using @is_undef
;; This is because regular @member acts on VALUE and not KEY! (I believe we should reverse this!!!)
@local $notfound
$notfound := @is_undef(@find($SFPivots, @iskeymember($soundfile)))
if ($notfound) ; check if soundfile is a member of pivot list
{
; ====== SFPLAY Mode ======
soundfiler.st_poly note sfplay ($soundfile) ($destinationL) ($destinationR) ($dblevel)
}else
{
;;;; Synchronization mode. Determine which:
if (@size($SFPivots($soundfile))=0)
{
; ====== SuperVP-Play Mode ======
;print SVPLAY for ($soundfile) at sec: $NOW beat: $RNOW
soundfiler.st_poly note svplay ($soundfile) ($destinationL) ($destinationR) ($dblevel)
;; now synch speed with tempo
whenever ($RT_TEMPO)
{
svplay_speed ($RT_TEMPO / $SCORE_TEMPO)
}
}else
{
; ====== SuperVP-Scrub Mode with static target(s) ======
@local $pivot, $delay, $this_scrub_instance
$pivot := $SFPivots($soundfile)[2]
$delay := $SFPivots($soundfile)[3]
soundfiler.st_poly note svpscrub ($soundfile) ($destinationL) ($destinationR) ($dblevel)
whenever ($svpscrub_instance)
{
; Now the $svpscrub_instance should be set!
$this_scrub_instance := $svpscrub_instance
print Scrub instance ($this_scrub_instance) for ($soundfile) pivot ($pivot) at sec: $NOW beat: $RNOW
group svp @target{$pivot} ;, @tight
{
curve svp-target @Grain := 0.05s,
@Action :=
{
@command($this_scrub_instance+"-SVPscrub_pos") $x
}
{
$x
{
{ 0.0}
$delay { ($SFPivots($soundfile)[1]) }
}
}
$delay curve svp-absolute @Grain := 0.05s,
@Action :=
{
@command($this_scrub_instance+"-SVPscrub_pos") $x
}
{
$x
{
{ ($SFPivots($soundfile)[1])}
( ($SFPivots($soundfile)[0])-($SFPivots($soundfile)[1]) )ms { ($SFPivots($soundfile)[0]) }
}
}
print ($soundfile) Resonance launch at sec: ($NOW) beat: ($RNOW)
}
}during[1#]
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment