fout

fout --  Outputs a-rate signals to an arbitrary number of channels.

Description

fout outputs N a-rate signals to a specified file of N channels.

Syntax

fout ifilename, iformat, aout1 [, aout2, aout3,...,aoutN]

Initialization

ifilename -- the output file's name (in double-quotes).

iformat -- a flag to choose output file format:

Performance

aout1,... aoutN -- signals to be written to the file

fout (file output) writes samples of audio signals to a file with any number of channels. Channel number depends by the number of aoutN variables (i.e. a mono signal with only an a-rate argument, a stereo signal with two a-rate arguments etc.) Maximum number of channels is fixed to 64. Multiple fout opcodes can be present in the same instrument, referring to different files.

Notice that, unlike out, outs and outq, fout does not zero the audio variable so you must zero it after calling it. If polyphony is to be used, you can use vincr and clear opcodes for this task.

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 fout opcode. It uses the files fout.orc and fout.sco.

Example 1. Example of the fout opcode.

/* fout.orc */
/* Written by Kevin Conder */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  iamp = 10000
  icps = 440
  iphs = 0

  ; Create an audio signal.
  asig oscils iamp, icps, iphs

  ; Write the audio signal to a headerless audio file 
  ; called "fout.raw".
  fout "fout.raw", 1, asig
endin
/* fout.orc */
        
/* fout.sco */
/* Written by Kevin Conder */
; Play Instrument #1 for 2 seconds.
i 1 0 2
e
/* fout.sco */
        

See Also

fiopen, fouti, foutir, foutk

Credits

Author: Gabriel Maldonado

Italy

1999

New in Csound version 3.56

October 2002. Added a note from Richard Dobson.