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


Returns the sampling-rate of a stored function table.


ftsr(x) (init-rate args only)


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.


Here is an example of the ftsr opcode. It uses the file ftsr.csd, and mary.wav.

Example 300. Example of the ftsr opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o ftsr.wav -W ;;; for file output any platform

; 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


; 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


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


Author: Gabriel Maldonado
October 1998

Example written by Kevin Conder.