Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: roundoff errors in cpspch?

Date2009-08-02 00:03
From"Partev Barr Sarkissian"
Subject[Csnd] Re: Re: Re: roundoff errors in cpspch?
For microtonal composing rounding errors would be a problem.
Which column is more accurate pitch/frequency wise? Can you
get away with using the 2^(n/12) only and losing the 
ib = cpspch(ipch)?

-Partev


============================================================


--- jh@joachimheintz.de wrote:

From: joachim heintz 
To: csound@lists.bath.ac.uk
Subject: [Csnd] Re: Re: roundoff errors in cpspch?
Date: Fri, 31 Jul 2009 09:18:49 +0200

Oh yes, thanks. I didn't see this note. Best -
	joachim



Am 30.07.2009 um 22:43 schrieb Alan Peter Fitch:

> joachim heintz wrote:
>> As I am working about some microtonal calculations, I came across to
>> some results of the cpspch opcode. Starting from a = 880 Hz, the  
>> first
>> column is calculated by multiplying with 2^(1/12), 2^(2/12) etc, the
>> second column by cpspch(9.10), cps(9.11) etc:
>>
>> 2^(n/12)		cpspch
>> 932.327576		932.274902
>> 987.766602		987.738770
>> 1046.502197		1046.502197
>> 1108.730591		1108.667969
>> 1174.659058		1174.625977
>> 1244.507935		1244.402588
>> 1318.510254		1318.435913
>> 1396.912964		1396.873413
>> 1479.977661		1479.977661
>> 1567.981689		1567.893311
>>
>> The results in the left column are totally in concordance with the
>> tables which I found in books and also with Appendix A in the Manual.
>> But where come the values in the right column?
>>
>> Best -
>>
>> 	joachim
>>
>>
>> 
>> 
>> 
>> 
>> gipch ftgen 1, 0, -11, -2, 9.10, 9.11, 10, 10.01, 10.02, 10.03,  
>> 10.04,
>> 10.05, 10.06, 10.07, 10.08
>> instr 1
>> istartcps = 880
>> istep = 1
>> loop:
>> ia = istartcps * 2 ^ (istep/12)
>> ipch tab_i istep-1, 1
>> ib = cpspch(ipch)
>> prints "%f	%f%n", ia, ib
>> loop_lt istep, 1, 11, loop
>> endin
>> 
>> 
>> i 1 0 .1
>> 
>> 
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
>> "unsubscribe csound"
>>
>
> Is this note from the manual the answer to your question?
>
> "[Note]   	Note
>
> The conversion from pch, oct, or midinn into cps is not a linear
> operation but involves an exponential process that could be
> time-consuming when executed repeatedly. Csound now uses a built-in
> table lookup to do this efficiently, even at audio rates. Because the
> table index is truncated without interpolation, pitch resolution when
> using one of these opcodes is limited to 8192 discrete and equal
> divisions of the octave, and some pitches of the standard 12-tone
> equally-tempered scale are very slightly mistuned (by at most 0.15  
> cents). "
>
> regards
> Alan
>
> -- 
> Alan Fitch
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




_____________________________________________________________
Netscape.  Just the Net You Need.

Date2009-08-02 11:32
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Re: Re: Re: roundoff errors in cpspch?
cpsxpch dies not use any table but calculates direct, as does cps2pch


> For microtonal composing rounding errors would be a problem.
> Which column is more accurate pitch/frequency wise? Can you
> get away with using the 2^(n/12) only and losing the
> ib = cpspch(ipch)?

==John ff


Date2009-08-02 19:30
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: Re: Re: roundoff errors in cpspch?
Indeed cps2pch gives correcter results than cpspch, though still with  
some funny deviations (why does cps2pch not give a clear 880 and 1760  
for the "a"?):

note	2^(n/12)		cps2pch		cpspch
a	880.000000		880.000916		880.000000
bb	932.327576		932.329712		932.274902
b	987.766602		987.764832		987.738770
c	1046.502197		1046.502441		1046.502197
c#	1108.730591		1108.732178		1108.667969
d	1174.659058		1174.662354		1174.625977
d#	1244.507935		1244.506226		1244.402588
e	1318.510254		1318.510132		1318.435913
f	1396.912964		1396.914673		1396.873413
f#	1479.977661		1479.981567		1479.977661
g	1567.981689		1567.979248		1567.893311
g#	1661.218750		1661.218384		1661.171997
a	1760.000000		1760.001831		1760.000000

So, thanks for the hint to cps2pch. I never used it actually, but I  
should have done it.

	joachim






gipch ftgen 1, 0, -13, -2, 9.09, 9.10, 9.11, 10, 10.01, 10.02, 10.03,  
10.04, 10.05, 10.06, 10.07, 10.08, 10.09
instr 1
istartcps = 880
istep = 0
loop:
ia = istartcps * 2 ^ (istep/12)
ipch tab_i istep, 1
ib cps2pch ipch, 12
ic = cpspch(ipch)
prints "%f	%f	%f%n", ia, ib, ic
loop_lt istep, 1, 13, loop
endin


i 1 0 .1



Am 02.08.2009 um 12:32 schrieb jpff@cs.bath.ac.uk:

> cpsxpch dies not use any table but calculates direct, as does cps2pch
>
>
>> For microtonal composing rounding errors would be a problem.
>> Which column is more accurate pitch/frequency wise? Can you
>> get away with using the 2^(n/12) only and losing the
>> ib = cpspch(ipch)?
>
> ==John ff
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>