Is this possible in MP3Gain?

  • Shjarr

    First, congratulations for MP3Gain. It's an excellent program.

    Well, I'm not an audio tech. I'm only a MP3 enthusiast who likes to hear music at good quality.
    Also, I'm not a programmer and sometimes I think programmers have something especial in their brains, a kind of DNA mutation, since the wonders they can do :)

    The reason I wrote this message I will explain next. Usually, when I get the same MP3 song coming from different albums I get MP3s that have different sound quality. The same MP3 song sounds "clear" when it comes from one album but it sounds "poor" when it comes from another album. In fact, I can't put the blame on MP3s since the original songs on different albums are themselves different in sound quality.

    Maybe you are asking me: What is a "clear" MP3 and what is a "poor" MP3? My answer is that when I hear the same MP3 song coming from different albums and choose the "best" one, this "best" MP3 seems to have "more" mid/high frequencies than the others and the sound is clear. Of course, there are other things to evaluate: noise, clicks/pops (if it's an old song), some exaggerated frequencies (maybe caused by some weird equalization), etc. But those mid/high frequencies is a very good starting point (in my opinion).

    Maybe you will tell me this is not the right way to do that, there are many other things to evaluate, etc. etc. but this "not scientific, not professional and totally subjective method" works fine for me. It works like a suggestion not an ultimate decision.

    So I hear the MP3s and discard the "poor" ones to avoid duplicates in my collection. When I get only 2 MP3s of the same song it's easy to choose the "best", but sometimes I get many MP3s of the same song coming from many different albums. So it's very boring to hear the same song many times and choose the "best" one.

    I have tried to "automate" this task using EncSpot. It's a good software, but it seems to estimate the quality of a MP3 based on bitrate and other weird parameters. But the sound quality I'm talking about is not always related to bitrate, since sometimes I get excellent 128kbps MP3s and poor 320kbps MP3s of the same song.

    Some time ago I have posted a similar question in a forum. If I can remember, people there told me I have to use a spectrum analyzer software. If I'm not wrong, by using this kind of software I have to open each MP3 and observe some graphs to determine if there are more mid/high frequencies than the others MP3s. Well, it's not a good solution for me since it's not automatic and I think it's easier to hear each MP3.

    Few days ago I have read David Robinson's ReplayGain Theory. I suppose it's is the heart of your MP3Gain software. Of course, I didn't understand the most of his technical article, but if I'm not wrong I could see there is some kind of procedure to deal with different frequencies and calculate the average sound energy.

    This is what I really need. An average value of the sound energy of each basic frequency band (30Hz, 60Hz, ..., 16KHz) for each MP3 file. So here is my question to you: Is it possible to include such a feature in your MP3Gain software or maybe create another project to do this task? Of course, you would not mention the word "quality". It would be only an extra information for each MP3 file, nothing more. Each user would decide what to do (if so) with that information. It would be a kind of simple text table like this:

                 30Hz  60Hz  120Hz ...   4K      8K     16K
    File_1  XXdb  XXdb  XXdb  ...  XXdb  XXdb  XXdb
    File_2  XXdb  XXdb  XXdb  ...  XXdb  XXdb  XXdb
    File_3  XXdb  XXdb  XXdb  ...  XXdb  XXdb  XXdb

    Sorry if I'm being foolish. I'm talking about creating a new feature or even a new project as if this would be easy like to drink a cup of coffee. I'm sure it's not easy. I can imagine the hard work to create such things. But since your program have to analyze the frequencies of each MP3 (and it does so fast!) I think it would be possible to implement my idea like a new feature (or like an independent software).

    Well, this is my problem. Can you do those things?
    If it's possible or not, I want to thank you in advance for all attention to my question and excuse me for any inconvenience.



    • Sorry to tell you, but that won't really help you determine the quality of the mp3s.  If you want to ensure you're getting good-sounding mp3s then the best way to do that is to encode them yourself using a good encoder with good settings.  The latest version of LAME with "-V 2" as your only setting will probably be what you're after.  I could be wrong, but it sounds to me like you're trying to sort through downloads.  I wouldn't judge someone for downloading something, but if you don't know the encoder and settings used to create the mp3s then the only way you can really tell if one is better than the other is by listening.  Analyzing frequency data won't really give you an idea if one is better than the other.  More or less sound data at one or more frequency ranges doesn't necessarily indicate anything about the subjective sound quality.  If one mp3 has more data in the 16KHz range than another, it doesn't necessarily mean that it has better sound quality than the one with less data in the 16KHz range.  It's entirely possible that the one with less data there could have been made with a better encoder with better settings, and the reason it has less data in that range is because there was less important data there to be heard after passing through that encoder and its processing.  Maybe the one with more data in the 16KHz range just has more data there because it was made with an inferior encoder with an inferior psychoacoustic model, or who knows what else, and the extra data there is nothing but extra noise that you wouldn't notice anyway.  The better encoder could have recognized something like that and flagged a lot of the sound as inaudible and not worth encoding, and spent the extra bits somewhere else in the frequency range to make the overall sound better.  There can be all kinds of explanations for individual situations that would make a simple frequency range analyzation useless in determining sound quality of an mp3.

      If you want to know the quality, know the encoder, know the settings.  Otherwise, your ears are probably the best judge.  Best just to start with your own sources and do your own encoding so you know what was used and how it was used.

    • Shjarr

      Thanks for your answer.

      Let me explain better. First, I'm not downloading anything since the poor quality of the material available out there and good quality is very important to me. In fact, I'm converting my own collection of original CDs (and some old LPs) to MP3 so that I can hear them in portable devices, car, etc. I'm using EAC, Lame and MP3Gain in this process. They are all execellent softwares and help me so much.

      I have many albums like "<Artist> The Ultimate Collection", "The Best Of <Artist>", or "70s Classics", "The Best Of The 70s" etc. Frequently <Artist>'s hits appear in more than one album and have different sound quality and I have to choose only one (the best, of course). They have originally different sound quality and this is not related to encoder, bitrate, parameters I'm using. I have used EncSpot AFTER the MP3 convertion hoping it could help with quality issues, but it seems primarily to evaluate bitrate.

      Your answer sounds like I want to use frequency analysis to ultimately determine the sound quality. It's not true, I want to use it only as a starting point. Believe me, 90% of the MP3 files with more mid/high frequencies sounds better than the ones with less mid/high frequencies.

      Well, this is the problem. Is it very hard to include that feature in MP3Gain? I think this extra information will not hurt the reputation of your software. It's only an extra information, nothing more. You need to mention nothing about "quality". The user decides what to do with that information. Or maybe you could create another small program to do that.

      Please, can you help? You are my last hope.
      Thanks for your attention and patience.


      • Well, first, I don't have anything to do with mp3gain, other than being a user just as yourself.  Second, even comparing uncompressed originals, I still don't think frequency analysis is necessarily going to tell you anything definitive about sound quality.  While it would certainly tell you if one mastering job differs from another, I don't think you could really say which one sounds better by simply looking at the data you're talking about.  One mastering job could be absolutely horrible, but have more energy in the frequency range(s) that you look at, but still sound much worse than the other example.  I could be wrong, but I honestly don't think there's a simple way to do what you're after, other than actually listening.  There's more to comparing sound quality than simply having more volume in any given frequency range.  More isn't always better.  I've heard quite a few remastering jobs where the earlier CD release actually sounded better for various reasons.  These days, usually due to insane dynamic range compression and the clipping that comes along with it.  Maybe it'll have more bass or high-end, but that doesn't necessarily mean it'll sound better.

    • Shjarr

      Thanks for your answer.
      I thought you are the author of MP3Gain.

      All you have wrote is correct, but as I said berfore my idea would be only a starting point.
      Also, I'm based on my experience with my CDs and LPs. I could use my idea without any problems in 90% of the files.

      If I had a table like that I have mentioned, I could start hearing only the files who had more mid/high frequencies. Some <Artist>'s hits appears more than 10 times! As you can see, a pleasure becomes a torture.

      Or maybe that table could be used for helping a "non professional" equalization. I think it's better than equalization by hear.

      Well, since you are not the author of MP3Gain, can you tell me how can I contact the author?

      • A thought occurs...while not automated, you could probably accomplish what you want using Audacity and a spreadsheet.  If you load up a file in Audacity, and then Analyze->Plot Spectrum, there is an Export button there that gives you a text file containing data like this:

        Frequency (Hz)    Level (dB)
        86.132813    -26.565535
        172.265625    -24.651737
        258.398438    -26.807650
        344.531250    -30.490242

        You could compare that data easily enough, I would think.  Could even just run two copies of Audacity and look at that plot window for two files at the same time, for that matter.  Like I say, it's not an automated routine, but it will let you look at the data you're after.  Best done on non-compressed original data before you encode to mp3.

    • Glen Sawyer
      Glen Sawyer

      I'm the author of MP3Gain. "shorty-dammit" always seems to respond to messages on this MP3Gain Help forum faster than I do, so I usually end up feeling like I don't need to add to his already excellent answers. (Thanks again for that, by the way!)

      The current MP3Gain code does _not_ individually analyze the various frequencies. What it does is run the audio through a pre-computed EQ filter in order to emphasize or de-emphasize particular frequencies as described in David's ReplayGain algorithm.
      So although I do understand what you're looking for, it would not be a simple change to the existing MP3Gain code. Sorry.


    • Shjarr

      I heard about Audacity some time ago. It seems to be an excellent audio software.
      I didn't know it has a spectrum analyzer with text output.
      Your idea is very interesting. I will try it.
      Do you know if those db level values are peek or average values?

      Maybe I will contact Audacity authors if they can help me and implement something related to my question. Any problem mentioning this thread here?



        "Note that currently only the first 23.8 seconds of selected audio can be analyzed. "

        So, that could reduce its suitability for your use.  Or not.  At any rate, everything on sourceforge is open source, free to use, free to discuss. ;)

  • ptfitzy

    shjarr, I was going over the Help Site of MP3 Gain and saw your question. I am not recording my Vinyl to MP3. However, I burn my MP3's as well as converting them to "WAV Files". I use a Program called "MP3 CD Burner". As a matter of fact, I learned about "MP3 Gain" from "Acoustica", the maker of "MP3 CD Burner". It's not free but is cheap with lifetime upgrades. It also let's you try it out. When I burn a CD on "MP3 CD Burner", I try to get them all to sound close to the same, as if they  were from the same Album. MP3 CD Burner has an equalizer as well as a "Volume Level" you can use on those songs that were originally recorded at a much lower volume. I right click on the song and bring up "Adjust song/Boost Equalizer" as well as sometimes manually adjusting the "Equalizer" on songs. It also has an "Adjust Trim and Fades" on MP3's. It's very user friendly. I am now just learning to use "MP3 Gain" and had a couple questions for "snelg" because I'm confused on a couple things. Also, can "LAME" actually make a poor sounding MP3 sound better?

  • mp3 is lossy.  Once you encode with a lossy codec, you cannot get back what was lost.  You can make it sound different, but you can't make it sound the same, nor better.  In fact, encoding an mp3 into another mp3 only means more loss, in addition to what was lost the first time.  Same thing that happens when you dub a tape over and over.  The 10th generation dub will not sound better than the original, no matter how much better the tape deck used to make it was than the tape deck that made the 2nd generation copy.

  • ptfitzy

    To Shorty:
    Reference converting to LAME, I didn't think you could make an MP3 sound any better. I was told that no mattr what you convert the MP3 to, you are only changing it, and cannot make it better.
    I am new to MP3 Gain. I've posted a couple questions I had and "snelg" answered my first question. I sent him one more question to him. I kind of feel like a Pest. Maybe you could possibly answer it for me. I posted it on 1-11 in the "Help" Forum. It is my 2nd question listed as Number 3.
    Thanks, ptfitzy

  • That's correct.  mp3 looks at the audio and throws away the parts that you shouldn't be able to hear.  Running that result through mp3 again does the same thing, only this time it throws away more stuff on top of the first stuff that was thrown away.  So you're losing quality every time.  It's likely only the first mp3 will sound good, though that will depend on the listener's ears.  I'll go look for the other post.