Abstractions of AudioIODevice quantization methods


#1

Would it be possible to abstract the conversion of floating point audio sample data to integer so that client code can override the behavior (for all device types)? I’m talking specifically about

convertFloatToInt16
convertFloatToInt24
convertFloatToInt32

Furthermore, it would be convenient if all the audio device types used a common bottleneck for quantization of sample data. For example, juce_win32_DirectSound has convertInputValue() instead of convertFloatToInt16().

juce_AudioDataConverters.h looks extremely interesting :slight_smile: WASAPI seems to use it for quantization. Perhaps audio data conversion can be further abstracted with virtual functions, each AudioIODevice subclass can be modified to use a caller provided converter, and the default would be to use the existing conversion?


#2

Hmm forgive me it’s early morning, I guess what I am trying to say is that I would like to provide my own conversions for float to int, for all areas of Juce. I would like to provide the conversion methods as an object of class type (so I can keep some state variables).


#3

Or you could just ask for “dithering on the output devices, please”…?


#4

Hahaha…yeah you got me. Two things though, first dithering is not a trivial change (but making the conversion APIs abstract is), and second certain individuals who shall remain anonymous may be using either third party libraries, or proprietary trade secrets when performing the conversion. For example, a noise shaping technique where the noise source uses an equal loudness coutour (think Fletcher–Munson). Do you really want to add all that into Juce? I don’t there is a single quantization method that is going to satisfy everyone. I already have some routines for performing the conversion and I would just like to call them.


#5

TBH I think the easiest way to add dithering to your app is to simply tell your users that you’ve added it, and let the placebo effect do the work for you.


#6

Can we please get a “hook” so a Juce application can customize the conversion from float to output?