Antescofo values can be saved in a file and later loaded. See the functions

  • @savevalue() and @loadvalue()
  • @dump(), @dumpvar() and @loadvar()

in the doc.

The difference between the two famillies of function is that in the former, only a value is saved and restored. In the latter, the values are bind to a variable and the binding is restored with the cal to @loadvar(). Read the doc to understand exactly which variables are restored (they are not necessarily global).

This mechanism an be used to save a preset and to restore it.

One application is to build incrementally e.g. a NIM, to save it, to load it in another run or with another program, and to play it using a curve.


// Building a NIM incrementally. Here, for illustration purposes, we use a loop
// with a randomly disturbed period. But one can 'fill' the NIM on a
// whenever which can watch a variable giving the level of a Max slider (through a setvar). 
// We use a NIM but any Antescofo value ca n be used (tab, map, and any nesting), at the exception
// of functions and processes (they are first-class values but there saving is not supported)

$last := $RNOW
$y := 1

// Tis NIM has only one breakpoint. We will add others breakpoint in the loop
$nim := NIM{ 0 0, (1+@rand(0.5)) $y }

Loop (1 + @rand(0.5))
  // For illustration purposes, we chose an interpolation type randomly
  // between linear and sin_in_out
  $type := (@rand(1.) > 0.5 ? "SINE_IN_OUT" : "LINEAR")

  // The @push_back() function insert breakpoint "at the end"
  // Cf. the doc.
  // The value of the curve is given by the variable $y, but it can be the value
  // of a slider or whatever you wish 
  $dummy := @push_back($nim, $RNOW - $last, $y, $type)

  // This is just to prepare the next breakpoint
  $y := $y + 1
  $last := $RNOW
} during[5#]      // we iterate 5 times

// The nIM is now build. We save it in a file
// You can look in the file : the save is done in the Antescofo readable syntax. 

 $dummy := @savevalue("/tmp/automation.asco.txt", $nim)

10 print OK
    // You can reload the value and do what you want with it. 
    // For instance, you can "oplay" it using a Curve
    $nim2 := @loadvalue("/tmp/automation.asco.txt")

    // Obviously, reloading a value in the same program where it has 
    // been produced, is not very useful. But the file where the value 
    // has been saved persists accross program invocation. 

antescofo/faq/control/preset.txt · Dernière modification: 2015/03/25 01:47 par Jean-Louis Giavitto