<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="ContentPasted0">> When working at frequencies of interest down near DC, FIR filters would also require a shed load of taps!)</span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="ContentPasted0"><br>
</span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="ContentPasted0">Agreed.  But when working down near DC it only takes a single bit of floating point rounding to move outside the unit circle.  It sounded like the OP isn't doing it in real time so a 16384 tap
 FIR isn't than onerous to implement.</span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="ContentPasted0"><br>
</span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<font size="2"><span style="font-size:11pt" class="ContentPasted0">Another alternative is to use wavelet decomposition on the original signal, and then rebuild it altering each bin's gain co-efficient until you get the perfect squarewave/sawtooth you mentioned. 
 Obviously you have to start with a reasonable guess on the correct gains but it is guaranteed stable, and a lot less computation.<br>
</span></font></div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Synth-diy <synth-diy-bounces@synth-diy.org> on behalf of Richie Burnett <rburnett@richieburnett.co.uk><br>
<b>Sent:</b> 11 December 2022 19:21<br>
<b>To:</b> Didrik Madheden <nitro2k01@gmail.com>; SDIY List <synth-diy@synth-diy.org><br>
<b>Subject:</b> Re: [sdiy] Removing the effect of a DC blocking filter through DSP</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText elementToProof">Also forgot to emphasise the fact that I personally would recommend tackling
<br>
the compensation with an IIR filter.  The original mechanism of the <br>
DC-blocking action is "IIR" in nature, so it's best compensated using a <br>
simple IIR "inverse filter" approximation.  (FIR does have the age-old <br>
advantage of guaranteed stability, but the phase response of FIR is <br>
different to IIR, and it is often the phase response of DC-blocking stages <br>
that results in much of the undesirable wave-shape mangling.  <font size="2"><span style="font-size:11pt">When working
<br>
at frequencies of interest down near DC, FIR filters would also require a <br>
shed load of taps!)</span></font><br>
<br>
-Richie,<br>
<br>
<br>
<br>
<br>
-----Original Message----- <br>
From: Didrik Madheden via Synth-diy<br>
Sent: Sunday, December 11, 2022 2:49 PM<br>
To: SDIY List<br>
Subject: [sdiy] Removing the effect of a DC blocking filter through DSP<br>
<br>
Today the thing I'm tasked with is that I have some audio recorded<br>
through a setup containing one or more DC blocking caps, and would<br>
like to recover the unaffected audio. In principle, this could<br>
potentially be fairly simple depending on the circuit: model a 1 pole<br>
HP filter and run it backwards. Of course, the issue is that you would<br>
be integrating over a fairly long period of time (in my case I'd need<br>
to do it over multiple seconds) and the output is likely to diverge<br>
easily. I'm able to produce a step function from this system as a<br>
reference.<br>
<br>
Before I roll up my sleeves and try to code something myself, is there<br>
any project or code examples that does exactly this, in particular<br>
automating or visualizing the trimming of the parameters needed to<br>
avoid divergence? In the ideal case, such a software might have a<br>
waveform view where I can select part of the reference waveform that's<br>
silent, for extracting a corrective DC offset, and the pulse of my<br>
reference step function, for extracting the filter parameters, and out<br>
comes the parameters I need.<br>
<br>
-- <br>
/Didrik<br>
_______________________________________________<br>
Synth-diy mailing list<br>
Synth-diy@synth-diy.org<br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" data-auth="NotApplicable">http://synth-diy.org/mailman/listinfo/synth-diy</a><br>
Selling or trading? Use marketplace@synth-diy.org <br>
<br>
_______________________________________________<br>
Synth-diy mailing list<br>
Synth-diy@synth-diy.org<br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" data-auth="NotApplicable">http://synth-diy.org/mailman/listinfo/synth-diy</a><br>
Selling or trading? Use marketplace@synth-diy.org<br>
</div>
</span></font></div>
</body>
</html>