foutir

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

Description

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

Syntax

foutir 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.

The difference between fouti and foutir is that, in the case of fouti, when iflag is set to 1, the duration of the first opcode is undefined (so it is replaced by a dot). Whereas, foutir is defined at the end of note, so the corresponding text line is written only at the end of the current note (in order to recognize its duration). The corresponding file is linked by the ihandle value generated by the fiopen opcode. So fouti and foutir can be used to generate a Csound score while playing a realtime session.

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 foutir opcode. It uses the file foutir.csdand creates a list "foutir.sco". It can be used as a score file.

Example 307. Example of the foutir 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  -+rtmidi=virtual -M0  ;;;realtime audio out and midi in
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o foutir.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
 

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

gihand fiopen "foutir.sco", 0 

instr 1 ; play virtual midi keyboard

inot  notnum  ;just for priting on screen
icps  cpsmidi    
iamp  ampmidi 1

      foutir  gihand, 0, 1, icps, iamp 
      prints  "WRITING:\n"
      prints  "note = %f,velocity = %f\n", icps, iamp  ;prints them
      ficlose gihand
asig  pluck   iamp, icps, 1000, 0, 1
      outs    asig, asig

endin 
</CsInstruments>
<CsScore>
 

f 0 10

e
</CsScore>
</CsoundSynthesizer>


See Also

fiopen, fout, fouti, foutk

Credits

Author: Gabriel Maldonado
Italy
1999

New in Csound version 3.56