AudioMasters
 
  User Info & Key Stats   
Welcome, Guest. Please login or register.

Login with username, password and session length
April 24, 2008, 04:35:20 PM
64170 Posts in 6427 Topics by 2338 Members
Latest Member: bobs23
News:   | Forum Rules
+  AudioMasters
|-+  Audio Related
| |-+  General Audio
| | |-+  Mp3 quality restoration?
  « previous next »
Pages: [1] 2 Print
Author
Topic: Mp3 quality restoration?  (Read 1213 times)
« on: January 07, 2008, 05:20:11 PM »
ZergFood Offline
Member
*****
Posts: 8



Recently I have been looking forward to some filter or application that can remove some of the mp3 quality artifacts (like the "flanging" effect). I do not own the original uncompressed waves, as most of the mp3s are purchased from stores.

Don't get me wrong, I understand that it is impossible to exactly reconstruct the original wave, and I'm not even interested in going that far; I understand any kind of software/filter/technique for this job would have to "guess" how the original audio would have sounded like, and I'm fine with that.

What I need is any advice (or even link to some software that takes some mp3 sound, not necessarily in mp3 format, I can convert from mp3 to wave, no problem, of course without improving the quality), and then use some kind of filter or combination of complex algorithms to "try" to get rid of the mp3 compression artefacts (i.e that annoying "flanging" effect). Speed is not critical: the software/filter could as well "restore" and improve the quality of a 1 minute music file in an hour (that is, 1 hour for a minute), it really doesn't concern me that much.

Most so-called mp3 "improvers" (e.g DFX plugin for Winamp) available don't really improve the "mp3" quality, they only add surround just to make it "cooler", but the flanging effect is still there (and in fact much more annoying in surround mode), or simply boost up some frequencies. This improves the overall quality, but it's not what I want. I'm not interested in surround-ing my music or boosting up frequencies: that is a simple task. I'm interested in getting rid of all mp3 artefacts (like the flanging effect), so it sounds more like a real wave, instead of mp3-compressed music. (again I'm not asking for a 100% reconstruction, I understand such software will have to guess a lot).


Now I understand there could be difficulties in understanding what the "flanging" effect is, so here's my best try at explaining it.
The "flanging" effect is similar to that produced by similar filters in Cool Edit/Audition, SoundForge and just about any program. It is not present all the time however. Usually it has the most impact on drums and hits (where they sound like a sweeping, vibrato effect). It's not a simple frequency that needs to be isolated and removed (aka noise), it's more like a changing frequency over time (sort of like a fluid, vibrato effect). I do not know how I can better explain this, but here's a tip (don't know how well it turns out): take a hit, or a simple drum, and add some "flanger" effect (most audio software has something like that), with a certain frequency (not too high however, something along the lines of 5 Hz, i.e five sweeps per second) but do not make the effect too strong as it will be exaggerated!

I have been told Magix Samplitude 10 has a "Brilliance Enhancer" filter that is designed to improve mp3s. However the filter, like DFX, improves the high frequencies of the sound -- which is not what I am looking for. I am interested in getting rid of the flanging.

