New opcode: sndload

(note: there is also another new opcode for which the manual will be
posted later. It is possible that these opcodes will be changed until
the 5.03 release)

        sndload Sfname[, ifmt[, ichns[, isr[, ibas[, iamp[, istrt  
                [, ilpmod[, ilps[, ilpe]]]]]]]]]

DESCRIPTION
———–

sndload loads a sound file into memory for use by loscilx.

INITIALIZATION
————–

Sfname – file name as a string constant or variable, string p-field, or
    a number that is used either as an index to strings set with strset,
    or, if that is not available, a fine name in the format soundin.n is
    used. If the file name does not include a full path, the file is
    searched in the current directory first, then those specified by
    SSDIR (if defined), and finally SFDIR. If the same file was already
    loaded previously, it will not be read again, but the parameters
    ibas, iamp, istrt, ilpmod, ilps, and ilpe are still updated.

ifmt (optional, defaults to zero) – default sample format for raw
    (headerless) sound files; if the file has a header, this is
    ignored. Can be one of the following:

      -1: do not allow headerless files (fail with an init error)
       0: use the same format as the one specified on the command line
       1: 8 bit signed integers
       2: a-law
       3: u-law
       4: 16 bit signed integers
       5: 32 bit signed integers
       6: 32 bit floats
       7: 8 bit unsigned integers
       8: 24 bit signed integers
       9: 64 bit floats

ichns (optional, defaults to zero) – default number of channels for raw
    (headerless) sound files; if the file has a header, this is
    ignored. Zero or negative values are interpreted as 1 channel.

isr (optional, defaults to zero) – default sample rate for raw
    (headerless) sound files; if the file has a header, this is
    ignored. Zero or negative values are interpreted as the orchestra
    sample rate (sr).

ibas (optional, defaults to zero) – base frequency in Hz. If positive,
    overrides the value specified in the sound file header; otherwise,
    the value from the header is used if present, and 1.0 if the file
    does not include such information.

iamp (optional, defaults to zero) – amplitude scale. If non-zero,
    overrides the value specified in the sound file header (note:
    negative values are allowed, and will invert the sound output);
    otherwise, the value from the header is used if present, and 1.0 if
    the file does not include such information.

istrt (optional, defaults to -1) – starting position in sample frames,
    can be fractional. If non-negative, overrides the value specified
    in the sound file header; otherwise, the value from the header is
    used if present, and 0 if the file does not include such
    information. Note: even if this parameter is specified, the whole
    file is still read into memory.

ilpmod (optional, defaults to -1) – loop mode, can be one of the
    following:

      any negative value: use the loop information specified in the
          sound file header, ignoring ilps and ilpe
      0: no looping (ilps and ilpe are ignored)
      1: forward looping (wrap around loop end if it is crossed in
         forward direction, and wrap around loop start if it is
         crossed in backward direction)
      2: backward looping (change direction at loop end if it is
         crossed in forward direction, and wrap around loop start if it
         is crossed in backward direction)
      3: forward-backward looping (change direction at both loop points
         if they are crossed as described above)

ilps (optional, defaults to 0) – loop start in sample frames
    (fractional values are allowed), or loop end if ilps is greater
    than ilpe. Ignored unless ilpmod is set to 1, 2, or 3. If the loop
    points are equal, the whole sample is looped.

ilpe (optional, defaults to 0) – loop end in sample frames (fractional
    values are allowed), or loop start if ilps is greater than ilpe.
    Ignored unless ilpmod is set to 1, 2, or 3. If the loop points are
    equal, the whole sample is looped.

Leave a Comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.