Scsynth float to integer conversion


Does anyone know how the floating points on the scsynth (32 or 64 bit?) gets converted to the 24 bit integers on my soundcard? Where does this happen, and how?

I’m trying to make a Phasor that counts one bit/one step up of a 24 bit integer each sample, and also wraps around, and I want to make sure it doesn’t miss or skip a step due to round off, or at the edges of ‘start’ and ‘end’.

Something like this:

var step = 0x800000.reciprocal; step, start: -1, end: 1 + step);

A thing that confuses me is that since 24 bits is an even number, does this mean that there is no ‘zero’, or does the negative or positive part of the amplitude have more depth than the other?

I’m terrible at remembering this numeric stuff… but I think in general C++ int’s have a single zero value, which means that they have unbalanced ranges, whereas floating point numeric types have two zero values, +0 and -0.

Thanks! I did some testing with a digital loopback from my soundcard which seems to support what you say.

Sending out -1.0 returned -1.0
Sending out 0.0 returned 0.0
Sending out 1.0 (or more) returned 0.99999988079071, which is exactly 1.0 - (2 ** 23).reciprocal