Csound Csound-dev Csound-tekno Search About

0dbfs 24 bit question

Date2007-09-09 22:57
From"Brian Willkie"
Subject0dbfs 24 bit question
AttachmentsNone  

Date2007-09-09 23:35
FromRichard Dobson
SubjectRe: 0dbfs 24 bit question
Brian Willkie wrote:
> Hello,
> 
> If I set 0dbfs = 8388608 and run the orc/sco below with the following
> command:
> 
> csound -A -o ampMapTest.aiff ampMapTest.orc ampMapTest.sco
> 
> and look at the waveform in Audacity I get one loud sine tone and one
> quiet sine tone.
> 
> If I add the -3 flag for 24bit, csound tells me there are no samples
> out of range, but when I look at the waveform in Audacity I see one
> distorted tone followed by one loud tone.
> 
> sndinfo and Audacity confirm that the audio file is 24 bit 96kHz.
> 
> Admittedly I'm using an old version of csound (4.23).
> 
> Am I missing something?
> 

It is indeed a very old version of Csound. There may have remained a
byte-reversal bug with 24bit conversions on AIFF files; depends what the 
nature of the distortion is. But to make a 24bit file just
use the -3 flag and use either the default 0dbfs value or, ideally, 
simply 1.0. There is no need nor any virtue in setting 0dbfs that large.
Csound will in all cases internally scale the data as required by each 
output sample type. Musically/acoustically, it is better to specify 
amplitudes in negative dB anyway!

And it is never a good idea to create audio right up to digital peak; 
leave a little headroom, with -3dB as a minimum. Avoids any danger of 
analogue clipping or numerical foldover.  For example,  you should eally 
specify 8388607 as maximum amplitude, just as 32767 is the largest 
positive value in 16bit samples.

Richard Dobson