# Audio experiment with intermodulation by multiplying two analytic signals

1) First, I describe intended processing with a basic case:

• Let's say on left channel I have a sin wave with frequency F1, and constant amplitude A1.
• Then on right channel a sin wave with frequency F2 and constant amplitude A2.
• Then I would generate a third sin wave, with frequency F3, and constant amplitude A3. Such third sin wave verify: either A1≤A3<=A2 or A2≤A3<=A1. Also F3= F1+F2.

I chose to fix A3 as A3= Sqrt(A1*A2).

The third sin wave would be blended to a small fixed amount to left and right channels (let's say at -30 db) . This would add some intermodulation.

In our particular basic case, I can get the target third sin wave by multiplying analytic signals of left and right. (Context: Analytic signals are related to Hilbert transform . I use a FIR).

Let's say on left I have re1 + i*im1, then on right re2 + i*im2 .

Then I can get my third sin wave by computing (two square roots applied on denominator) :

(re1*re2 - im1*im2) / √√(asq1*asq2)

Asq1 is the "absolute square" for left signal i.e :

asq1= re12 + im12

Same story with asq2.

You might ask , why not do a straightforward "ring modulation", by multiplying directly both channels, i.e re1*re2 . Because it will introduce an additional harmonic with frequency Abs(F1-F2) that I don't want.

2) Pushing the experiment to true audio content:

Ok, I understand that the audio effect I imagined might be flawed, or that I might be using the Hilbert Transform in a wrong way.

Nevertheless here are few improvements I've made to the implementation of this process:

• The frequency response from the Hilbert FIR is not completely flat, and is like a wide bandpass. So I ensured to reproduce same frequency response for the real part of each analytical signal.
• I avoid aliasing by upsampling 2x, analytic signals, and then downsampling after multiplication.
• The division by the term √√(asq1*asq2) introduces lot of unwanted frequencies. I've mitigated this by applying a gaussian blur to asq0, and asq1.

The division by the term √√(asq1*asq2), remain problematic even after applying some blurring. But I want the amount of distortion to be independant of the level of original signal, so I keep it. In other words, if I adjust the volume, the added distortion will vary in a linear way. Not instantly, but on "average" with time .

The subjective quality of the result, vary with audio content, the blurring period of asq0 & asq1, and also the length of hilbert FIR. It mostly affect the perception of transients (I remind that the "intermodulation" is blended to original audio, at low level).

Anyways it's an audio experiment. I could have played instead by adding some second harmonic distortion. It can be pleasing, and it's often used by musicians. But I imagined something different. Hopefully, this looks enough simple.

Now, if you could point out what's wrong in this processing effect, or how it could be improved, that would be great.

• Intermodulation occurs when the signal goes through a non-linear system, modeled as $y(t) = \sum_{k=0}^n a_k x(t)^k$. As far as I can see you don't need any Hilbert transformer. Have you tried this approach? – MBaz Jul 15 '19 at 22:31
• I might have been misusing the word intermodulation. But the model you suggest takes signal from one input, while I want to combine two input to generate a single output (then I blend). For instance, if you have 3000 hz on left, and 4000 hz on right, then a frequency of 7000 hz is generated. I skip the amplitude part (it's on my description) . Can't see how this model could do that. When talking of full audio content I just want a "natural extension" to basic case (doesn't matter exactly what the process does, but I assume all freq combinations between left and right). – Mehdi Jul 16 '19 at 3:36