DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

Using a Hilber filter for SSB polar modulation

Started by Robmar 4 weeks ago●37 replies●latest reply 3 weeks ago●254 views

I'm working on a SSB polar modulation transmitter using a Hilbert filter on the microphone audio to get the IQ.  I'm having difficulties getting a suitable set of coefficients for 300-2200 Hz audio bandpass, I have one filter where the audio sound good but it generates poor IMD3 results, another with better IMD3 but worse audio.  As I'm not familiar mathlab, could anyone lend a hand or give me advice?

[ - ]
Reply by neirober●October 24, 2026

Hi Rob,

What is the sample frequency of your Hilbert transformer?

[ - ]
Reply by neirober●October 24, 2026

Also, how many taps can the Hilbert transformer have?

[ - ]
Reply by Robmar●October 24, 2026

Hi, the sampling frequency is 9.6 kHz.

It is an unrolled 31-tap linear-phase FIR transformer using an integer coefficient set (n/128) aimed at minimum stopband energy.  I get better IMD3 results with this than a window.  I tried a 63 tap Hilbert but with the coefficient set the voice quality was too harsh, but no idea why!  I'd like to test a 63 tap version to see if there are improvements but the audio is too harsh sounding.  I also need to reduce the bandwidth of to 300-2200 Hz to contain IMD at higher frequencies.  This is not my area really, I need to take an intensive class but don't have the time at the moment

#define HILBERT63_TAPS 63

#define HILBERT63_DELAY ((HILBERT63_TAPS - 1) / 2) // 31

#define HILBERT63_NCOEFF ((HILBERT63_DELAY + 1) / 2) // 16 coefficients (k = 1,3,...,31)

static float hbuf63[HILBERT63_TAPS * 2];

static float hilbert63_coeff[HILBERT63_NCOEFF];

void hilbert63_init(void)

{

const double two_over_pi = 2.0 / M_PI;

int j = 0;

for (int k = 1; k <= HILBERT63_DELAY; k += 2)

{

double n = (double)k;

double wn = 0.54 - 0.46 * cos(M_PI * n / (HILBERT63_DELAY + 1));

double h = two_over_pi / n;

hilbert63_coeff[j++] = (h * wn);

}

// Normalize at 1 kHz (9600 sps)

double test_omega = M_TWOPI * 1000.0 / (double)F_SAMP_TX;

double g = 0.0;

for (int i = 0; i < HILBERT63_NCOEFF; i++)

g += 2.0 * hilbert63_coeff[i] * sin(((i * 2) + 1) * test_omega);

double norm = (1.0 / g);

for (int i = 0; i < HILBERT63_NCOEFF; i++)

hilbert63_coeff[i] *= norm;

}

