|
View:
New views
19 Messages
—
Rating Filter:
Alert me
|
|
|
Digital ClippingI was trying a technique to smooth out the sharp edges
in digital clipping to try to reduce aliasing. Now, say given the samples s1, s2 , s3, with the s3 clipping i know that the clipping usually occurs somewhere in between s2 and s3, so i used the numerical derivative of s2 to calculate this clipping point. Then i created a cubic spline curve thats stems from s1 to the clipping point, keeping the derivative of s1 the same, and the derivative of the clipping point set to 0. I then used this cubic spline to calculate s2. However this didnt reduce the aliasing. I thought maybe it didnt because the cubic spline is not bandlimited. So i created a bandlimited spline curve like this: a*sin(m*x) + b*cos(m*x) + c*cos(2*m*x) + d*sin(2*m*x) To calculate these coeffecients i just used matlab where its goes from 0 to x0(the clipping point) where y1=s1 and y2=(1 or -1) depending which side its clipping on, and yy1=derivative at s1, and yy2=0 m = pi/(2*x0); f = a*sin(m*x) + b*cos(m*x) + c*cos(2*m*x) + d*sin(2*m*x); g = diff(f); S = solve(subs(f,0)-y1,subs(f,x0)-y2,subs(g,0)-yy1,subs(g,x0)-yy2,a,b,c,d); Then i do something similar for when it leaves clipping also. However doing all this didnt seem to reduce the aliasing and when the overload is very low the aliasing seems to be worse too using this techinique. any thoughts on ways to improve this or what im doing wrong? Thanks, paul -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital Clipping> Then i do something similar for when it leaves > clipping also. > However doing all this didnt seem to reduce the > aliasing and when the overload is very low the > aliasing seems to be worse too using this techinique. > any thoughts on ways to improve this or what im doing > wrong? > Hi Paul, To answer your question directly, there is, I believe, no way to reduce the aliasing distortion caused by clipping. Alias, once happened, can't really be removed. I get the feeling from your post that you'd like to exchange the clipping for soft saturation, which emphasises the lower harmonics more. I believe you could simply use any soft saturation waveshaping on an already clipped signal as long as the soft saturation has a clipping point identical or lower than in your clipped signal. This would "smooth out" the square edges caused by clipping, but would not, I believe, reduce the aliasing. It could however make it sound more pleasant. Then there's clipping restoration which is an entirely different kettle of fish. I believe the common method to de-clip overloaded signal is to assign a certain treshold above which the signal is assumed to be incorrect. For digitally clipped signals, just the minimum and maximum signal values suffice. Then all these "invalid" values are thrown out of the window and some heuristic method is used to guess what the sample values actually were before clipping. An obvious solution would be to fit a lagrange polynomial to the nearest N valid sample points and sample the values of the polynomial for clipped signals. You will need to reduce the output level also since the polynomial will almost certainly exceed the minimum and maximum values. I also seem to remember somebody using a spectral technique to fill out the "holes" in the signal. The details escape me, but I guess one could try to keep the spectral effect of the invalid region as small as possible. Hope this helps, Vesa -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingMaybe http://www.cutestudio.net/ is worth to look at and to test for declipping?
Uli -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingThanks for your reply, well im not trying to reduce
the alias after the signal has been clipped(which is what the waveshaping stuff does) instead i have the unclipped version of the signal so there is no need to de-clip it etiher, but what i would like to do is hard clip this signal in a way that would reduce aliasing that is caused, or at least reduce the aliasing into a manageable bandwidth where i would just need to upsample by say 3, or 8 or something like that. I can reduce the aliasing a little bit now by upsampling but to really reduce it more i would need to upsample a lot well over 100, which is not reasonable for real-time processing(since it will be used in conjuction with other processing). I could use waveshaping but i would like the signal to be completly untouched when its not clipping, and then when it is clipping it adds the colorations to the sound. thanks, paul --- Vesa Norilo <vesa.norilo@...> wrote: > > > Then i do something similar for when it leaves > > clipping also. > > However doing all this didnt seem to reduce the > > aliasing and when the overload is very low the > > aliasing seems to be worse too using this > techinique. > > any thoughts on ways to improve this or what im > doing > > wrong? > > > Hi Paul, > > To answer your question directly, there is, I > believe, no way to reduce > the aliasing distortion caused by clipping. Alias, > once happened, can't > really be removed. I get the feeling from your post > that you'd like to > exchange the clipping for soft saturation, which > emphasises the lower > harmonics more. I believe you could simply use any > soft saturation > waveshaping on an already clipped signal as long as > the soft saturation > has a clipping point identical or lower than in your > clipped signal. > This would "smooth out" the square edges caused by > clipping, but would > not, I believe, reduce the aliasing. It could > however make it sound more > pleasant. > > Then there's clipping restoration which is an > entirely different kettle > of fish. > > I believe the common method to de-clip overloaded > signal is to assign a > certain treshold above which the signal is assumed > to be incorrect. For > digitally clipped signals, just the minimum and > maximum signal values > suffice. > > Then all these "invalid" values are thrown out of > the window and some > heuristic method is used to guess what the sample > values actually were > before clipping. An obvious solution would be to fit > a lagrange > polynomial to the nearest N valid sample points and > sample the values of > the polynomial for clipped signals. You will need to > reduce the output > level also since the polynomial will almost > certainly exceed the minimum > and maximum values. I also seem to remember somebody > using a spectral > technique to fill out the "holes" in the signal. The > details escape me, > but I guess one could try to keep the spectral > effect of the invalid > region as small as possible. > > Hope this helps, > Vesa > > > -- > dupswapdrop -- the music-dsp mailing list and > website: > subscription info, FAQ, source code archive, list > archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
|
|
|
|
|
|
Re: Digital ClippingOn Fri, Jun 13, 2008 at 7:53 PM, paul Fultz <pfultz2@...> wrote:
> I was trying a technique to smooth out the sharp edges > in digital clipping to try to reduce aliasing. Now, > say given the samples s1, s2 , s3, with the s3 > clipping i know that the clipping usually occurs > somewhere in between s2 and s3, so i used the > numerical derivative of s2 to calculate this clipping > point. Then i created a cubic spline curve thats stems > from s1 to the clipping point, keeping the derivative > of s1 the same, and the derivative of the clipping > point set to 0. I then used this cubic spline to > calculate s2. However this didnt reduce the aliasing. > I thought maybe it didnt because the cubic spline is > not bandlimited. So i created a bandlimited spline > curve like this: > > a*sin(m*x) + b*cos(m*x) + c*cos(2*m*x) + d*sin(2*m*x) > > To calculate these coeffecients i just used matlab > where its goes from 0 to x0(the clipping point) where > y1=s1 and > y2=(1 or -1) depending which side its clipping on, and > yy1=derivative at s1, and yy2=0 > m = pi/(2*x0); > f = a*sin(m*x) + b*cos(m*x) + c*cos(2*m*x) + > d*sin(2*m*x); > g = diff(f); > S = > solve(subs(f,0)-y1,subs(f,x0)-y2,subs(g,0)-yy1,subs(g,x0)-yy2,a,b,c,d); > > Then i do something similar for when it leaves > clipping also. > However doing all this didnt seem to reduce the > aliasing and when the overload is very low the > aliasing seems to be worse too using this techinique. > any thoughts on ways to improve this or what im doing > wrong? > Thanks, > paul > If it's soft clipping you're looking for, I've used a piecewise soft clipping function before that worked quite well. Below a certain threshold I use the original value, but above that threshold I use an asymptotic function such as a hyperbola. That way signals that aren't near clipping will be unaltered, and signals that are near clipping will only be minimally altered. If you know that the input signal will never exceed a certain value, then you can use a polynomial, sine, or other function that intersects with the transition point, has a slope of one at that point, and has an output of 1 for your known maximum input. For example, below an absolute sample value of 0.75 * full scale, the original signal is passed (i.e. y = x). Above that threshold, a hyperbolic function with a horizontal asymptote of 1 is used, adjusted so that it has a slope of 1 at the transition point from linear to hyperbolic. I don't know if the technique has a name as I didn't research it before I wrote the code, but I'm sure that others have done something similar. You may also just want to try using an ordinary lookahead compressor/limiter to bring down the peaks and bring up the rest of the signal. Mike Bourgeous -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
|
|
|
Re: Digital ClippingYeah.. I agree, this clipper is not a cubic function, it's a piecewise
function of which the middle segment is cubic. In my experiments you need 16x oversampling to avoid significant aliasing with this particular clipping function. Cheers Ross. ----- Original Message ----- From: "Bogac Topaktas" <bogac@...> To: "A discussion list for music-related DSP" <music-dsp@...> Sent: Monday, June 16, 2008 9:31 AM Subject: Re: [music-dsp] Digital Clipping >> .but the soft Clipper here is a discontinuous function. >> >> Wouldn't that make the 3 factor somewhat overoptimistic? > > Sure. My "-at least-" emphasis was referring to that optimism. > > > -----Original message----- > From: andy butler akbutler@... > Date: Sun, 15 Jun 2008 06:06:08 -0700 > To: music-dsp@... > Subject: Re: [music-dsp] Digital Clipping > >> > >> > For instance, if you are employing cubic soft-clipper as waveshaper >> > then the bandwidth expansion >> > is limited to a factor of three.Therefore you need to upsample by -at >> > least- a factor of three in order >> > to avoid aliasing: >> > >> > http://ccrma.stanford.edu/~jos/pasp/Cubic_Soft_Clipper_I.html >> >> .but the soft Clipper here is a discontinuous function. >> >> Wouldn't that make the 3 factor somewhat overoptimistic? >> >> >> >> andy butler >> >> >> >> >> -- >> dupswapdrop -- the music-dsp mailing list and website: >> subscription info, FAQ, source code archive, list archive, book reviews, >> dsp links >> http://music.columbia.edu/cmc/music-dsp >> http://music.columbia.edu/mailman/listinfo/music-dsp > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, > dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingOn Jun 14, 2008, at 8:41 AM, Uli Brueggemann wrote: > Maybe http://www.cutestudio.net/ is worth to look at and to test > for declipping? > > Uli > -- > This looks like a remarkable piece of work--they actually claim to undo severe clipping to something resembling the original. Does anyone know how it sounds? Does anyone know how it works? The only clue that I could find is that it uses "advanced heuristics." Jerry -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingMy guess would be some variation on linear predictive analysis and some very clever high order interpolation. In _theory_ there's information missing so it shouldn't sound that great. But I've learned never to say never in DSP, who would have forseen MP3 encoding and polyphonic transcription 15 years ago? On Tue, 17 Jun 2008 21:04:41 -0700 Jerry <lanceboyle@...> wrote: > > On Jun 14, 2008, at 8:41 AM, Uli Brueggemann wrote: > > > Maybe http://www.cutestudio.net/ is worth to look at and to test > > for declipping? > > > > Uli > > -- > > > This looks like a remarkable piece of work--they actually claim to > undo severe clipping to something resembling the original. Does > anyone know how it sounds? Does anyone know how it works? The only > clue that I could find is that it uses "advanced heuristics." > > Jerry > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp -- Use the source -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingOn Wed, Jun 18, 2008 at 6:04 AM, Jerry <lanceboyle@...> wrote:
> This looks like a remarkable piece of work--they actually claim to undo > severe clipping to something resembling the original. Does anyone know how > it sounds? Does anyone know how it works? The only clue that I could find is > that it uses "advanced heuristics." > > Jerry > See section How It Works at http://www.cutestudio.net/data/products/audio/declip/index.php Uli -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingCheers Uli, A geat bit of heuristic programming with incremental improvement and some audaciously practical ideas. Love it. On Wed, 18 Jun 2008 08:19:54 +0200 "Uli Brueggemann" <uli.brueggemann@...> wrote: > On Wed, Jun 18, 2008 at 6:04 AM, Jerry <lanceboyle@...> wrote: > > This looks like a remarkable piece of work--they actually claim to undo > > severe clipping to something resembling the original. Does anyone know how > > it sounds? Does anyone know how it works? The only clue that I could find is > > that it uses "advanced heuristics." > > > > Jerry > > > > See section How It Works at > http://www.cutestudio.net/data/products/audio/declip/index.php > > Uli > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp -- Use the source -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingOn Wed, Jun 18, 2008 at 12:19 AM, Uli Brueggemann
<uli.brueggemann@...> wrote: > See section How It Works at > http://www.cutestudio.net/data/products/audio/declip/index.php > > Uli It looks like cutestudio.net's domain registration expired just as I was reading about it. Hopefully the site comes back up soon; I was just about to listen to the sound samples. Mike Bourgeous -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingOn Jun 17, 2008, at 9:23 PM, Andy Farnell wrote: > who would > have forseen MP3 encoding ... 15 years ago? Uh, you can read about it here ;) http://en.wikipedia.org/wiki/MP3 Jerry -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital Clipping1991 doesn't seem like > 15 years ago. Does anyone else get that? :) On Thu, 19 Jun 2008 21:32:15 -0700 Jerry <lanceboyle@...> wrote: > > On Jun 17, 2008, at 9:23 PM, Andy Farnell wrote: > > > who would > > have forseen MP3 encoding ... 15 years ago? > > Uh, you can read about it here ;) > http://en.wikipedia.org/wiki/MP3 > > Jerry > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp -- Use the source -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp |
|
|
Re: Digital ClippingYeah--it's kind of a problem.
Jerry On Jun 19, 2008, at 9:39 PM, Andy Farnell wrote: > > 1991 doesn't seem like > 15 years ago. > > Does anyone else get that? :) > > > > On Thu, 19 Jun 2008 21:32:15 -0700 > Jerry <lanceboyle@...> wrote: > >> >> On Jun 17, 2008, at 9:23 PM, Andy Farnell wrote: >> >>> who would >>> have forseen MP3 encoding ... 15 years ago? >> >> Uh, you can read about it here ;) >> http://en.wikipedia.org/wiki/MP3 >> >> Jerry > |