Log in

View Full Version : Test Tones: FLAC and AC3 for calibrating LPCM levels


lstepnio
1st December 2008, 19:19
I'm attempting to generate test tones for calibrating the volume levels on my HTPC between AC3/DTS being bit streamed to my receiver for decoding and FLAC/AAC audio decoded on the PC sent to the receiver via HDMI LPCM. The XP mixer volume control has an effect on LPCM audio which seems to me needs/should to be calibrated. The mixer has no effect on AC3/DTS being bit streamed to the receiver as expected. I've discovered that the middle position in the XP mixer which I would assume is 0db gain is much quieter when comparing the same track between encoded in AC3/DTS(bitstream) and FLAC(LPCM).


I'm now attempting to calibrate the XP mixer for LPCM output and running into an issue I would appreciate assistance with.

First, generated an uncompressed 5 minute 16-bit PCM 441000Hz mono Pink Noise WAV track. Next, compressed the WAV to FLAC using:

flac --best PinkNoise.wav -o PinkNoise.flac

The FLAC sounds identical to the source WAV file as expected.

Finally, using ffmpeg to create an AC3 encode with:

ffmpeg -i PinkNoise.wav -ab 192k -acodec ac3 -y PinkNoise.ac3

The result is that volume level is higher on the AC3 encode confirmed by decoding the AC3 and FLAC on the PC without bit steaming and spectrum analysis on multiple players.

What am I missing to create an FLAC and AC3 file with the same volume levels? Any other suggestions to calibrate the levels?

tebasuna51
2nd December 2008, 00:40
The result is that volume level is higher on the AC3 encode confirmed by decoding the AC3 and FLAC on the PC without bit steaming and spectrum analysis on multiple players.

Then you need adjust first your multiple players.

The internal volume of wav, flac and ac3 generated with this method must be the same.

lstepnio
2nd December 2008, 05:23
I've tested in multiple audio players under XP and linux. Could I be possibly be hearing compression artifacts in the AC3 file and confusing that with the volume? I didn't imagine it could be that drastic between FLAC and a AC3 compressed file but considering the audio is pink noise I suppose it's a possibility?

You mind taking a look/listen and giving your thoughts?

source: http://www.majjix.com/~lstepnio/120108/PinkNoise.wav
FLAC: http://www.majjix.com/~lstepnio/120108/PinkNoise.flac
AC3: http://www.majjix.com/~lstepnio/120108/PinkNoise.ac3

I appreciate the input here.

tebasuna51
2nd December 2008, 11:30
Well you are right about your ac3 volume samples, maybe the problem is your ffmpeg encoder version. With my FFmpeg version Sherpya-r14277 I obtain correct volume:

Your sample Your sample Your ffmpeg FFmpeg Sherpya-r14277
PinkNoise.wav PinkNoise_flac PinkNoise_ac3 PinkNoise_ac3
Statistics: ------------------- ------------------- ------------------- ---------------------
RMS power : 5.79% (-24.74 dB) 5.79% (-24.74 dB) 11.49% (-18.80 dB) 5.74% (-24.82 dB)
Average value: -0.93% (-40.59 dB) -0.93% (-40.59 dB) -1.87% (-34.57 dB) -0.93% (-40.59 dB)
Min value : -25.05% (-12.02 dB) -25.05% (-12.02 dB) -49.66% (-6.08 dB) -24.85% (-12.09 dB)
Max value : 23.94% (-12.42 dB) 23.94% (-12.42 dB) 48.39% (-6.30 dB) 24.09% (-12.36 dB)

Like you can see the flac file have exact volume than the wav file, your ac3 have double volume (+6 dB) and my ac3 encode have very similar volume to original wav.

EDIT: the command line used to ffmpeg encode was the same than you.

lstepnio
2nd December 2008, 14:28
I certainly appreciate you taking the time to take a look. I re-encoded using ffmpeg-r15966 on my window machine and the results sounds good.

If you don't mind me asking what did you use to gather the volume statistics you postedf? I would like to validate my encode in much the same way before I calibrate with the file.

Thanks again!


Well you are right about your ac3 volume samples, maybe the problem is your ffmpeg encoder version. With my FFmpeg version Sherpya-r14277 I obtain correct volume:

Your sample Your sample Your ffmpeg FFmpeg Sherpya-r14277
PinkNoise.wav PinkNoise_flac PinkNoise_ac3 PinkNoise_ac3
Statistics: ------------------- ------------------- ------------------- ---------------------
RMS power : 5.79% (-24.74 dB) 5.79% (-24.74 dB) 11.49% (-18.80 dB) 5.74% (-24.82 dB)
Average value: -0.93% (-40.59 dB) -0.93% (-40.59 dB) -1.87% (-34.57 dB) -0.93% (-40.59 dB)
Min value : -25.05% (-12.02 dB) -25.05% (-12.02 dB) -49.66% (-6.08 dB) -24.85% (-12.09 dB)
Max value : 23.94% (-12.42 dB) 23.94% (-12.42 dB) 48.39% (-6.30 dB) 24.09% (-12.36 dB)

Like you can see the flac file have exact volume than the wav file, your ac3 have double volume (+6 dB) and my ac3 encode have very similar volume to original wav.

EDIT: the command line used to ffmpeg encode was the same than you.

tebasuna51
2nd December 2008, 18:17
If you don't mind me asking what did you use to gather the volume statistics you postedf? I would like to validate my encode in much the same way before I calibrate with the file.

First you need decode the flac/ac3 to wav another time with a safe decoder method (I use NicAudio-Avisynth method but you can use also eac3to).

With wav files you can use many audio editors. These Statistics are from Wavosaur (http://www.wavosaur.com/) (free multichannel audio editor).

If you are Avisynth user there are a SoundOut plugin than offer a 'Analyze Sound' function without need to write the decoded audio file.

lstepnio
2nd December 2008, 18:38
Excellent, thank you!

First you need decode the flac/ac3 to wav another time with a safe decoder method (I use NicAudio-Avisynth method but you can use also eac3to).

With wav files you can use many audio editors. These Statistics are from Wavosaur (http://www.wavosaur.com/) (free multichannel audio editor).

If you are Avisynth user there are a SoundOut plugin than offer a 'Analyze Sound' function without need to write the decoded audio file.

For the record, the XP sound mixer needed to be in the maximum position for LPCM volume to match the levels with bitstreaming codecs to my receiver.

Thanks again!