__attribute__((section(".ITCMRAM_section"))) /* GW8RDI added ITCMRAM *

void hilbert_63(float in, float *i_out, float *q_out)

{

static int hidx63 = 0;

hbuf63[hidx63] = in;

hbuf63[hidx63 + HILBERT63_TAPS] = in;

//xyx//int center = hidx63 + HILBERT63_TAPS - 1 - HILBERT63_DELAY;

int center = hidx63 + HILBERT63_TAPS - HILBERT63_DELAY; //xyx// correction

float I = hbuf63[center];

double acc = 0.0f;

int neg = center - 1;

int pos = center + 1;

for (int j = 0; j < HILBERT63_NCOEFF; j +=4)

{

acc += (hbuf63[neg] - hbuf63[pos]) * hilbert63_coeff[j];

neg -= 2;

pos += 2;

j++;

acc += (hbuf63[neg] - hbuf63[pos]) * hilbert63_coeff[j];

neg -= 2;

pos += 2;

j++;

acc += (hbuf63[neg] - hbuf63[pos]) * hilbert63_coeff[j];

neg -= 2;

pos += 2;

j++;

acc += (hbuf63[neg] - hbuf63[pos]) * hilbert63_coeff[j];

neg -= 2;

pos += 2;

}

if (++hidx63 >= HILBERT63_TAPS)

hidx63 = 0;

*i_out = I;

*q_out = acc;

}


[ - ]
Reply by neirober●October 24, 2026

Rob,

No guarantees, this could easily contain errors, but ...

I synthesized a Hilbert transformer with 31 taps and 12-bit signed coefficients.  Using 8 bit signed coefficients results in very poor image band response!  It turned out that the driving passband design constraint was response at 300 Hz.  I don't see an obvious need for more than 31 taps.

The frequency response and coefficients are shown below.  The top two plots have linear amplitude scales, while the bottom plot showing the image response has a dB amplitude scale.

hilbert1_1922.png

>> b'*2048

ans =

          -6

           0

         -16

           0

         -34

           0

         -65

           0

        -116

           0

        -206

           0

        -400

           0

       -1292

           0

        1292

           0

         400

           0

         206

           0

         116

           0

          65

           0

          34

           0

          16

           0

           6

[ - ]
Reply by Robmar●October 24, 2026

Thanks, but I sort of need it to cut-off around 2200 Hz, the coefficients are floats, this is the hilbert31 code if that helps:-

#define HILBERT_TAPS31 31

#define HILBERT31_DELAY ((HILBERT_TAPS31 - 1) / 2) // 15

#define HILBERT31_NCOEFF ((HILBERT31_DELAY + 1) / 2) // 8 coeffs (k = 1,3,...,15)

//#define HILBERT31_NCOEFF (HILBERT31_DELAY / 2) // 7 coeffs - (k = 1,3,...,13) Reduces HF ripple as drops the highest-frequency odd tap (n=15).

volatile static float hbufferStart = 0.7071;

static float hbuf31[HILBERT_TAPS31 * 2];

volatile static float hbufferEnd = 0.41407;

static double hilbert31_compact[HILBERT31_NCOEFF];

void hilbert31_initA(void) //xyx// 20261021 swapped with Takahashi version below

{

const double two_over_pi = 2.0 / M_PI;

int j = 0;

double n;

for (int k = 1; k <= HILBERT31_DELAY; k += 2)

{

n = (double)k;

// Hamming window

double wn = 0.54 + 0.46 * cos(M_PI * (double)n / (double)HILBERT31_DELAY);

// Analytic Hilbert kernel

double h = two_over_pi / n;

hilbert31_compact[j++] = h * wn;

}

// Amplitude normalization (best for analytic signal)

float sum_abs = 0.0;

for (int i = 0; i < HILBERT31_NCOEFF; i++)

sum_abs += fabs(hilbert31_compact[i]);

double norm = 1.0 / sum_abs;

for (int i = 0; i < HILBERT31_NCOEFF; i++)

hilbert31_compact[i] *= norm;

}

[ - ]
Reply by neirober●October 24, 2026

Cutting off at 2200 Hz would result in a lower corner frequency well above 300 Hz.  Assuming passing 300 Hz (and rejecting fs-300 Hz) is important, you would probably be better off adding a 2200 Hz LPF in front of the Hilbert transformer.

[ - ]
Reply by Robmar●October 24, 2026

Adding a slew rate limiter would  be simple enough, I was hoping to set the 3db bandwdith in the Hilbert with a firm roll-off

[ - ]
Reply by neirober●October 24, 2026

Unfortunately, the upper and lower corners of the Hilbert are related -- a lower f_high results in a higher f_low.  

I synthesized a 27-tap half-band lowpass filter with a corner of 2200 Hz with 10-bit signed coeffs.  As you know, every other coeff (except main tap) is zero, so number of non-zero coeffs is 15.

See coeff values below.


lp2_82754.png

>> b'*512

ans =

    12

     0

    -9

     0

    13

     0

   -19

     0

    30

     0

   -53

     0

   162

   256

   162

     0

   -53

     0

    30

     0

   -19

     0

    13

     0

    -9

     0

    12

[ - ]
Reply by Robmar●October 24, 2026

That looks interesting,  I tried asking the so called "AI's" about this and they were absolutely unable to calculate the coefficients or understand the process.  I guess they're not actually AI, more search, compare, extrapolate (guess) and make it sound convincing.

Not sure how I would add those figures to the hilbert31 code, it uses tables like:-

static const float h31_coeff[HILBERT31_NCOEFF] =

{

0.633640981f,

0.203420587f,

0.113166654f,

0.072095067f,

0.048046167f,

0.032299078f,

0.021479032f,

0.013946687f

};

[ - ]
Reply by neirober●October 24, 2026

Here is my article on halfband filter synthesis (using Matlab):

https://www.dsprelated.com/showarticle/1748.php

[ - ]
Reply by Robmar●October 24, 2026

Very interesting indeed, I will study that in my coffee break!

[ - ]
Reply by Robmar●October 25, 2026

Hi Neil, the MCU is happy processing up to 63 when the Hilbert is fully unrolled.

[ - ]
Reply by neirober●October 25, 2026

OK.  I'm not a digital hardware guy, so I'm not sure of the implications.

[ - ]
Reply by Robmar●October 25, 2026

Unrolled is when the calculations are not in a for or while loop, reduces processing time a little.  So up to 63 taps can be processed but the one I tested, posted earlier, has harsh sounding audio, and I would really like to solve that as the 63 taps should produce better linearity

[ - ]
Reply by Slartibartfast●October 24, 2026

You can avoid the distortions that Hilbert creates by mixing the SSB signal to baseband (your spectrum centered on 0 Hz) with a complex mixer.   You can then mix the signal back to whatever frequency you want with another complex mixer.  This may wind up taking much less computational complexity than you are expending on the Hilbert filter.

[ - ]
Reply by Robmar●October 24, 2026

Yes, but to get clean SSB without a Hilbert, you still have to perform quadrature balancing and filtering at the IF., its essentially trading one set of DSP processes(Hilbert FIR taps) for another (dual-path low-pass filters and precise quadrature mixing).  In any case the hardware is finished, and it uses Polar modulation as it requires less parts

[ - ]
Reply by Slartibartfast●October 24, 2026

I don't know how you're feeding your RF for the Polar Modulation, but a decent numerical complex mixer is lossless and distortion-free.   If the original SSB signal is clean, a numerically-mixed complex IF would be just as clean.   What am I missing?

[ - ]
Reply by Robmar●October 24, 2026

Polar SSB modulation generates single‑sideband signals by splitting audio into phase and amplitude components and applying them separately so a nonlinear RF amplifier can be used efficiently.

📡 Core Concept: Polar vs. Cartesian Modulation

Polar modulation expresses the signal in r (amplitude) and θ (phase) rather than the usual I/Q Cartesian form. SSB is generated by separating the audio into phase and amplitude components (from IQ hence the need for the Hilbert) and modulating an RF amplifier.  The phase or frequency of a PLL is modulated.  This is the classic Envelope Elimination and Restoration (EER) method, also called Kahn modulatio
[ - ]
Reply by Slartibartfast●October 24, 2026

I'm familiar with Polar Modulation.  I'm also familiar with Hilbert transforms and filters and various methods for moving information around with signals for modulation and demodulation.  I'm not following how generating the IQ from SSB with complex mixers will somehow be worse than using Hilbert techniques, which naturally add distortion to the signal.  

Are you asking how to generate the IQ stream or are you asking how to clean up the SSB spectrum before subsequent processing?

[ - ]
Reply by Robmar●October 24, 2026

The IQ from the mic audio is processed to extract phase and amplitude, the amplitude sets the transmitter's PA FET drive level, and the phase is used to shift the PLL frequency, and that's it, fast because its running on an MCU with limited resources, though its has DSP operations and around 1k DMIPS, there isn't a lot of margin for more processing.  Whatever processing we add, the only controls that exist over the RF PA is amplitude and clock frequency/phase.  Do you know a better strategy that would work with that and could be processed within 10uS on the MCU?

[ - ]
Reply by Slartibartfast●October 24, 2026

Yes, I understand what you're trying to do.  If the goal is to get your real-valued SSB signal converted to phase and amplitude to drive the polar modulator, this is what I'd suggest:

First, this assumes that your SSB signal is already sufficiently filtered and clean.

1. Use a complex-valued numerical (digital) mixer to mix the SSB signal to complex baseband, i.e., so that the signal spectrum is centered at 0 Hz.  For your signal occupying 300-2200 Hz this would be a down mix by 950 Hz.  The result will be IQ samples with magnitude and phase representing your SSB signal.   This signal will be just as clean or dirty as your SSB signal.

Since this is a continuous single-frequency mix you can store the coefficients (sine waves) in memory and just multiply sample-by sample. This takes very little computational resources.

2. Convert the IQ samples to magnitude and phase using your favorite algorithm, or a look-up table depending on your resolution requirements.

That's probably a lot less computation than using the Hilbert filter you described. 

IF you need more filtering on the signal, it can be done at baseband (after the down-mix) using a low-pass filter on each of the I and Q channels.   This will still likely be a lot less computation, and if you want minimal computation, use IIR filters for this.

This can be simulated at your existing sample rate for verification.  After the down-mix, if the spectrum is clean you can drop the sample rate by 1/2.









[ - ]
Reply by Robmar●October 24, 2026

I think we have crossed the wires :D  I don't have an SSB signal, I don't have IQ SSB signals, I only have analog microphone mono audio sample stream.  I use the Hilbert to turn the audio into IQ, I extract amplitude and phase, and use that to control a frequency source, which drives a physical power transistor to create RF on its load coil, and I wiggle the frequency a touch with the phase, amplitude of course controls the RF power. Once the SSB signal is created, its on the load coil connected to the resonant filter (hardware) and antenna and is beyond my magical DSP control :D  You get it?

[ - ]
Reply by Slartibartfast●October 24, 2026

Yes, sorry, you're trying to turn baseband audio into magnitude and phase.  It doesn't ever really need to be SSB.  What I said still works, just LPF after the downconversion to isolate the half of the spectrum that you want.

So:

1.  Mix down by 950 Hz.  Do this with a complex-valued sinusoidal mix.   As mentioned, it can be a LUT.

2.  LPF, via FIR, IIR, whatever you want, with a cutoff at 950 Hz.   You can decimate 2:1 at the same time if you like to further reduce the computational complexity of the IQ ->  mag, phase conversion.

3. Profit!

As mentioned, this can be simulated at your current sample rate for verification

The only computations required are the per-sample partial complex-multiply (since the Q component is initially zero) for the downconversion, then LPF the I and Q channels identically, then whatever you want to use for your IQ -> Polar conversion.   The Hilbert filter, meanwhile, is a lot more computation.   Use IIR filters for the LPF to keep computational complexity minimal.

I've been doing this for more than forty years. Got the t-shirt to prove it.  ;)

Sorry to be slow on isolating the half-spectrum.  It happens.

One trick to possible apply before downconversion is a DC notch filter, so that the baseband images are better isolated from each other before the LPF after downconversion.   This is also a low-computational-complexity task, but may help if needed.   Again, this can all be simulated pretty easily.



[ - ]
Reply by Robmar●October 24, 2026

Mix what down to 950Hz ??  My audio stream is already 200-2500Hz.
What down-conversion of what signal?  I only have an audio stream, nothing  to down convert!  Anyway, thanks for your reply!

[ - ]
Reply by Slartibartfast●October 24, 2026

Mix your real-valued audio stream down with a complex sinusoid rotating at -950 Hz so that your 300-2200 Hz signal (as you previousy described) is now at -950 to +950 Hz.  It will now be in IQ format, so you can detect magnitude and phase.  You will need to apply a LPF first to remove the image of the original audio signal which got mixed out-of-band.  This LPF filter can be very computationally simple, like an IIR filter (which are very common for audio processing), or you can use a different filter architecture if it suits you better.

If your signal is really 200-2500 Hz, then the center of that can be mixed to DC by mixing with a complex sinusoid rotation at -1150 Hz, with the resulting signal occupying the complex-valued spectrum at -1150 to +1150 Hz.  A LPF with a cutoff of 1150 Hz applied to both I and Q streams will remove the image energy.

As previously mentioned, removing DC prior to mixing can be used to create a bigger divide between the two images of the original audio spectrum if needed so that the LPF doesn't have to work so hard to remove the image energy close to the desired spectrum.

Once the spectrum has been mixed down to center at 0 Hz and filtered to remove the image, you can detect magnitude and phase and it will work to drive a polar modulator.

Again, this assumes some things about your overall system architecture and requirements, but if you really just want to convert an audio signal to magnitude and phase, the method I'm describing should be able to made to work with less distortion than the Hilbert method and potentially very little computational resources.  






[ - ]
Reply by Robmar●October 25, 2026

IIR is going to be more of a load that my current Hilbert which is very efficient and fully unrolled unfortuantely. The technique you describe is more complex and I'm not sure what the benefits would be if the MCU could handle it, but certainly interesting if a bit puzzling! :D

[ - ]
Reply by KA9Q●October 25, 2026
What he's describing is the "Weaver" or "third" method of SSB generation/detection.

Your microphone produces a purely real signal, so it has a negative frequency spectrum that's a mirror image of the positive spectrum.  On the complex plane, positive frequencies are vectors that rotate counterclockwise while negative frequencies with equal magnitude rotate clockwise, so their imaginary components cancel leaving only a real component. This is true for all real signals.

Think of your microphone as producing a double sideband (DSB) signal with a carrier frequency of zero. The upper sideband extends from +300 to +2200 Hz and the lower sideband runs from -300 to -2200 Hz.  You want to get rid of the lower sideband and keep the upper sideband. That's *exactly* what the Hilbert transform does: add an imaginary component that's the Hilbert transform of your real signal and the lower sideband vanishes. It's an "analytic signal". But there's another way that's mathematically equivalent but uses simpler filtering.

Ordinary mixing with a real oscillator produces both sum and difference frequencies, but mixing with a complex sinusoid only produces a sum. So when you mix your input by a complex sinusoid with a negative frequency, everything is shifted down by that amount. (Slartibartfast said -950 Hz, but I think he meant -1250 Hz.)

When you do that, your unwanted lower sideband now runs from -3450 to -1550 Hz and your desired upper sideband runs from -950 to +950 Hz. (This is possible only because the signal is now complex.) Because your desired upper sideband is now centered on DC, a full complex filter is not necessary to get rid of the lower sideband. You can use two ordinary real low pass filters cutting off at, say, 1000 Hz.

Now all you have to do is shift your upper sideband back up into place with another complex oscillator and mixer, this time at +1250 Hz. Now you have just your upper sideband running from +300 to +2200 Hz and no lower sideband, so voila! The imaginary component is the Hilbert transform of the real signal!

Weaver invented this method to eliminate the need for a complicated audio phase shift network.  You only need two ordinary low pass filters. The main drawback of his method, and the reason it wasn't widely used, is that it could be difficult to get all the analog mixers perfectly balanced, the filters gain-matched, and the LO phases in exact quadrature, so you'd have (for your numbers) an annoying 1250 Hz tone bleeding through. But you can now do the math precisely in DSP, and that's why the Weaver method has been making a comeback in SDRs.
[ - ]
Reply by Robmar●October 25, 2026

Thanks for the explanation, so this method in DSP results in I and Q signals?  Would it improve the IMD3 results by more than -3dBc?  It sounds like it would be a lot more load on the small MCU I use.

[ - ]
Reply by KA9Q●October 25, 2026

Yes, as soon as you do the first mixing by the complex exponential you get I and Q signals - a complex signal. You have to; your negative frequency spectrum cannot be different from your positive spectrum unless the signal is complex. But as Slartibartfast explained, the mixer doesn't have to be a full complex multiplier because your input signal has no imaginary component. So the output of the first mixer is

I(t) = S(t) * cos(2*pi*f*t)
Q(t) = S(t) * sin(2*pi*f*t)

where f = -1250 Hz. 

Together, they give you the spectrum I described: upper sideband between -950 and +950 Hz centered on 0 (DC), lower sideband extending between -3450 Hz and -1550 Hz. Now you just have to get rid of that unwanted lower sideband below -1550 Hz.

A filter with different negative and positive cutoff frequencies must be complex, but because your wanted upper sideband is now centered on DC you can just use two ordinary low pass filters, one each on I and Q, that remove everything above 950 Hz. They remove the unwanted lower sideband between -3450 and -1550 Hz. They also remove anything above +950 Hz, but there's nothing there to remove. You're now left with a SSB (USB) signal with the middle of the audio passband at DC and a suppressed carrier frequency of -1250 Hz. You can now mix this back up to a carrier frequency of 0 and get your Hilbert transform from the Q channel. Or you can just mix it directly up to your RF output frequency, adding another 1250 Hz to your carrier frequency to put it in the right place. This second mixer takes an IQ input (from the two low pass filters) and cosine and sine functions from the second complex oscillator, but because the input spectrum is centered on zero there are no cross product terms; you can just use two ordinary multipliers (mixers), one for I and another for Q.

This mixing process only changes the phase of the signal, so you can get your amplitude from the I and Q components either ahead or after the second mixers. But you need to get your phase from the second mixer outputs because what's what defines the carrier frequency of the signal you're transmitting.



 


 

 

[ - ]
Reply by KA9Q●October 25, 2026

I don't know what machine you're using for your DSP, but I use 32-bit IEEE-754 floating point for all of mine. This has a huge total dynamic range of about 1,668 dB (including "denormals") and an instantaneous range of about 144 dB (I think) so quantizing noise and intermod distortion are basically irrelevant once you enter the digital domain. If you're using integer arithmetic that's a different story. Once upon a time all DSP was done that way, but fortunately I only got involved after floating point became widely available.

[ - ]
Reply by KA9Q●October 25, 2026

This is basically the Weaver method. Looks fine to me.

Another method would be to use fast convolution with a FFT. I use it in a multichannel receiver, and the steps can be easily reversed to form a transmitter.

[ - ]
Reply by Robmar●October 25, 2026

So the Weaver method is to do the sine mixing etc?  The Polar method is from LR Kahn (1952). https://www.ursi.org/proceedings/procGA11/ursi/CP-5.pdf
The paper is an interesting read for any interested in DSP.
So how does the fast convolution method extract IQ from mono audio?

[ - ]
Reply by Slartibartfast●October 25, 2026

You had indicated that you want to drive a polar modulator with magnitude and phase signals generated from your real-valued audio signal.   What I described will get you that, without the need to mix it back up to audio baseband.  i.e., you can detect magnitude and phase from the IQ samples generated by the process I described.

The Hilbert filter is convolutional, so generally more compute-intensive than an IIR, which is recursive.   This is why IIRs are used, to reduce computational complexity when the phase response can be tolerated, which is why they're frequently used in audio.  Since your application is audio, you have the opportunity to trade off computational complexity this way.

The mixing function, as I described previously, is one complex-multiply per sample, with the imaginary part of the input (your audio signal) being zero, so those computations can be skipped.   So you only have a partial complex-multiply per sample.   If you use a LUT for the mixing sinusoid function, you don't need to compute that at all, just look it up.

The mixing function is lossless, so will not contribute any distortion at all, other than the usual quantization effects, which you have anyway.  The IIR (or FIR, or whatever filter you might use) can be adjusted by the filter coefficients to limit distortion to meet any particular spec you might be concerned about.   You have this exact same problem with the Hilbert filter, but without the constraints of the additional transform function of the Hilbert.

Again, this can be simulated with your favorite simulation tools.  You can simulate both methods and see which gets closer to your goals.



[ - ]
Reply by Robmar●October 25, 2026

It would be interesting to see if that approach gave better results, but it will takes some time to implement, so the first step is to see if the Hilbert31 or 63 have any defects or can be improved. Did you look at the code I posted for those, any feedback would be welcome

[ - ]
Reply by KA9Q●October 25, 2026

My SDR (https://github.com/ka9q/ka9q-radio.git) uses the MIT FFTW3 FFT package to perform fast convolution. There's too much to describe here, but you're welcome to look at my code and documents. Basically with my scheme you can implement any of the three classic methods of SSB detection (filter, phasing, Weaver) just by changing the various frequency settings; they're mathematically identical.

You can compute the Hilbert transform by taking a real-to-complex Fourier transform of your mono signal, copy the frequency components to the positive bins of a complex-to-complex inverse Fourier transform, zero the negative bins, and take the IFFT. You get the original signal on the I channel and the Hilbert transform on the Q channel. My receiver actually produces both components when receiving SSB but I usually discard the Q (Hilbert) component. But sometimes I'll put I on the left output channel and Q on the right; this creates a 'phasing' effect that can reduce auditory fatigue a little during long periods of listening. 

There's more to it than that; you have to shape the positive frequency response with a window that goes to zero at DC, otherwise you'll get Gibbs ringing at the end of each block. But that's essentially how it works.

[ - ]
Reply by Robmar●October 25, 2026

That sounds like an amazing project that clearly you've put years into but my limitation is my low-power MCU as this is an embedded ultralight SDR and only draws 2 watts, and with that it tops out at 1000 DMIPS, its already handling a 3D scope and waterfall on an XGA LCD, so its not going to handle much more DSP stuff. What I need in a nutshell is to get the hilbert 63 tap code working with good sound audio and imd3 results.  I posted the code above replying to Neil, any advice on that would be great

[ - ]
Reply by KA9Q●October 25, 2026

If you have a waterfall you must already have a FFT, so your machine is capable of it. I personally have never built a Hilbert transformer in the time domain (I've always just used the FFT) but I do know how to do it. 

The whole point of a Hilbert transform is a precise wideband 90 degree phase shift. The negative frequencies are shifted by +90 degrees and the positive frequencies are shifted -90 degrees. Phase can be difficult to control precisely with an IIR. The FIR can give precise phase but takes more cycles. Ideally your machine has a fast multiply-accumulate (sometimes called "fused multiply-add") instruction because you need to evaluate a dot product really fast, once per sample. Usually FIR Hilbert transforms are designed with an odd number of taps so that every other tap is zero, cutting out half of your multiplications. 

The big advantage of the Weaver method, and why Slartibartfast keeps recommending it, is that instead of a cycle-consuming FIR Hilbert transform you can just build two simple IIR lowpass filters. IIR filters take fewer cycles than FIR filters for similar responses, and while it can be a little tricky to control the phase response near the edges it's pretty easy to get a flat phase response within the passband.