The reason the FLAC is larger than the MP3 of the same data is because they encode differently. :) MP3 just encodes perceptual information, while FLAC stores every single speck of data, just in a more compact format.
- Converting a WAV to a FLAC is like converting a BMP to a PNG.
- Same exact pixels, but compressed losslessly like a ZIP file into a smaller size.
- Converting a WAV to an MP3 is like converting a BMP to a JPEG.
- Instead of storing exact pixels, it's really storing instructions for generating squares with ripples of color that look kind of like the original.
Similarly, MP3 just stores instructions for generating ripples that, when added together, sound kind of like the original. But the difference between the true signal and the generated signal (the error signal) consists of random noisy artifacts, like JPEG jaggies. When you then store this in a perfectionist format like FLAC, it needs to store all those jaggies, and random noise is harder to compress losslessly, so it increases the size of the file. (Truly random noise is incompressible. When you compress a file losslessly, you're eliminating redundant repeating patterns and making it look more like random noise.)
I bet if you convert the JPEG to PNG you will see the same kind of increase in size as you see when converting MP3 to FLAC, since the perfectionist lossless codec needs to remember every little jaggy and artifact that wasn't in the original bmp.
This analogy isn't perfect, since audio is more like a photo than a line-art diagram, but it helps get the idea across:
Original BMP size: 29 kB
PNG size: 629 B
JPEG size: 1.7 kB
PNG created from JPEG: 6.2 kB
Best Answer
Yes. You can do this. The technique is used by a number of programs and the levels are calculated by an algorithm called ReplayGain. Mp3 volume level data can be adjusted losslessly, just as a JPEG picture can be losslessly rotated.
There are two methods
From HydrogenAudio: Implementations:
The second method does alter your file, but because the underlying data is not modified it loses no quality, hence the adjustment can be done losslessly. It is not generally recommended for your main collection as it is modifying the files from their original state, but it can be very useful for portable media players.
A program called mp3gain can do the second option and reversibly adjust the volume of mp3s. It does absolutely no re-encoding and simply adjusts magnitude values in the mp3 file itself to change the volume. From HydrogenAudio: ReplayGain
Due to the way mp3 files are encoded the adjustment is limited to 1.5dB steps, which is usually enough to get close.
Foobar2k also includes this functionality and can apply the changes to the files.