Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: MP3 encoding -> silence at the begging , possible correction? (Read 3752 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

MP3 encoding -> silence at the begging , possible correction?

Hello, I'm from Argentina. I'm investigating about the differences between FLAC and Mp3.
The way i'm trying to compare both is: first, get a FLAC file. Then enconde the FLAC to Mp3 at 320 with the last version of LAME using "foobar" and then import both files with Audacity and invert the phase of the Mp3 wave, to see and listen the RESULTANT WAVE that should have the lost frequencies while encoding the FLAC file to Mp3.

The PROBLEM is that the MP3 file contains something called gapping or padding created by the encoder LAME, which is explained in LAME's FAQ (http://lame.sourceforge.net/tech-FAQ.txt) and it seems very difficult to sync the two audios perfectly.

So what i did, was to open the MP3 file in Cool Edit Pro as to see, with a very close zoom , at what sample number the silence finishes, and then cut it out  in Audacity. The reason i used the Cool Edit Pro was because i could see the wave samples (points) more accurately.

After doing this, i could see in Audacity both waves perfectly sincronized according to what i could see (with max zoom) of Audacity's reproduction of the wave.

So then i can invert the Mp3 wave and save the resultant wave of the Mp3 inverted and the FLAC as .wav ,that should be the lost frequencies. It seems to be this way, because i tried opening the Mp3 wave (with the silence correction i did before) and the resulting .wav ,and when they are played together it sounds like the FLAC.

But I don't know if this silence correction i'm doing ( looking at the wave in the Cool Edit Pro and then go to the Audacity) is perfect perfect, because it could be a ONE SAMPLE difference between both and that's a lot  in the resulting wave.
I was reading that you can see how much time/samples of silence are added by the mp3 encoder in the metadata, but i don't know how to see it! I only can see the id3 tags and so...
I would be very thankful if you could help me.

MP3 encoding -> silence at the begging , possible correction?

Reply #1
I'd suggest just converting the LAME MP3 back to some lossless format with some decoder which can interpret the LAME enc_padding and enc_delay tags. So, using foobar this would easily be "Convert sourcefile to MP3 using LAME, convert the resulting file back to WAV using foobar." Now do your magic with the resulting file and the source.

The "missing frequencies" are probably due to the MP3 encoder's lowpass filtering, also you probably won't hear anything significant, mostly noise.

EDIT: Tried it myself for some random audiofile using Audacity and using -V2 as LAME quality setting. I can only plot the spectrum for some 20ish seconds, but I get about -81dB noise at low frequencies going up to -60dB at 1kHz, and then gradually declining to -90dB at 15kHz and then a jumping  back to -84dB at 16kHz, all using a Hamming window:
It's only audiophile if it's inconvenient.

MP3 encoding -> silence at the begging , possible correction?

Reply #2
Hey Kohlrabi, thank you! it worked on this way.
Now, i can be sure that they are spliced together perfectly.

I think you know why I'm inverting the phase of the other, but just in case I explain... If I play a wave and the same wave with its phase inverted, what i get is silence. So the same with this two audio files, the FLAC and the FLAC encoded to mp3, the result will not be silence but the missing frequencies instead.

Forgive me if you knew it but you told me that now I was able to do my "magic" and it was just that simple proceeding.

This is what i got from the resulting file (flac+mp3 inverted), comparing a song in FLAC and MP3@320 (mp3 converted back to wav, but the same thing)



Thank you again!! and tell me , do you feel differences between them? Because I used to feel the difference between 128 and 320 in mp3 a years ago, and comparing a .flac's song with the same song I downloaded years ago it's a great difference.
But now that I worked from the same original file and the last version of LAME for encoding it's very difficult to notice the difference!!! it should have progress a lot the mp3 compression codecs.

MP3 encoding -> silence at the begging , possible correction?

Reply #3
You should know that when it comes to determining how mp3 works and judging its sound quality, the exercise in which you are currently engaged is absolutely worthless.

MP3 encoding -> silence at the begging , possible correction?

Reply #4
I suspect that isn't the best way to note the quality of the compression but to see what information i'm loosing.

And I see as good point the fact that i can activate and desactive this missing frequencies running the mp3 song as to see changes.


MP3 encoding -> silence at the begging , possible correction?

Reply #6
Well , comparing with the original file, there are no "missing" but not the same amount in the higher frequencies. And in the resulting wave i can hear noise mostly beacuse it has no sense hear it alone but i can hear the structure of the song.

MP3 encoding -> silence at the begging , possible correction?

Reply #7
Quote
I think you know why I'm inverting the phase of the other, but just in case I explain... If I play a wave and the same wave with its phase inverted, what i get is silence. So the same with this two audio files, the FLAC and the FLAC encoded to mp3, the result will not be silence but the missing frequencies instead.
  Of course, you can find the mathematical differences between two files, but that doesn't tell you much about the audio differences and it doesn't tell you what frequencies/information were "thrown away".

For example, adding a delay or inverting the phase will create a mathematical difference that will show-up when you subtract the two files, but it won't change the sound and no data is "lost" by introducing a delay or phase shift.

If I understand it correctly, MP3 compression involves a Fourier transform (time-domain to frequency-domain) and this means that the timing/phase are not precisely preserved. 



......It might be more interesting for a programmer to re-write the LAME encoder so that it creates an audio file that contains the information that was thrown-away.  We might be surprised how little information is actually thrown-away (at high bitrates).



MP3 encoding -> silence at the begging , possible correction?

Reply #8
Oh, I guess I got you, I'm not comparing the sound differences.
But what do you tell me about running the mp3 and turning on and off the resulting subtracted wave? When turned on it should sound as the FLAC, and when muted it is the mp3 alone. Isn't it a close way to compare them?


MP3 encoding -> silence at the begging , possible correction?

Reply #10
I keep reading man! thank you 

MP3 encoding -> silence at the begging , possible correction?

Reply #11
Well, if someone plays a song 20 times , one in mp3 and the other without compression , I really think you'll never have a clear decision...

I think that if you're used to listen uncompressed audios, then you will feel that's something missing when listening to a compress one. And I'm talking about taking a moment for listening to music with headphones or an excellent audio system, not cooking or reading..

I would like to see a complete analysis of this, and I thought was there wasn't more clear than sustract the waves (that are supposed to generate the sound) I know that mp3 has differents algoritms that doesn't represent exactly the wave, I was told that the very high frequencies are more difficult to sample because you have to take a lot of samples there, and that is lost. I'm not against mp3 compression, I LIVE listening to mp3.

 

MP3 encoding -> silence at the begging , possible correction?

Reply #12
The idea that you need an excellent system to help you determine the difference between lossy and lossless is largely a myth, though headphones and concentration certainly do help.

Make sure you re-read our Terms of Service, to which you agreed upon registering in order to participate on the forums here at Hydrogenaudio.

Please pay special attention to #8; it spells out what is and what is not required to assess the sound quality of lossy codecs.

The approach you have taken in this thread is not correct.

This discussion is now closed.