Discussion:
[LAD] LADPSA and LV2 Sample Types
Taylor
2017-03-06 19:59:47 UTC
Permalink
Hey,

I'm a little bit new to LADSPA and LV2, so this may be a naive question.

I would like to know why single precision floating point types are used in the plugin interface, instead of double precision.

I would also like to know if there are plans to standardize a plugin interface that may process double-precision instead of single-precision data (or both).
Paul Davis
2017-03-06 20:30:18 UTC
Permalink
Post by Taylor
Hey,
I'm a little bit new to LADSPA and LV2, so this may be a naive question.
I would like to know why single precision floating point types are used in
the plugin interface, instead of double precision.
I would also like to know if there are plans to standardize a plugin
interface that may process double-precision instead of single-precision
data (or both).
Nobody needs double precision when moving data between host and plugins (or
from one plugin to another).

You might be able to make a case for double precision math inside a plugin
(and indeed several people have). But once that particular math is done,
single precision is more than adequate.

As to why.... because everybody else who knew anything about this stuff was
using 32 bit floating point already.

No existing plugin API supports double precision floating point as a
standard sample format (you could do it in AU, but it would involve a
converter to/from single precision on either side of the plugin that asks
for this.
Paul Davis
2017-03-07 10:34:34 UTC
Permalink
I need to correct a mistake in what I wrote yesterday.

VST3 does support double precision samples, and for whatever inexplicable
reason even makes it the default.

Thanks to Robin Gareus for pointing this out.

Also, to follow on from something Fons wrote: an actual 32 bit sample value
would have at least the low 4-6 bits representing brownian (atomic) motion.
That's pretty crazy.
Post by Paul Davis
Post by Taylor
Hey,
I'm a little bit new to LADSPA and LV2, so this may be a naive question.
I would like to know why single precision floating point types are used
in the plugin interface, instead of double precision.
I would also like to know if there are plans to standardize a plugin
interface that may process double-precision instead of single-precision
data (or both).
Nobody needs double precision when moving data between host and plugins
(or from one plugin to another).
You might be able to make a case for double precision math inside a plugin
(and indeed several people have). But once that particular math is done,
single precision is more than adequate.
As to why.... because everybody else who knew anything about this stuff
was using 32 bit floating point already.
No existing plugin API supports double precision floating point as a
standard sample format (you could do it in AU, but it would involve a
converter to/from single precision on either side of the plugin that asks
for this.
Will Godfrey
2017-03-07 11:13:23 UTC
Permalink
On Tue, 7 Mar 2017 11:34:34 +0100
Post by Paul Davis
I need to correct a mistake in what I wrote yesterday.
VST3 does support double precision samples, and for whatever inexplicable
reason even makes it the default.
Thanks to Robin Gareus for pointing this out.
Also, to follow on from something Fons wrote: an actual 32 bit sample value
would have at least the low 4-6 bits representing brownian (atomic) motion.
That's pretty crazy.
Adding to this, even 16 bit has a dynamic range of over 90dB. There is a quite
dramatice demo at that depth of a garage door being slammed after the
demonstrater talks rather quietly - sorry, I can't find it now.

By the time you reach 24bit, you're well below any reasonable accoustic noise
level, and are getting into the region of thermal noise in analogue equipment.
--
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
Fons Adriaensen
2017-03-07 22:26:02 UTC
Permalink
Post by Paul Davis
Also, to follow on from something Fons wrote: an actual 32 bit sample value
would have at least the low 4-6 bits representing brownian (atomic) motion.
That's pretty crazy.
To put this in perspective:

To have a dynamic range corresponding to roughly 27 bits,
an analog signal needs to have full scale power of 1 Watt
(since thermal noise in 20 kHz is around -161 dBW, and
161 / 6 ~= 27).

For 32 bits you'd need more than a kilowatt at the point
of conversion between analog and digital and in every
analog signal point before or after.

Ciao,
--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)
Fons Adriaensen
2017-03-06 22:54:11 UTC
Permalink
Post by Taylor
I'm a little bit new to LADSPA and LV2, so this may be a naive question.
I would like to know why single precision floating point types are used
in the plugin interface, instead of double precision.
Because 32-bit floating point already provides more dynamic range
than is required for audio signals.

Even 24-bit fixed point has a dynamic range of 145 dB. Which means
it can at the same time represent a signal that is so low that you
can't hear it, and one so loud that will damage your ears beyond
repair.

Even the best analog hardware, including AD and DA converters, and
even using high 'professional' signal levels, is no better than 21
or maybe 22 bits. This is not going to change, it's the consequence
of basic physics.

Using double precision doesn't provide any advantage. The only place
where it may be required is internally in some DSP algorithms (e.g.
some filter types). But even this can be avoided in most cases by
good design.

If you read anything on the web claiming that high quality audio
requires 32 bits converters or double precision you can be sure
this is snake oil - someone trying to make money by exploiting
ignorance.
Post by Taylor
I would also like to know if there are plans to standardize a plugin
interface that may process double-precision instead of single-precision
data (or both).
Don't think so, since there's no point in doing that.

Ciao,
--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)
Loading...