Csound Csound-dev Csound-tekno Search About

Frequency resolution

Date1997-05-22 09:32
FromPeter Neubacker
SubjectFrequency resolution
Hello all,

I bumped into a problem concerning the frequency
resolution when dealing with longer wavetables as
looped source: I am using a recorded and looped
sample e.g. of a choir of about 6 seconds length
(ftlen 2**18) and want to change fine tuning over
time. So the phase increment becomes quite small,
and when I let the frequency go down from say
700 cps to 600 cps, I dont get a continuous cps
change, but about 12 steps, which is a frequency
resolution of about 22 cent. I think it is due
to the float precision...

Does anybody know a better solution or workaround?
In the example below I replaced the sample with
a GEN09 table, which has the same properties.

Thank you - Peter Neubaecker


;-------------- restest.orc ------------

sr = 44100
kr = 44100
ksmps = 1
nchnls = 1

instr 1

iocps  =      605.62	; original cps of sample
icps0  =      1 / iocps * 44100 / ftlen(1)

kcps   line   p5, p3, p6      ; p5 = start cps
kcps1  =      kcps * icps0    ; p6 = end cps

asig   oscili p4, kcps1, 1
       out    asig

endin

;-------------- restest.sco ------------

f 1 0 262144 -9 3600 1 0      ; using GEN09
                              ; instead of sample
i 1 0 20 20000 700 600        ; for test purpose

e

Date1997-05-22 22:51
FromEli Brandt
SubjectRe: Frequency resolution
Peter Neubacker wrote:
> So the phase increment becomes quite small,
> and when I let the frequency go down from say
> 700 cps to 600 cps, I dont get a continuous cps
> change, [...]

There's some discussion of this in the archives -- search for "double"
and you'll find a lot of muttering about hacking Csound's internal
precision...  One approach is to do the phase integration analytically
rather than numerically, if this is appropriate for your application.

-- 
     Eli Brandt  |  eli+@cs.cmu.edu  |  http://www.cs.cmu.edu/~eli/