rtoutput

Open a new sound file for writing.


Synopsis

rtoutput(“file_name” [, “header_type” ] [, “data_format” ])

Parameters inside the [brackets] are optional.


Description

Call rtoutput to open a new sound file for subsequent writing by real-time instruments.

After rtoutput creates a sound file, it prints information about the file, such as the header type and sampling rate (unless the print_off scorefile command has been issued).


Arguments

NOTE: The sampling rate and number of channels are specified in a call to rtsetparams at the beginning of the script.

“short” is the default if no data format is given.


NOTES

If you don’t want RTcmix to play while you’re writing a file, use set_option to turn off playing before you invoke rtsetparams, by saying set_option(“audio = off”).

The case of the header_type and data_format arguments is not significant, nor is their order.

All formats are big-endian, except for “wav,” which is always little-endian, and “raw,” which has host byte order.

If you ask for “aiff” and “float” (or “normfloat”), you’ll get “aifc” format instead, because AIFF doesn’t support floating-point files.

Although most soundfile programs now deal with nearly all soundfile types, few of them expect floating-point files to use the unnormalized range of values that RTcmix uses by default (-32768.0–32767.0 and beyond). When writing floating-point files that you want to open in other programs, use the “normfloat” format, where the values are normalized to fit within the -1.0–1.0.

If you want to use them in MiXViews editor, choose the “next” header type. Many programs don’t read AIFC files, maybe because they assume these are always compressed.


Examples

   rtsetparams(22050, 2)
   rtoutput("mysound")

writes a stereo, 16-bit linear AIFF file with 22050 sampling rate.

   rtsetparams(44100, 1)
   set_option("audio = off", "clobber = on")
   rtoutput("myothersound", "wav", "float")

writes a mono, 32-bit floating-point WAV file with 44100 sampling rate. RTcmix will write over any existing file with the same name, and will not play audio while writing.


See Also

bus_config, rtsetparams, rtoutput, set_option