Csound Csound-dev Csound-tekno Search About

[Csnd] Re: rendering float @ double-sample version is okay?

Date2008-07-22 13:03
FromMichael Gogins
Subject[Csnd] Re: rendering float @ double-sample version is okay?
The double or float versions of Csound refer ONLY to the internal sample format. In the double version, audio samples internally are double-precision (64 bit) floating-point numbers. In the float version, audio samples internally are single-precision (32 bit) floating-point numbers. This has NOTHING to do with the external sample format, which depends on the command-line options. Normally, with either version of Csound, one would render to 16 bit audio, 16 bit soundfiles, float soundfiles, etc.

The only difference that I know if in the sound of the two versions is that, in some instruments with digital filters, there is a barely audible difference in sound. This is to be expected because some digital filters are more stable with higher-precision numbers.

In general, other things being equal, one would expect that higher precision is better, although it may run a little slower.

Hope this helps,
Mike

-----Original Message-----
>From: '2+ 
>Sent: Jul 21, 2008 10:31 PM
>To: csound@lists.bath.ac.uk
>Subject: [Csnd] rendering float @ double-sample version is okay?
>
>hi!
>i've been wasting couple of years being a distro-gipsy
>and was going nerdy doing re-installs and re-installs almost everyday
>but at last
>have cs5 apt-got on my ubuntu-hardy-ppc@ibookg4
>and started working on cs again yesterday
>
>thanx to the developers had no trouble
>but there is one thang am wondering about
>this cs5 seems to be the double-sample version
>there seems to be nothing going wrong with rendering my orc&sco
>but these are the ones i wrote for the float version
>well actually
>the output is kinda de-tuned noise anyway
>so am not sure if the calculation is being done
>as i intended it to go
>
>or is it just that
>sample is double
>but things we write in orc&sco should always be float?
>
>mmm ... hope it is like that ...
>
>these are what i used to render thangs:
>
>tia
>
>=== oil.orc ===
>
>sr = 44100
>kr = 4410
>ksmps = 10
>nchnls = 2
>seed  0
>
>giamp = 1.1
>
>instr 1
>
>	il1	rnd31	0.5,	0.5
>	il2	rnd31	0.5,	0.5
>	ir1	rnd31	0.5,	0.5
>	ir2	rnd31	0.5,	0.5
>	ic	rnd31	0.5,	0.5
>
>	ifreq = 1 / (2 * p3)
>	iamp = p4 / 3
>
>
>	kenvg	oscil	iamp,	ifreq,			1,	0
>	kenvl1	oscil	1,	8 * ifreq,		1,	0.5 + il1   
>	kenvr1	oscil	1,	8 * ifreq,		1,	0.5 + ir1   
>	kenvl2	oscil	1,	(8 / 2) * ifreq,	1,	0.5 + il2   
>	kenvr2	oscil	1,	(8 / 2) * ifreq,	1,	0.5 + ir2   
>
>        asigl1	oscil	kenvg * kenvl1 * (- kenvr1) * kenvl2,			p5 * 9 / 8,	1 
>        asigr1	oscil	kenvg * kenvr1 * (- kenvl1) * kenvr2,			p5 * 10 / 8,	1
>        asigl2	oscil	kenvg * (kenvl2 - kenvr2) / 2,				p5 * 12 / 8,	1
>        asigr2	oscil	kenvg * (kenvr2 - kenvl2) / 2,				p5 * 13 / 9,	1
>        asigc	oscil	kenvg * (kenvl1 + kenvr1 + kenvl2 + kenvr2) / 4,	p5,		1 
>
>        outs	(asigl1+asigl2+asigc) * giamp	,	(asigr1+asigr2+asigc) * giamp
>
>endin
>
>instr 2
>
>	il1	rnd31	0.5,	0.5
>	il2	rnd31	0.5,	0.5
>	ir1	rnd31	0.5,	0.5
>	ir2	rnd31	0.5,	0.5
>	ic	rnd31	0.5,	0.5
>
>	ifreq = 1 / (2 * p3)
>	iamp = p4 / 3
>
>	kenvg	oscil	iamp,	ifreq,			1,	0
>	kenvl1	oscil	1,	9 * ifreq,		1,	0.5 + il1   
>	kenvr1	oscil	1,	9 * ifreq,		1,	0.5 + ir1   
>	kenvl2	oscil	1,	(9 / 2) * ifreq,	1,	0.5 + il2   
>	kenvr2	oscil	1,	(9 / 2) * ifreq,	1,	0.5 + ir2   
>
>        asigl1	oscil	kenvg * kenvl1 * (- kenvr1) * kenvl2,			2 * p5 * 8 / 9,		2 
>        asigr1	oscil	kenvg * kenvr1 * (- kenvl1) * kenvr2,			p5 * 9 / 8,		2
>        asigl2	oscil	kenvg * (kenvl2 - kenvr2) / 2,				p5 * ((9 / 8) ^ 2),	2
>        asigr2	oscil	kenvg * (kenvr2 - kenvl2) / 2,				2 * p5 * ((8 / 9) ^ 2),	2
>        asigc	oscil	kenvg * (kenvl1 + kenvr1 + kenvl2 + kenvr2) / 4,	p5,			2 
>
>        outs	(asigr1+asigr2+asigc) * giamp	,	(asigl1+asigl2+asigc) * giamp
>
>endin
>
>=== oil.sco ===
>
>f 1 0 16384 10 1
>f 2 0 16384 10 1 1 1 1 1 1 1 1
>
>i1 0.0 15.0 20000.0 36.708096
>i2 1.4019952 7.25 20000.0 29.366476
>i1 0.3064011 11.25 20000.0 29.366476
>i1 0.23766193 1.25 20000.0 36.708096
>i2 3.1165128 11.25 20000.0 41.296608
>i1 2.231495 11.25 20000.0 36.708096
>i2 3.7424757 10.25 20000.0 48.46616
>i1 8.012801 3.75 8571.429 65.258835
>i2 7.8016973 1.75 8571.429 73.41619
>i2 10.493078 3.75 8571.429 55.605164
>i1 2.6648192 8.75 8571.429 91.77024
>i2 0.8853879 3.75 8571.429 96.93232
>i1 8.846228 4.75 8571.429 53.022804
>i1 7.3049273 3.75 8571.429 48.944126
>e
>
>
>Send bugs reports to this list.
>To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2008-07-22 13:12
FromJK
Subject[Csnd] Re: Re: rendering float @ double-sample version is okay?
Michael Gogins wrote:

> In general, other things being equal, one would expect that higher
> precision is better, although it may run a little slower.


Except possibly on 64-bit hardware. I seem to recall a report
(maybe on csounds.com) of double-sample Csound running measurably
faster on some 64-bit chips.  Though I suppose that would be a
case of other things NOT being equal. :-)

-- JK

-- 
I do not particularly want to go where the money is -
  it usually does not smell nice there. -- A. Stepanov