an open-source digital signal processing and sound synthesis language
about · links · contact
rtinput - open a sound file or audio device for reading


Synopsis

rtinput("input_source")


Description

Call rtinput to open a sound file, or an audio device, for subsequent reading by real-time instruments.

("Audio device'' just refers to the hardware that handles sound I/O, such as a sound card on a PC or the built-in hardware on a Mac. Different device types may be specified using the set_option scorefile command.)

After rtinput opens 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

"input_source"
A text string with the name of a sound file, in double-quotes, having a header format that RTcmix understands. (These include, but are not limited to, AIFF, AIFC, WAVE, NeXT, and IRCAM.) Only files with data formats of 32-bit floating point or 16-bit or 24-bit integer are readable. NOTE: mp3 and other compressed formats are not supported at present.

If input_source is "AUDIO", then input comes from the audio device. This lets you send input to RTcmix from a microphone or line-level source. The mic/line audio device is selected using the set_option scorefile command. For linux users, there is a utility program called "alsaprobe" in RTcmix/test/alsa that can list the available devices. A similar program exists for OSX users ("coreaudioprobe") in RTcmix/test/coreaudioprobe. For 'full duplex' (i.e. input and output simultaneously) use of RTcmix, OSX users need to create an "aggregate device" using the AudioMIDISetup.app (in /Applications/Utilities) with both in and out capabilities. As an example, this "aggregate device" is selected using set_option as followe:

    set_option("record = on", "device = Aggregate Device:0,0")
    rtsetparams(44100,2)
    rtinput("AUDIO")
    
Note that the set_option command has to precede the rtsetparams command in the scorefile.


Examples

   rtinput("myfile.aif")

Opens "myfile.aif,'' an AIFF file in the current directory, for reading by any instruments that follow this line in the script.

   rtinput("/home/bubba/snd/trouble.wav")

Opens "trouble.wav'' using a full path name.

   rtinput("AUDIO)"

Opens the audio device for reading.


See Also

bus_config, rtsetparams, rtoutput, set_option, DUR, PEAK, SR, filechans, filedur, filepeak, filesr