Csound Csound-dev Csound-tekno Search About

[Csnd] Function tabl point size and sample rate. (beginner question)

Date2009-12-04 10:43
Frommike andrews
Subject[Csnd] Function tabl point size and sample rate. (beginner question)

Hi, 

Would 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



Use Hotmail to send and receive mail from your different email accounts. Find out how.

Date2009-12-04 10:53
FromVictor Lazzarini
Subject[Csnd] Re: Function tabl point size and sample rate. (beginner question)
It seems to me that the division is superfluous here, because you are then multiplying  the index ain by the sr, negating the effect. Removing the division and then multiplication should keep the process as it was.

Generally you would divide ftlen by the sampling rate to get the duration in seconds of a function table. Dividing the sr by the ftlen should give you the number of table-fulls of samples per sec (if that makes any sense). Say your table is 2000 points, at 20KHz sr, it will have 0.1 secs of audio (100 ms); conversely you can say you have 10 table-fulls of samples in one second (sr/ftlen).

Hope this is clear.

Victor

On 4 Dec 2009, at 10:43, mike andrews wrote:

Hi, 
Would 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


Use Hotmail to send and receive mail from your different email accounts. Find out how.


Date2009-12-05 12:35
Frommike andrews
Subject[Csnd] RE: Re: Function tabl point size and sample rate. (beginner question)
Thank you Victor you have been very helpful!

Mike.


From: Victor.Lazzarini@nuim.ie
To: csound@lists.bath.ac.uk
Date: Fri, 4 Dec 2009 10:53:36 +0000
Subject: [Csnd] Re: Function tabl point size and sample rate. (beginner question)

It seems to me that the division is superfluous here, because you are then multiplying  the index ain by the sr, negating the effect. Removing the division and then multiplication should keep the process as it was.

Generally you would divide ftlen by the sampling rate to get the duration in seconds of a function table. Dividing the sr by the ftlen should give you the number of table-fulls of samples per sec (if that makes any sense). Say your table is 2000 points, at 20KHz sr, it will have 0.1 secs of audio (100 ms); conversely you can say you have 10 table-fulls of samples in one second (sr/ftlen).

Hope this is clear.

Victor

On 4 Dec 2009, at 10:43, mike andrews wrote:

Hi, 
Would 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


Use Hotmail to send and receive mail from your different email accounts. Find out how.



New! Receive and respond to mail from other email accounts from within Hotmail Find out how.