You are here

The "float/fixed" debate and more digital myths

For everything after the recording stage: hardware/software and how you use it.

Re: The "float/fixed" debate and more digital myths

Postby Rich Hanson » Tue Jan 07, 2020 3:36 pm

I stand corrected, I'm well out of date :thumbup:
User avatar
Rich Hanson
Frequent Poster (Level2)
Posts: 2137
Joined: Sat Sep 06, 2003 12:00 am
Location: UK

Re: The "float/fixed" debate and more digital myths

Postby Folderol » Tue Jan 07, 2020 7:06 pm

Rich Hanson wrote:I stand corrected, I'm well out of date :thumbup:
I have to be corrected so often that I find it more comfortable to sit :lol:
User avatar
Folderol
Jedi Poster
Posts: 11480
Joined: Sat Nov 15, 2008 1:00 am
Location: The Mudway Towns, UK
Yes. I am that Linux nut.
Onwards and... err... sideways!

Re: The "float/fixed" debate and more digital myths

Postby merlyn » Wed Jan 08, 2020 5:48 pm

@Rich Thanks for your input. This is how myths get busted!

The idea that 32 bit float contains unaltered 24 bit audio data scaled by an eight bit exponent is ... a myth. I don't know where this originated but it's all around the internet -- I've never seen it explained any other way.

It may have been put together to reassure neurotic musicians who want to dither 24 bit audio ... twice.

What I said above about an exponent of 2^0 = 1 is wrong. With an exponent of 1 the numbers that can be represented are +1 to +2 and -1 to -2. That isn't a lot of use for audio.

The two's complement integers must be converted to a float between -1 and +1.

As far as I can see this doesn't introduce errors. Take 1 as an integer. To convert it to a float between 0 and 1 you would divide by 2^23 and that can be done exactly in a float with an exponent 0f 2^-23.

1 > 1/(2^23) = 2^-23
2 > 2/(2^23) = 1/(2^22) = 2^-22
3 > 3/(2^23) (also exact)
4 > 4/(2^23) = 2^-21

... and so on. This means the exponent is being used all the time.

The principle that no information is being lost or gained holds, but the details are more involved than the myth suggests.
merlyn
Regular
Posts: 144
Joined: Thu Nov 07, 2019 3:15 am

Re: The "float/fixed" debate and more digital myths

Postby Hugh Robjohns » Wed Jan 08, 2020 6:11 pm

merlyn wrote:...the details are more involved than the myth suggests.

Isn't that always the way? :D :ugeek:
User avatar
Hugh Robjohns
Moderator
Posts: 28666
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: The "float/fixed" debate and more digital myths

Postby desmond » Wed Jan 08, 2020 6:27 pm

merlyn wrote:The idea that 32 bit float contains unaltered 24 bit audio data scaled by an eight bit exponent is ... a myth.

I'm not sure if you were referring to me or not, but I'll say if it wasn't clear is that I didn't think that was the case. When I say that 32-floating audio format contains 24-bit audio data, it doesn't mean I think it's a naive mapping of 24-bits of fixed point stuck in the lower bits of the floating point number - but I can see that it can be interpreted (incorrectly) as that's what's going on.

One thing I do say is that float numbers are "mathsy" and not at all intuitive to "regular" folk compared to fixed point files which are reasonably straighforward, and the times when I've looked into it just makes me realise that the full details are over rather over my head and I have needed to get into it deeply enough for a complete understanding. I understand just enough of it to be useful (and not *too* dangerous!) ;)

merlyn wrote:I don't know where this originated but it's all around the internet -- I've never seen it explained any other way.

Indeed. Like many things about digital audio, often they are explained by people who don't know the full details, because the full details have complexities that are problematic to explain to us more naive folk.

merlyn wrote:The two's complement integers must be converted to a float between -1 and +1.

Indeed.

merlyn wrote:The principle that no information is being lost or gained holds, but the details are more involved than the myth suggests.

Yes.

