fouti

fouti — Outputs i-rate signals of an arbitrary number of channels to a specified file.

Description

fouti output N i-rate signals to a specified file of N channels.

Syntax

fouti ihandle, iformat, iflag, iout1 [, iout2, iout3,....,ioutN]

Initialization

ihandle -- a number which specifies this file.

iformat -- a flag to choose output file format:

  • 0 - floating point in text format

  • 1 - 32-bit floating point in binary format

iflag -- choose the mode of writing to the ASCII file (valid only in ASCII mode; in binary mode iflag has no meaning, but it must be present anyway). iflag can be a value chosen among the following:

  • 0 - line of text without instrument prefix

  • 1 - line of text with instrument prefix (see below)

  • 2 - reset the time of instrument prefixes to zero (to be used only in some particular cases. See below)

iout,..., ioutN -- values to be written to the file

Performance

fouti and foutir write i-rate values to a file. The main use of these opcodes is to generate a score file during a realtime session. For this purpose, the user should set iformat to 0 (text file output) and iflag to 1, which enable the output of a prefix consisting of the strings inum, actiontime, and duration, before the values of iout1...ioutN arguments. The arguments in the prefix refer to instrument number, action time and duration of current note.

Notice that fout and foutk can use either a string containing a file pathname, or a handle-number generated by fiopen. Whereas, with fouti and foutir, the target file can be only specified by means of a handle-number.

Examples

Here is an example of the fouti opcode. It uses the file fouti.csd.

Example 375. Example of the fouti opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer> 
<CsOptions> 
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o fouti.wav -W ;;; for file output any platform
</CsOptions> 
<CsInstruments> 

sr = 44100 
ksmps = 32 
nchnls = 2 
0dbfs  = 1 

gihand fiopen "test.txt", 0 

instr 1

ires  random  0, 10 
      fouti gihand, 0, 1, ires 
      ficlose gihand

endin 
</CsInstruments> 
<CsScore> 

i 1 0 1 

e
</CsScore> 
</CsoundSynthesizer> 


See also

File Input and Output

Credits

Author: Gabriel Maldonado
Italy
1999

New in Csound version 3.56