OGG decoder somewhat loud?


#1

HI,
I’m trying to use the OGG file reader, in which I believe is the simplest way possible, but i’m experiencing an unexpected side effect.
Besides from decoding the file correctly, the data returned to me is billions of times too loud! The data is of course 32bit floats, and that’s
usually assumed to be normalized to ±1.0 …?

Am I missing something obvious? I’m using a version of Juce no more than a few weeks.

Grateful for hints :slight_smile:


#2

I say this in complete ignorance of the decoder in question, but are you sure it’s not fixed point being upcast to float? e.g. +/- 32768.0 for 16-bit


#3

I’m pretty sure it has nothing to do with casting between ints or floats. The decoder tells you if the data is a 32 bit float or int. You then cast appropriately. Floats are supposedly normalized against ±1.0
Also, being an OGG reader, there is probably no integer arithmetics involved inside the codec. The audio also seem to be “alright” except for the extreme volume. Hmm…?


#4

Odd. I haven’t touched any ogg code for a very long time… Anyone else seeing problems?


#5

[quote=“jules”]Anyone else seeing problems?[/quote]That’s what I was thinking when I searched the forum. No one seem to be mentioning anything.


#6

I use Ogg a lot and haven’t noticed anything strange. Does this happen if you build the JuceDemo and load some ogg files? If you change the WavAudioFormatWriter to an OggVorbisAudioFormatWriter in the recorder demo are the files played back properly by another application?


#7

Problem solved! After rewriting my code I realize it was indeed a casting error between int/float
I didn’t think it was a casting problem considering I know how it was supposed to work, but I hadn’t actually done it that way. Doh!

Thanks all!