Also, I vaguely recall (but don't have the full details offhand) something about the floating range when you get high up is that the resolution isn't quite linear like integers - the gaps between numbers on the scale get bigger as you go. Maybe you can explain that to us laymen...
User avatar
desmond
Jedi Poster
Posts: 10301
Joined: Tue Jan 10, 2006 1:00 am
mu:zines | music magazine archive | difficultAudio

Re: The "float/fixed" debate and more digital myths

Postby Hugh Robjohns » Wed Jan 08, 2020 6:53 pm

Most users don't realise that digital audio typically uses of two's complement binary, or the fundamental reasons for that, and will probably never grasp the important subtleties of IEEE floating point formats...

And most explanations are (over) simplified to try and get a concept across, rather than the detail... which is absolutely fine in my book. Most people aren't interested in, and don't need the technical detail, and the few who are interested will be quite capable of moving beyond the simplified analogies.

H
User avatar
Hugh Robjohns
Moderator
Posts: 28666
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: The "float/fixed" debate and more digital myths

Postby Rich Hanson » Wed Jan 08, 2020 8:18 pm

Back in the dim and distant past (i.e. pre IEEE standardisation) there was a floating point format that was effectively a 2's complement with an exponent, so that's probably where the myth originated. My experience was on an old GEC minicomputer with 14 bit word length, so that gives you some idea of how long ago :bouncy: (Needless to say that in 14 bits, the accuracy was less than stellar, we tended to use our own fixed point libraries instead)

Anyway, back to the subject in hand!
User avatar
Rich Hanson
Frequent Poster (Level2)
Posts: 2137
Joined: Sat Sep 06, 2003 12:00 am
Location: UK

Re: The "float/fixed" debate and more digital myths

Postby CS70 » Wed Jan 08, 2020 9:14 pm

desmond wrote:Also, I vaguely recall (but don't have the full details offhand) something about the floating range when you get high up is that the resolution isn't quite linear like integers - the gaps between numbers on the scale get bigger as you go. Maybe you can explain that to us laymen...

That's not so difficult to see, without even considering radix complements and IEEE 754. it's just a general consequence of the fact that the representation uses a nonlinear function and that you have only so many bits available to represent the function parameters (for a format say as "1.decimals x 10 power exponent" you will have a onlya given number of bits for "decimals" and for "exponent").

For fixed point representation (in the form "number dot decimals"), the "fixed number" of bits for "number" and "decimals" means that you have constant gaps between the real numbers that can be represented and numbers that cannot (and will be approximated, typically to the nearest lower representable number).

Say you allocate 2 bits for the decimals, you can represent only .0, .1, .2 and .3 as decimal parts, so that the real numbers 1.15 and 1.16 will end up both as,say 1.1 - the gap between the numbers you can represent will be a constant .1 . In other words, the mapping between reals and representation - so long there is one - is linear because the mapping function is linear.

With a representation that uses a power 10 function (or whatever nonlinear mapping), you still have the same "constant spacing" for the decimal part, but the multiplier will vary nonlinearly, leading to an nonlinear spacing between the representable numbers.

Say you use 2 bits for decimal part and 2 bits the exponent: you will have 0,1,2 and 3 as possible decimal parts (leading to 1.0, 1.1, 1.2 and 1.3 as left multiplier) and 1, 10, 100 and 1000 as possible right multipliers. Therefore, the numbers you can represent are therefore 1, 1.1, 1.2, 1.3, then 10, 11, 12, 13, then again 100, 110, 120, 130 and finally 1000, 1200, 1300, 1400. So the gaps between numbers that can be represented (or equivalently, the approximation error when you map real numbers) varies nonlinearly (and gets bigger for bigger numbers that you want to represent).

The same will happen with any representation using a nonlinear function, with the "gaps" between numbers varying according to the specific nonlinear function used.
User avatar
CS70
Jedi Poster
Posts: 6243
Joined: Mon Nov 26, 2012 1:00 am
Location: Oslo, Norway
Silver Spoon - Check out our latest video and the FB page

Re: The "float/fixed" debate and more digital myths

Postby merlyn » Thu Jan 09, 2020 5:00 am

If I have a go at explaining that ...

23 bits is 8,388,608 different values. If the exponent is 2^0 = 1 there are 8,388,608 steps between 1 and 2. If the exponent is 2^1 = 2 there are the same number of steps but now these steps span the interval between 2 and 4. This is the same number of steps covering twice the range. If the exponent is 2^2 = 4 there are the same number of steps to cover the interval between 4 and 8. The distance between steps is getting bigger as the exponent goes up.

The exponent can go up to 2^127 = 170 141 183 460 469 231 731 687 303 715 884 105 728.

Those ~8 million steps don't seem like so many now :D
merlyn
Regular
Posts: 144
Joined: Thu Nov 07, 2019 3:15 am

Re: The "float/fixed" debate and more digital myths

Postby wireman » Thu Jan 09, 2020 9:10 pm

Yes indeed. By the way there is a nice blog here...

https://blogs.mathworks.com/cleve/2014/07/07/floating-point-numbers/

In some fields people are looking at using less bits to represent numbers than the standard 32/64 and also proposing other floating-pont representations with different distributions. Specialist hardware (GPUs) now support shorter number formats which means that multiple operations can run faster and also you get an advantage because it takes less memory and memory bandwidth to compute on numbers represented by less bits.

For audio (and I doubt we care anyway) it could even turn out that the distribution you note is actually a good thing as we use log scales as more relevant to hearing response in any case
wireman
Frequent Poster
Posts: 549
Joined: Fri Dec 17, 2004 1:00 am

Re: The "float/fixed" debate and more digital myths

Postby merlyn » Fri Jan 10, 2020 4:06 pm

We never actually hear a 32 bit float. A to Ds and D to As are 24 bit.

This ties into your question earlier about what happens to a 32 bit float signal at +20dBFS. That can only happen inside a DAW.

Sampled data (24 bit) -> internal processing (32 bit float) -> reconstruction (24 bit)

By applying a gain of 20dB to a track the internal bus could have a level of +20dBFS but if you send that to the master bus with the master fader at 0dB it's going to be a distorted mess. The master fader would have to be at -20dB.

The master fader is dividing by a constant, in this case 10. It brings the 32 bit float back into the -1 to +1 range. Tracks can go over, but the master bus can't because it is outputting to 24 bit.
merlyn
Regular
Posts: 144
Joined: Thu Nov 07, 2019 3:15 am

Re: The "float/fixed" debate and more digital myths

Postby Hugh Robjohns » Fri Jan 10, 2020 4:41 pm

merlyn wrote:We never actually hear a 32 bit float. A to Ds and D to As are 24 bit.

That was the case... but we now have Zoom and Sound Devices promoting their 32-bit floating-point A-D converters in their premium portable recorders. So I suspect it won't be that long before we have other interface and preamp manufacturers offering and boasting about the same capability... not because it's really needed (in most conventional recording situations) but just because it's a bigger number that will please the marketing team. :crazy:

And D-As that directly accept 32-bit float via a USB connection can only be a trade show or two away, too... :beamup:
User avatar
Hugh Robjohns
Moderator
Posts: 28666
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: The "float/fixed" debate and more digital myths

Postby merlyn » Fri Jan 10, 2020 7:00 pm

It's interesting that you brought that up. It was the buzz around 32 bit float recording that led me to investigate.

This led to the patent for Sound Device's technology. It uses three 24 bit A to Ds in parallel :

Image

There's a load of DSP involved to produce a 32 bit float.
merlyn
Regular
Posts: 144
Joined: Thu Nov 07, 2019 3:15 am

Re: The "float/fixed" debate and more digital myths

Postby Hugh Robjohns » Fri Jan 10, 2020 7:12 pm

They've dropped hints that their practical implementation involves more than three separate preamp and A-D paths, too. And yes, lots of number-crunching required to blend the various output data together sensibly! Seems to work very well, though...

H
User avatar
Hugh Robjohns
Moderator
Posts: 28666
Joined: Fri Jul 25, 2003 12:00 am
Location: Worcestershire, UK
Technical Editor, Sound On Sound

Re: The "float/fixed" debate and more digital myths

Postby merlyn » Sat Jan 11, 2020 3:00 pm

I think sanity will prevail and 32 bit float recording will remain a niche activity. For a field recorder it makes sense -- it can't clip.

But for a USB interface I can't see it taking off. The DSP must introduce latency. Early adopters would report that their 32 bit float interface was more expensive, sounds the same and has more latency. Hardly a glowing recommendation. :D

Of course we'll see and sanity has had a habit of not prevailing recently. :D
merlyn
Regular
Posts: 144
Joined: Thu Nov 07, 2019 3:15 am

PreviousNext