ftlen
Prev | Orchestra Opcodes and Operators | Next

## ftlen

ftlen — Returns the size of a stored function table.

## Description

Returns the size of a stored function table.

## Syntax

    ftlen(x) (init-rate args only)

## Performance

Returns the size (number of points, excluding guard point) of stored function table, number x. While most units referencing a stored table will automatically take its size into account (so tables can be of arbitrary length), this function reports the actual size if that is needed. Note that ftlen will always return a power-of-2 value, i.e. the function table guard point (see f Statement) is not included.As of Csound version 3.53, ftlen works with deferred function tables (see GEN01).

## Examples

Here is an example of the ftlen opcode. It uses the files ftlen.orc, ftlen.sco, and mary.wav.

Example 164. Example of the ftlen opcode.

    /* ftlen.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Print out the size of Table #1.
      ; The size will be the number of points excluding the guard point.
      ilen = ftlen(1)
      print ilen
    endin
    /* ftlen.orc */

    /* ftlen.sco */
    ; Table #1: Use an audio file, Csound will determine its size.
    f 1 0 0 1 "mary.wav" 0 0 0

    ; Play Instrument #1 for 1 second.
    i 1 0 1
    e
    /* ftlen.sco */

The audio file “mary.wav” is 154390 samples long. The ftlen opcode reports it as 154389 samples long because it reserves 1 point for the guard point. Its output should include a line like this:

    instr 1:  ilen = 154389.000

## See Also

ftchnls, ftlptim, ftsr, nsamp

## Credits

Author: Barry L. Vercoe
MIT
Cambridge, Massachussetts
1997

Example written by Kevin Conder.

Prev | Up | Next
ftgentmp | Home | ftload