The Alternative Csound Reference Manual
Previous |  | Next

# ftsr

ftsr -- Returns the sampling-rate of a stored function table.

## Description

Returns the sampling-rate of a stored function table.

## Syntax

ftsr(x) (init-rate args only)

## Performance

Returns the sampling-rate of a GEN01 generated table. The sampling-rate is determined from the header of the original file. If the original file has no header or the table was not created by these GEN01, ftsr returns 0. New in Csound version 3.49.

## Examples

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

Example 1. Example of the ftsr opcode.

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

    ; Instrument #1.
    instr 1
      ; Print out the sampling rate of Table #1.
      isr = ftsr(1)
      print isr
    endin
    /* ftsr.orc */

    /* ftsr.sco */
    ; Table #1: Use an audio file.
    f 1 0 262144 1 "mary.wav" 0 0 0

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

Since the audio file "mary.wav" uses a 44.1 Khz sampling rate, its output should a line like this:

    instr 1:  isr = 44100.000

## See Also

ftchnls, ftlen, ftlptim, nsamp

## Credits

Author: Gabriel Maldonado
Italy
October 1998

Example written by Kevin Conder.

Previous | Home | Next
ftsavek | Up | gain