ftsr
Returns the sampling-rate of a stored function table.
Syntax
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.
Examples
Here is an example of the ftsr opcode. It uses the file ftsr.csd.
Example of the ftsr opcode. |
---|
| <CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac ;;;realtime audio out
; For Non-realtime ouput leave only the line below:
; -o ftsr.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
; by Menno Knevel 2022
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
itab = p4
isr = ftsr(itab)
prints "\nsampling-rate of table number %d = %d\n\n", itab, isr
endin
</CsInstruments>
<CsScore>
f 1 0 0 1 "drumsSlp.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 lines 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
Table Control:Table Queries
Credits
Author: Gabriel Maldonado
Italy
October 1998