Csound Csound-dev Csound-tekno Search About

Re: Floats to Ints

Date1999-02-12 18:54
FromRichard Dobson
SubjectRe: Floats to Ints
You would still be using all the bits; you don't fall to 15bits until
the amplitude has descended to +-16384. If the signal is definitely not
going to have any further treatment before being rendered, then
normalizing to 32767 may be OK. However, in the worst case your signal
may contain something like a square wave , which, if full-scale
peak-to-peak, is not 0dB, but at +3dB. 

A full-scale sinewave is at 0db(FS) peak (i.e voltage), but at -3dB RMS.
Music signals are more complex than pure sinewaves, and may exceed that
RMS power. I prefer to normalize to around -3dB peak (say, 24000), so
that there is less chance of the rms power exceeeding 0dB - and always
while working on sounds.  You simply don't have the soft headroom in
digital that you get with analogue tape! That full-scale square-wave, if
seen as band-limited, as it should be, actually has little ripples
beyond the main 'flat' part, so my little bit of headroom simply gives
that square wave a bit of extra space to wiggle in.

So I suppose I am using 15.5 bits.

In any case, I suppose we should all be working in 24bit ints or floats,
now, anyway! And, in fact, in my own playback code, if I am reading a
CDP floatsam file I can get the peak value from the header and if it is
above 1.0 I normalize to full-scale shorts for the soundcard, which
works very well - by definition no other process will be applied to the
sound. But for 'work-in-progress' sounds, I always aim for -3dB. Even
filters with nominally unity gain may actually wobble a little bit.

Yes, the dithering is 'the last stage', and should therefore be built
into the soundcard or dac. But often it isn't, so it has to be applied
to the sound before it is sent to the convertor. Which is why you have
dithering options in Cool Edit Pro, etc. 

Richard Dobson


Anders Andersson wrote:
> 
> >It is a moot point whether one should scale right up to 32767 anyway - a
> >little bit of extra headroom would be good.
> 
> Why would that be good?
> The point is that this should be the
> last stage before burning to CD
> (or encoding to MP3, whatever)
> Wouldn't it be good to use ALL
> bit's possible?
> (No, I don't care if you are
>  going to play it on some crappy
>  soundblaster DA that can't handle
>  the full range linear.. :D)
> 
> >Ideally, when converting floats to shorts, which is a reduction in
> >resolution, you should dither the lowest bits with some form of noise
> >signal. But you should only do this if it is the last operation before
> >playing.
> 
> As a matter of fact it's suppose to be the last stage..
> Why would I want to do this? Isn't that to discard the last bit?!
> 
> Hmm.. maybe one should do a "FS-dithering" on the sample..
> 


-- 
Test your DAW with my Soundcard Attrition Page!
http://wkweb5.cableinet.co.uk/rwd