[Flac-dev] floating point
Brian Willoughby
brianw at sounds.wa.com
Fri Aug 14 15:47:05 PDT 2009
On Aug 14, 2009, at 14:24, Paul Davis wrote:
> On Fri, Aug 14, 2009 at 5:05 PM, Josh Coalson<xflac at yahoo.com> wrote:
>> it's unlikely flac will ever support floating-point samples
>> natively. the main application for it is audio engineering, which
>> demands easy editing and very high speed for both encoding and
>> decoding above everything else.
>
> thats not why floating point is used.
>
> the highest current feasible bit resolution for digital audio samples
> is 24 bits. most converters don't even fully provide that. 32 bit
> floating bit allows bit-for-bit storage of all 24 bits of the original
> sample as the mantissa, along with more bits available in the
> exponent. this provides astronomical "headroom" for use when summing
> multiple samples. if you only use 24 bits and add two values very
> close to the maximum 24 bit value, you will overflow. even if you use
> 32 bits, its not imposible to construct workflow scenarios where you
> would overflow. if you do this in float format, you lose a little
> precision in the answer, but you cannot overflow.
>
> this is why floating point is used.
You have successfully described why the music production industry has
settled on float for processing, but this has nothing to do with
storage formats for analog-to-digital audio recording and playback.
Programs like Logic Pro will transparently convert from 24-bit source
files to 32-bit float internally, to avoid the headroom issues you
speak of. There is no requirement that the files be stored as 32-bit
float because you can still do all processing in 32-bit float even
with 24-bit file sources.
When the ADC source and the DAC destination are both limited to 24-
bit fixed point integers, it makes absolutely no sense to store
recordings or final mixes in 32-bit floating point representation.
The headroom you speak of is completely unavailable when storing the
output of an ADC into a file. Likewise, headroom is wasted when
playing back a fully mastered piece of audio to a 24-bit DAC.
Headroom is only an issue when you want to work on the audio and
change it, which is something that 99% of audio consumers do not
bother with or even understand.
>> flac is designed as a consumer audio format. it trades ease of
>> editing for a featureful, robust transport layer more suited for
>> playback, and encoding speed for more compression and faster
>> decompression.
>
> flac seems more popular at present among high end audiophiles than
> mere consumers. its very regrettable that it doesn't support floating
> point natively. many of our users (http://ardour.org/) have asked
> about using FLAC as an option for recording format, but we have to
> explain that its not viable because of the lack of floating point
> support. and yes, that is audio engineering :)
Audiophiles are still consumers, in that they do not produce music,
they merely consume it. You are correct that audiophiles tend to
live in the gray area between typical consumers and professionals,
but they still don't need 32-bit float.
Users of Ardour are beyond audiophiles, because they're actually
producing music. There would be two different sets of needs for
storage formats. For final mixes and delivery of finished audio, 24-
bit file formats like FLAC are perfect. These files are in a format
ready to send to a 24-bit DAC for listening. Any headroom beyond 24-
bit is pointless for a delivery format. For one thing, a 32-bit
file, compressed or not, would need to be dithered before playing on
a 24-bit DAC.
Ardour users would have a different set of needs for intermediate mix
files such as stems and "frozen" tracks. These would indeed be best
as 32-bit float, and an optimized format like FLAC would be
inappropriate. It would be quite interesting if someone were to
create a lossless format which can handle 32-bit float, but I don't
believe it has been done yet. In most respects, this would mostly be
a tradeoff between storage space and processing power, since
processing a compressed file is usually too expensive for most DAW
software, and so they always uncompress source files before using
their data. Thus, even a space-saving format like FLAC would be
pointless for Ardour, since you'd still need to take up disk space
for an uncompressed copy of the data (like Ableton Live, which
supports FLAC). About the only positive use for lossless compression
of 32-bit float would be sending stems from digital mixing houses to
digital mastering houses, while saving on disk space. Generally,
saving space is not critical at that professional level, since
there's usually enough of a budget to cover the cost of increased
storage space.
I suggest that you tell your users to select FLAC only for final mix
bounces, and direct them to another format for intermediate storage
of audio which will be processed further.
Brian Willoughby
Sound Consulting
More information about the Flac-dev
mailing list