Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Converting 32 bit integer to 32 bit floating point - best ways? (Read 2743 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Converting 32 bit integer to 32 bit floating point - best ways?

How does one convert 32 bit integer to 32 bit floating point?

I know that they may both be 32 bit, but the latter has reduced resolution due to its ability to float...

How do we convert a 32-bit integer file to 32-bit floating while retaining the maximum resolution that float can retain?

I am not so keen on reducing the 32 bit file to 24 bit integer and simply put that in a floating point container... so what's the best possible way to do this?

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #1
A hi-res recording made with a very quiet recording chain might contain musical information up to bit 20 or maybe even 21. The rest is noise. You won't lose anything if you truncate to 24 bit.
TheWellTemperedComputer.com

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #2
Given OP's posts regarding PGGB in the fb2k subforum, replies like "you can't hear the difference" or "no analog and physical playback chain can resolve this" is not going to be the best answer.

If there is a best way to convert 32-bit integer to 32-bit float then most (all?) software capable of doing this are already doing it in the best way. Some additional steps can make synthetic signals like high level tones look better when doing FFT analysis, for example, pre-quantize and dither to 25-bit fixed-point, but the cost is everything below the 25th bit will be lost when compared to simple rounding, so it is pretty useless.

Another thing is that doing the conversion in the opposite way (32-bit float to 32-bit integer) is also lossy because 32-bit float can encode -758dBFS with 25 bits of precision even if the file is normalized to just below 0dBFS.

Here are some examples of how the conversion is actually done.
https://hydrogenaud.io/index.php/topic,112361.msg1012996.html#msg1012996

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #3
A hi-res recording made with a very quiet recording chain might contain musical information up to bit 20 or maybe even 21. The rest is noise. You won't lose anything if you truncate to 24 bit.

I agree that it's true in the real world when you're capturing directly from an ADC, what I was talking about is post processing this signal in a DAW, where after it goes in the 64 bit floating point domain, after that you can export further formats

I have a few such files which were encoded to 32 integer PCM, for whatever reasons by their creator... so I wanna know how to handle these files graciously. Am I making sense? Consider my question educational if that helps.

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #4
Given OP's posts regarding PGGB in the fb2k subforum, replies like "you can't hear the difference" or "no analog and physical playback chain can resolve this" is not going to be the best answer.

If there is a best way to convert 32-bit integer to 32-bit float then most (all?) software capable of doing this are already doing it in the best way. Some additional steps can make synthetic signals like high level tones look better when doing FFT analysis, for example, pre-quantize and dither to 25-bit fixed-point, but the cost is everything below the 25th bit will be lost when compared to simple rounding, so it is pretty useless.

Another thing is that doing the conversion in the opposite way (32-bit float to 32-bit integer) is also lossy because 32-bit float can encode -758dBFS with 25 bits of precision even if the file is normalized to just below 0dBFS.

Here are some examples of how the conversion is actually done.
https://hydrogenaud.io/index.php/topic,112361.msg1012996.html#msg1012996

That makes sense, what I am currently confused by is the multiple types available in the name of 32 float, the IEEE specification has a signing bit, and 8 exponent bits, that makes it 23 bit resolution. Otoh, unsigned float files use the full 24. Then there's some other float which I can't remember, that has 24+1 sign bit, leaving 7 for exponents...

What I wanna know is, which "bit depth" can I dither down this 32 integer file to, so that it can retain in the float container.

That actually gave me another question, I seem to work with audio as well, and my daw is 32 float. Since this format can't keep anything above 23/24 bits anyways, how can I losslessly convert my 32 float files to 24? That's actually practical since 32f wav's take a ton of space because they cannot be compressed without esoteric tools... whilst FLAC 24 easily reduces it to half the size.

Any ideas? Would be really appreciated!

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #5
how can I losslessly convert my 32 float files to 24?
I'd recommend you download the software from the link I posted in my previous reply (the download link is at the end of my post) and figure it out. 32-bit float to 24-bit integer conversion is not going to be lossless, even if the input 32-bit float file is originated from a DAW with internally 32-bit float processing.

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #6
That makes sense, what I am currently confused by is the multiple types available in the name of 32 float, the IEEE specification has a signing bit, and 8 exponent bits, that makes it 23 bit resolution. Otoh, unsigned float files use the full 24. Then there's some other float which I can't remember, that has 24+1 sign bit, leaving 7 for exponents...
IEEE float has a 23-bit mantissa, but 25 bits of resolution: the sign counts as one bit and the exponent implies one more bit. I don't recognize the other formats you're talking about.

What I wanna know is, which "bit depth" can I dither down this 32 integer file to, so that it can retain in the float container.
Don't dither, just convert. The simplest possible conversion from 32-bit integer to 32-bit float will retain more precision than any fixed-bit-depth dithering.

Since this format can't keep anything above 23/24 bits anyways, how can I losslessly convert my 32 float files to 24?
You can't. But do you need the conversion to be lossless? Or can you use WavPack and avoid the lossy conversion entirely?

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #7
Quote
How does one convert 32 bit integer to 32 bit floating point?

I know that they may both be 32 bit, but the latter has reduced resolution due to its ability to float...
Floating point resolution is variable and it has more resolution at low levels, where it really counts.   Integer has zero resolution above 0dB or below a "count" of 1 (which is somewhere around -190dB at 32-bits).

Re: Converting 32 bit integer to 32 bit floating point - best ways?

Reply #8
Normalize it to +-1.0 then convert to 32 bit PCM