Use Non-Frames Version Previous Page Next Page
GEN Routines: File Access

GEN01

  f#  time  size  1  filcod  skiptime  format  channel

Description

This subroutine transfers data from a soundfile into a function table.

Initialization

size - number of points in the table. Ordinarily a power of 2 or a power-of-2 plus 1 (see f statement); the maximum tablesize is 16777216 (224) points. If the source soundfile is of type AIFF, allocation of table memory can be deferred by setting this parameter to 0; the size allocated is then the number of points in the file (probably not a power-of-2), and the table is not usable by normal oscillators, but it is usable by a loscil unit. An AIFF source can also be mono or stereo.

filcod - integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod ; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the file is sought first in the current directory, then in that given by the environment variable SSDIR (if defined) then by SFDIR. See also soundin.

skiptime - begin reading at skiptime seconds into the file.

channel - channel number to read in. 0 denotes read all channels.

format - specifies the audio data-file format:

  1 - 8-bit signed character    4 - 16-bit short integers 
  2 - 8-bit A-law bytes         5 - 32-bit long integers 
  3 - 8-bit U-law bytes         6 - 32-bit floats

If format = 0 the sample format is taken from the soundfile header, or by default from the CSound -o command flag.

Note

Reading stops at end-of-file or when the table is full. Table locations not filled will contain zeros.

If p4 is positive, the table will be post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.

Examples

  f   1  0  8192  1  23  0  4
  f   2  0  0  -1  "trumpet  A#5"  0  4 

The tables are filled from 2 files, "soundin.23" and "trumpet A#5", expected in SSDIR or SFDIR. The first table is pre-allocated; the second is allocated dynamically, and its rescaling is inhibited.


Use Non-Frames Version Previous Page Next Page
GEN Routines: File Access