< Back to IRCAM Forum

Output into a file


I can’t find an entry regarding output into a file (cf. section 4.5 in the reference document of April 26, 2016) in the online documentation at http://antescofo-doc.ircam.fr. Does this mean that the feature has been dropped in the recent version of Antescofo? It is useful for saving data structures to be reloaded for a future performance, e.g. during rehearsals.

Hello Kyl.
Output in a file is a feature still present, look at :

Also take a look at the following list of functions meant to provide data exchange in various format :

Ah, thank you, JL. That’s good. I should have used the Search field. The Manual Index (http://antescofo-doc.ircam.fr/Reference/) is not (yet?) really complete. The Function Index (http://antescofo-doc.ircam.fr/Library/Functions/00intro/) seems to be comprehensive instead.

Another question in this context: Is there some kind of finalizer hook which is called when Antescofo is about to stop? It would be handy for writing out variables to be saved (which could be reloaded when a rehearsal is continued). One could also create a finalizer flow using the setvar interface:

  1. When about to stop the follower, send a setvar finalize true to Antescofo from the Max patch.
  2. This changes the state of the finalize variable in Antescofo, what in turn invokes a whenever watching the variable. In the body of the whenever, if finalize is true, perform the extra housekeeping, e.g. save some variables to a file.
  3. The stop message is sent to the Antescofo object in the Max patch.
  4. Antescofo actually stops following and scheduling.

Is this a reasonable approach? Would one have to wait a given time between the setvar message in step 1 and the stop message in step 3 or even send a signal back to the Max patch that the Antescofo score is ready to stop? What would you recommend?

The Manual Index (http://antescofo-doc.ircam.fr/Reference/) is not (yet?) really complete.

The index is indeed manual, so there will be always things that are missing. However, do not hesitate to send us the links (word and corresponding pages) and we will include them in the index.

The function index is done in a semi-automatic way, and its classification is useful.

The approach you outline to implement a hook when antescofo stops, is a good one. Notice that you can issue an antescofo::stop from within an antescofo program. So, step 3 can be conveniently replaced by issuing a stop command at the end of the whenever body.

The hint to the internal antescofo::stop is very valuable. Thank you!

Bonjour, I have a further question regarding this topic: Is it possible to avoid Antescofo complaining that it doesn’t find the file? I wrote code to save and reload a variable, including fallback code if the file doesn’t exist, and it works fine. Only, Antescofo considers it an error if the file could not be loaded, reporting that in alarming red. This is a little irritating, though not a real problem, but I’d prefer to have just a warning in yellow, less alerting. Could I improve my code to achieve this?

   @MACRO_DEF AU0BUFPTR_SAVE_PATH { "/tmp/au0bufptr.saved" }
   @MACRO_DEF AU0_initPointers($startlabel) {
    	group AU0_initPointers {
    		@local $ret, $is_undef
     		let $ret := @loadvar(@AU0BUFPTR_SAVE_PATH)
     		let $is_undef := @is_undef($au0bufptr)
     		if ($is_undef || $au0bufptr = false) {
    			print AU0_initPointers: Create new empty map au0bufptr
    			let $au0bufptr := map{("AU0", 0)}
    		// [...]


($au0bufptr is the name of the variable stored.)

Hello Kyl.

You can check the content of a directory with @directory_read and look if the file exists or not. For instance,


will return a map with an entry for each file. So you can check if the file /tmp/au0bufptr.saved exists by looking if the entry "au0bufptr.saved" is defined in the map with @is_defined


Thank you, JL, this way it works like a charm!