# Function table point size and sample rate question.

Hi, could someone please explain to me or point me towards documentation explaining the relationship (or differences) between sample rate and function table point size? I ask as I can not figure out why in the line of code below the sample rate (sr) is divided by the ftlen to calculate the duration of the line that acts as an index for the tablei opcode.

instr 1

ilength = sr/ftlen (p5) ; p5 is ftable number

ain line 0, ilength, ilength * p6 ; p6 = transposition/playback speed

a1 tablei ain * sr, p5

out a1

endin

### re: Function table point size and sample rate question.

To tell you the truth, that example doesn't make much sense to me. Maybe it makes sense in the context of it's orchestra, but as a simple sample playback instrument it's a little weird.

Sample rates are given in samples per second. If the ftable has audio data in it, or at least is being played back as audio, then the points in the table correspond to samples in digital audio. So, to determine the length in seconds, one would divide the ftable by sr, not the way cited in your example.

As an example, say sr = 44100. If the ftable is two seconds long, then it should be 88200 samples. If done as in the example, it would come out to 44100/88200=.5 seconds. Obviously, that's kind of wrong. And since this value is used as line's idur, it means the sample will almost always be cutoff before completing.

This would make more sense to me (again, assuming it's just supposed to be a simple sampler):

instr 1

ilength = ftlen(p5)
idur = ilength/sr

aidx line 0, idur * p6, ilength
a1 tablei aidx, p5

out a1
endin

### Thank you very much for the

Thank you very much for the reply. Your example does make clearer sense to me. I have one question however. I have been using the print function to display the result of idur. If I am correct the result should be the length of the audiofile stored in the function table? However the printed result will only display the correct length of the source audio file if the table point size of GEN01 is correct. How do I calculate an appropriate number for his table point size? It seems that setting this to 0 and using the deferred setting is not an option with tablei.