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.

Example 327. 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 
-odac     ;;;realtime audio out 
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too 
; For Non-realtime ouput leave only the line below: 
; -o ftsr.wav -W ;;; for file output any platform 
</CsOptions>
<CsInstruments>
 

sr = 44100 
ksmps = 32 
nchnls = 2 
0dbfs  = 1 

instr 1

itab = p4
isr = ftsr(itab)
prints "sampling-rate of table number %d = %d\n", itab, isr
    
endin
</CsInstruments>
<CsScore>
f 1 0 0 1 "kickroll.wav" 0 0 0	;stereo file
f 2 0 0 1 "ahh.aiff" 0 0 0	;& different formats
f 3 0 0 1 "beats.mp3" 0 0 0
f 4 0 0 1 "beats.ogg" 0 0 0

i 1 0 1 1
i 1 + 1 2
i 1 + 1 3
i 1 + 1 4
e
</CsScore>
</CsoundSynthesizer>


its output should a line like these:

sampling-rate of table number 1 = 44100
sampling-rate of table number 2 = 22050
sampling-rate of table number 3 = 44100
sampling-rate of table number 4 = 44100
      

See Also

ftchnls, ftlen, ftlptim, nsamp

Credits

Author: Gabriel Maldonado
Italy
October 1998