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 file ftsr.csd, and mary.wav.

Example 177. Example of the ftsr opcode.

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

<CsoundSynthesizer>
<CsOptions>
; 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
</CsOptions>
<CsInstruments>

; 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


</CsInstruments>
<CsScore>

; 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


</CsScore>
</CsoundSynthesizer>


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.