Csound Csound-dev Csound-tekno Search About

[ot]Doubles -> Int

Date1999-09-17 01:47
FromAnders Andersson
Subject[ot]Doubles -> Int
Hello list! =)


A long time ago I believe I asked some questions about how to convert floats
to 16-bit or less. As I don't remember the answers, I ask again:

What's the best algorithm to use for converting a normalized sample to
integers and get the best soundquality?

There are atleast 2 questions that comes up:

1. What method should I use when rounding? ceil(), floor(), or normal
rounding?
2. Should I add 1-bit noise to the sample? If so, when should I do this?
Should the noise be between -1 and 1, or 0 and 1, or -1 and 0?


Before, I have done something like this: (for 8-bits)

    integer = floor( 127.99999*sample )

This will give me a full range output, but may give a -0.5 DC..


Thanx!

/ Anders Andersson, www.algonet.se/~pipe/