Page 2 of 2
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 3:25 pm
by kozikowski
Bumper sticker version
So the original has very little energy over about 4KHz and and we are talking about a performance similar to an airplane pilot's voice. Most of the intelligence is conveyed through psycho-acoustic recognition rather than plain good quality. Also see: bad cellphone call with pieces missing and somehow a message manages to squeak through.
There is no rescue. All we can do is turn the damage into other damage.
Koz
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 3:50 pm
by Trebor
kozikowski wrote:What's the bumper-sticker explanation of that? ...
Here's the visual equivalent of before-after median filter ...
http://en.wikipedia.org/wiki/Median_filter
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 5:22 pm
by Robert J. H.
I've come up with something similar to Trebor's plug-in.
It uses linear prediction coding instead of de-whitening in the fourier domain ( ;O, what's this guy talking about?).
In other words, all streets lead to Rome.
The original is actually a bit more clipped. I've exported it to wave with a gain of 22 dB (!).
The filter has been applied after re-importing.
The code is:
Code: Select all
(defun pre-emphase (s) (snd-biquad s 1 -0.96 0 0 0 0 0))
(defun de-emphase (s) (snd-biquad s 1 0 0 0.96 0 0 0))
;; voice model extraction
(setf lpanal-class (send class :new '(sound framesize skipsize npoles)))
(send lpanal-class :answer :isnew '(snd frame-sz skip-sz np) '(
(setf sound (snd-copy snd))
(setf framesize frame-sz)
(setf skipsize skip-sz)
(setf npoles np)))
(send lpanal-class :answer :next '() '(
(let ((samps (snd-fetch-array sound framesize skipsize)))
(cond ((null samps) nil)
(t
(snd-lpanal samps npoles))))))
(defun make-lpanal-iterator (sound framedur skiptime npoles)
(send lpanal-class :new sound
framedur skiptime npoles))
(psetq blocksize 200; in samples
advance-by 50; in samples
order 10); modify at will
;; analyze:
(setf obj (make-lpanal-iterator (pre-emphase s)
blocksize advance-by order))
;; apply filter to original:
(de-emphase (scale-db -35
(snd-lpreson s obj (/ advance-by *sound-srate*))))
The values after "psetq" can all be changed.
(note that the code is only for mono files)
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 6:29 pm
by kozikowski
Here's the visual equivalent of before-after median filter ...
I agree you can do wonders with pictures whose information doesn't change that much pixel by pixel, but a greater similarity to this problem is motion video.
People have made "de-noisers" that trade off motion for the idea of averaging (or processing) successive frames whose information doesn't change that much. The result is gooie, swimmy, slippery motion that's completely noise free, or gritty, noisy perfect motion.
Free lunch being just out of grasp. The product never made the big time.
So we're trying to identify the damaged portion of the wave and reconstruct the missing bits by guessing what would have been there had the wave been allowed to continue on its journey? Given massive clipping, I'm not shocked that he reconstructed wave is 20dB higher than anyone is expecting. Also given massive clipping, the slope before and after the damage is less and less representative of the original voice. Also given this was an admittedly "seat of the pants" recording, the system/microphone analog noise will make this an interesting academic exercise with little or no practical value.
Koz
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 9:08 pm
by Trebor
kozikowski wrote: ... All we can do is turn the damage into other damage.
Yes but sometimes less psycho-acoustically offensive "other damage" is possible.
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 9:19 pm
by Trebor
Robert J. H. wrote:I've come up with something similar to Trebor's plug-in.
"Darrel Tam" created that plugin, not me, ...
www.kvraudio.com/product/dtblkfx_by_darrell_tam
Robert J. H. wrote:... all streets lead to Rome ...
What you've achieved with
that code sounds (and looks) just like increasing-contrast using the "DtBlkFx" plugin (which is Windows & Mac only). It's effectively like increasing contrast on the spectrogram.
[ NB: that "contrast" code can't cope with silence , if the audio you select includes proper flat-line silence the effect won't work and Audacity may crash ]
Robert J. H. wrote:...modify at will ...
IMO setting blocksize to 1000 (rather than 200) with a sample-rate of 16kHz, ( maybe just me though ).

- before-after spectrogram showing increased ''contrast''achived using Robert-J-H code.gif (118.19 KiB) Viewed 1328 times
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 10:01 pm
by Robert J. H.
Trebor wrote:Robert J. H. wrote:I've come up with something similar to Trebor's plug-in.
"Darrel Tam" created that plugin, not me, ...
www.kvraudio.com/product/dtblkfx_by_darrell_tam
Robert J. H. wrote:... all streets lead to Rome ...
What you've achieved with that code sounds (and looks) just like increasing-contrast using the "DtBlkFx" plugin (which is Windows & Mac only). It's effectively like increasing contrast on the spectrogram.
[ NB: that "contrast" code can't cope with silence , if the audio you select includes proper flat-line silence the effect won't work and Audacity may crash ]
(you mean my code?
Yes, it is a known bug, lpanal returns NAN values (division by zero) for all coefficients.
I forgot to mention that mixing in white noise helps a lot (amp. 0.001).
One can actually use white noise alone instead of the original.
A clean voice will sound whispered because the excitation is missing, whereas filtering a buzz, saw-tooth and alike sound supresses unvoiced parts--the famous robot effect.
The poles of the LPC (called "order" in the above code) determine the accuracy of the voice synthesis.
For 4 formants, the order should be twice plus 2 --> 10 poles. "S" and "Z" may require 300 poles to exactly reproduce them.
Re: Improving a voice recording with heavy clipping
Posted: Sun Oct 05, 2014 10:39 pm
by Alonshow
Thank you, Trebor, that improved the quality a bit. I was wondering though, if the de-clicking and de-crackling that you mention in the other median plugin thread would be useful in this case.
Re: Improving a voice recording with heavy clipping
Posted: Mon Oct 06, 2014 3:54 am
by Trebor
Alonshow wrote:Thank you, Trebor, that improved the quality a bit. I was wondering though, if the de-clicking and de-crackling that you mention in the other median plugin thread would be useful in this case.
Your "original.mp3" isn't clicking or crackling, so de-clicking and de-crackling software aren't going to help.
Even the paid-for de-noise programs I have don't make much difference to your "original.mp3".
The Nyquist code Robert-J-H came up with above, or the DtBlkFx plugin, is about the best you're going to get ,
less-noisy at the expense of sounding more-synthesised.
[ The audio recovery seen in Hollywood movies is science-fiction ].
Cutting off all the frequencies below 200Hz with the
equalizer makes it sound a little less harsh.
If you compare it with the codecs used in radio-telephony ,
like LPC10 and Speex, the computery-ness isn't that bad.