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

Thanks in advance, Mike

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.

Thanks in advance, Mike.

re: Thank you very much for the

I assume by correct size you mean the whole "power of two (+ 1 guard point)" thing? If you load an audio file into an ftable, obviously it is unlikely to be a length that is a power of two. There's three options here that I can think of. The easiest would be to use the tab opcode instead of the table variants. tab does not require a power of two size. But it also doesn't interpolate. If you really want interpolation, you can use the loscil3 opcode. This is an oscillator, though, so the approach is a little different. You would ditch the line thing and instead set the frequency to 1/p6, and to play the whole file without repeating p3 would have to equal p6. (Of course, this is the case with the other examples above.) A third option (which I've never actually done, so I can't completely vouch for it) would be to load the file with a power of two size into second table. To figure out the size, you would use this formula (in Csound speak):

isize pow 2, (int(log(ftlen(p5)/log(2)))+1

And then from there load it into a new table of isize. That's obviously a bit overcomplicated, though.

Having stroked my ego with all that ( ;-p ), I would just go with the tab option.

zpack pharmacy uk z pak viagra online staxyn kamagra uk Canadian pharmacy z-pack avanafil z pack ed pills generic cialis cialis uk buy viagra uk buy zithromax zpak ed drugs cheap generic viagra generic viagra z-pak viagra uk Canadian pharmacy viagra cialis online