Audio sample types


#1

Hi, i’m currently working on an audio application for some company, and they want to go cross platform. the application mostly deals with mp3 files, and needs to store them in memory for rapid access.

I know Juce and would like to use it for this, but the ‘cto’ wants to use shorts instead of floats to keep them in memory and process them faster.
Considering Juce’s audio sample are hard-coded as floats all the way, we would have to modify a lot of sources, or find another solution.

but I’m conviced that we could use float audio samples and forget about this old short type … does this matter any more ?
I mean, Jules used juce for tracktion, and it works great.

I don’t have so much experience with audio programming, Do you have any pros / cons for this ?
convincing this guy to use juce for audio would save me so much headaches …


#2

Forgot to mention :

the application already has a large code base using interlaced samples for stereo.
Is it expensive to use juce::interleaveSamples() and deinterleaveSamples() for this ?


#3

floats are absolutely the way to go. Shorts were handy in the old days, but with modern cpus there’s no advantage to them at all. All audio i/o is moving that way these days.

Interleaving an de-interleaving is a bit of a pain, but wouldn’t have thought it’s particularly slow…


#4

[quote=“jules”]floats are absolutely the way to go. Shorts were handy in the old days, but with modern cpus there’s no advantage to them at all. All audio i/o is moving that way these days.
[/quote]

Yeah, unless you keep a lot of samples in memory, where shorts might come in handy.
(And even in that case, its most likely best to convert to floats before processing, and convert back to shorts when finished processing.)


#5