Because I had no control of the encoding process (since the mp3s aren't created by myself, like I said), I have no way of telling whether they encoded it properly or not.

Obviously, once I get rid of the flanging, I will not re-encode them in mp3 as that will only get me where I started. Instead, I take some mp3s, fix their quality, and keep the result uncompressed (in case anyone has some doubts).

So then if anyone has experienced something like this before, and knows any advice or trick to get rid of the flanging (i.e something like a "anti-flange filter", just like "noise reduction" gets rid of noise, this one should get rid of flanging), I would be very grateful to hear it.
Logged
Reply #1
« on: January 07, 2008, 05:30:46 PM »
ryclark Offline
Member
*****
Posts: 357



I very much doubt that you will have any luck finding anything that can undo those sort of effects. I was probably caused by level and frequency dependant filters that are steered by the content when the mp3 compression was done. It is virtually impossible to be able to remove artifacts that vary with time.
Logged
Reply #2
« on: January 07, 2008, 07:35:58 PM »
Graeme Offline
Administrator
Member
*****
Posts: 1882

WWW

I agree with ryclark - I think you are on a loser.

There's no way you are going to 'improve' MP3 files - which is why few of us here have much to do with them.
Logged

Reply #3
« on: March 14, 2008, 09:41:17 AM »
BFM Offline
Member
*****
Posts: 878



ZergFood, excellent question, and a solution would be very useful for a LOT of people working in digital audio today. To get anywhere near a solution we would need to ask the people who have a good understanding of how MP3 encoding works - people who are directly involved in the development of MP3 encoders, and I don't think there's anyone like that around here. Here's a beginning to your quest http://en.wikipedia.org/wiki/MP3 with plenty of starter leads .. I hadn't realised before that Philips developed the MP3, they also pioneered the cassette and the CD!
Logged
Reply #4
« on: March 14, 2008, 10:23:34 AM »
SteveG Offline
Administrator
Member
*****
Posts: 8539



To get anywhere near a solution we would need to ask the people who have a good understanding of how MP3 encoding works - people who are directly involved in the development of MP3 encoders, and I don't think there's anyone like that around here.

You don't have to be a developer to have a good understanding of how perceptual coding works. For my IOA diploma I did a research project into lossy coding mechanisms for accurate acoustic data storage, so I have a pretty good idea, thank you.

But the wiki article is quite useful, because it pretty much identifies the OP's problem, and indicates why there is no solution available. This is part of the limitations section:

Quote
Time resolution can be too low for highly transient signals, may cause some smearing of percussive sounds although this effect is to a great extent limited by the psychoacoustical properties of the Musicam polyphase filterbank (Layer II). Pre-echo is concealed due to the specific time-domain characteristics of the filter.

Due to the tree structure of the filterbank, pre-echo issues are made worse, as the combined impulse response of the two filterbanks does not, and can not, provide an optimum solution in time/frequency resolution.

The combination of the two filterbanks creates aliasing issues that must be handled partially by the "aliasing compensation" stage, but that create excess energy to be coded in the frequency domain, thereby decreasing coding efficiency

Frequency resolution is limited by the small long block window size, decreasing coding efficiency

No scale factor band for frequencies above 15.5/15.8 kHz

It is a combination of the above limitations, which are inherent in all perceptual coding schemes, which make percussive sounds with extended frequency ranges (like cymbals) sound particularly bad. Whilst some of the effects can be masked slightly more in some coders (like LAME), the combination of them will always have major artefacts. You can't 'filter them out', because it's the filters in there that are causing the problems in the first place... You simply can't cancel out the effects of a filter, because information is missing as a result of it, so you don't know what to replace, and have nowhere to replace it from. And it's missing information (that gives the coding gain) that causes MP3s to be what they are anyway - much smaller than the 'equivalent' uncompressed file. But with MP3s the problem is worse still, because it's not the result of a single filter that causes the problem, but a lot of them - like all of the critical band filters.
Logged

Reply #5
« on: March 14, 2008, 09:44:32 PM »
MusicConductor Offline
Member
*****
Posts: 1368



Last month I hooked up a Yamaha receiver and spent a little time looking at the features in the manual.  It has so much DSP on it that a "pure" playback takes a certain amount of attention to achieve. 

One of the DSP modes is for "compressed music playback" to restore fidelity lost through mp3 compression.  As best I can tell without a digital capture and comparison (which wasn't possible), all it does is add EQ to the bass and tweeter range.  Yep, boom and sizzle, the answer to the world's problems.

That information was very useful, Steve, and hopefully others will understand it and see why "fixing" compression artifacts is futile.  At least until coding noise and losses are addressed directly.  And that seems pretty impossible.
Logged
Reply #6
« on: April 12, 2008, 10:34:45 PM »
ZergFood Offline
Member
*****
Posts: 8



Yes I understand why getting the original uncompressed result 100% is futile (but not impossible, 'guessing' can do it). After all, I program compression algorithms myself (of the lossless kind, those that lose no data, like .zip for example). But I did not even expect the original result -- I wanted a way to 'smooth' out the flanging effect.

For example, I'm pretty sure we do not have anything like this yet, but a Neural AI system "could" be able to smooth out such artifacts -- just as some humans could do it with their minds, a neural system would work similarly (basically feeding it with a lot of uncompressed examples to create the neural network, then using it for signals to see how well it performs). Something like this seems practical, and no doubt perhaps I do not even know if it exists.

Thanks everyone for their replies.
Logged
Reply #7
« on: April 13, 2008, 01:52:30 AM »
SteveG Offline
Administrator
Member
*****
Posts: 8539



Yes I understand why getting the original uncompressed result 100% is futile (but not impossible, 'guessing' can do it).

Sorry, but that's just a contradiction in terms. To restore the original simply couldn't be based on a 'guess'. This wouldn't be restoring anything!

Quote
For example, I'm pretty sure we do not have anything like this yet, but a Neural AI system "could" be able to smooth out such artifacts -- just as some humans could do it with their minds, a neural system would work similarly (basically feeding it with a lot of uncompressed examples to create the neural network, then using it for signals to see how well it performs). Something like this seems practical, and no doubt perhaps I do not even know if it exists.

It doesn't exist, and it can't. All music is different, and no amount of feeding previous examples of anything into a system will help in the slightest with resurrecting something that it hasn't ever heard before. The problem is conceptually the same as applying a high cut filter to audio - what's left doesn't necessarily tell you anything about what is missing, and so applying a formulaic approach, which is what high frequency enhancers do, will increase the brightness, certainly. But replacing what was there before is nowhere in it - this sort of system doesn't do it, because it can't.

And the problem with MP3s is even more complex - because what is missing is low-level information across the entire audio frequency band. And with low bitrate MP3's, that is what causes the 'flangy' sound. What the masking system throws out is based on a complex algorithm which, to undo accurately, would require knowledge of what was thrown out - and since this is not predetemined, it can't be un-determined again. And if you don't replace this accurately, (which implies an accurate estimate of the complex phase change that has occurred) then you still end up with phasing effects. And if you get it wrong, as you inevitably would, then there's a good change that the flanging effects will get worse, not better.
Logged

Reply #8
« on: April 13, 2008, 12:40:08 PM »
ZergFood Offline
Member
*****
Posts: 8



Sorry, but that's just a contradiction in terms. To restore the original simply couldn't be based on a 'guess'. This wouldn't be restoring anything!
Mathematically, any signal 'x' with a certain quantization (i.e discrete signal) can be "guessed" with a certain chance (percentage), but albeit it would be extremely unlikely, but not impossible. Statistically, this means "prediction" actually, but it's the same thing -- of course this is theoretically, because the chance is so low that practically it's not even worth it Wink
Logged
Reply #9
« on: April 13, 2008, 01:41:39 PM »
SteveG Offline
Administrator
Member
*****
Posts: 8539



Mathematically, any signal 'x' with a certain quantization (i.e discrete signal) can be "guessed" with a certain chance (percentage), but albeit it would be extremely unlikely, but not impossible.

If you are only considering a linear interpolation, you can guess/predict where missing steps might be, but when you throw away non-linear low level information, you have NOTHING to base that prediction on.

So, impossible it is, I'm afraid. Can't be any other way. So please stop trying to claim that it is, because it demonstrably isn't.  Which, of course, is why nobody's ever done it. The algorithms used for coding gain in MP3 files don't listen to the content of the music, so you can't undo the effect at all. All they do, for this purpose, is to look at the relative levels of signal in adjacent critical bands, and alter the bit depth in the bands that they determine are 'masked'. And this loses the lower level information in those bands completely.
Logged

Reply #10
« on: April 13, 2008, 04:24:49 PM »
zemlin Offline
Member
*****
Posts: 2803

WWW

I have to agree 100% with Steve here.
There are ways to put some additional HF harmonics into a recording, but it isn't any sort of "restoration" - it isn't recovering lost information - it's just creating new harmonics that might make something sound a little better.  You can create those harmonics regardless of whether they were in the original or not - and there's no way of knowing either way.

JPG compression also throws away a lot of material - hugely reduces the number of distinct colors used in an image and throws away a lot of small details.  JPG artifact reduction simply tries to recognize patters common to JPG compression and smooth them over to make them less noticeable.  It cannot "recover" anything lost in the original compression - it simply tries to hide the damage that was done in the compression process.

That's the best you can hope for in "restoring" an MP3.  My experience with JPG artifact reduction is that it usually doesn't help much - the image just looks bad in a different way than it did before.
Logged

Reply #11
« on: April 16, 2008, 12:53:11 PM »
ZergFood Offline
Member
*****
Posts: 8



If you are only considering a linear interpolation, you can guess/predict where missing steps might be, but when you throw away non-linear low level information, you have NOTHING to base that prediction on.
But linear interpolation (or for that matter any kind of polynomial interpolation) is only a fraction of whatever algorithms can be used -- there are certain papers for 'chaos' theory (also called random interpolation) that perform better than polynomial interpolations, but those still don't recover the original signal (unless of course the original signal is exactly the way the model predicts it). Theoretically, every signal can be recovered with a given model; but the chance of it is very, very small -- thus not practical.

Don't get me wrong, I was not saying that something like that would be practical at all -- merely pointing out that, in theory at least, it is not impossible -- but very, very improbable (so that we 'practically' say impossible).
Logged
Reply #12
« on: April 16, 2008, 01:09:39 PM »
zemlin Offline
Member
*****
Posts: 2803

WWW

IF you had the original material, it would probably be possible to write code that would restore damaged audio to it's original state, but you would have to have the original recording as reference - otherwise there would be NO WAY of knowing what was lost in whatever process caused the damage, thus no way of knowing what to regenerate.

and if you have the original file, what's the point - unless you're just looking for a puzzle to solve.

Without access to the original recording, I'd be inclined to say that it truly would be impossible - or about as likely as great literature coming from a room full of monkeys on typewriters.
Logged

Reply #13
« on: April 16, 2008, 04:29:21 PM »
SteveG Offline
Administrator
Member
*****
Posts: 8539



(unless of course the original signal is exactly the way the model predicts it).

Well, since no two audio signals of the type you'd wish to recover are identical - either temporally or spatially - then the best your model could ever hope for was to work once. The chances of this happening are about the same as being able to create the model in the first place...

Let's just call that impossible - in this the best of all possible worlds, shall we?
Logged

Reply #14
« on: April 16, 2008, 09:57:32 PM »
Wildduck Offline
Member
*****
Posts: 546



Not to say I believe what I'm saying, but just to enter the discussion, didn't the OP imply that he wanted to research whether it might be possible to write software that would learn artefacts with a view to removing them.
This isn't the same as restoring the original, in fact it's really the opposite, but with the aim of removing nasty noises rather than adding what isn't there to build them back to the original.

The family member who is the expert on neural networks is out of the country, so I can't ask his opinion on whether this might be slightly possible.

Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS! Ig-Oh Theme by koni.