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
I chose to fix A3 as
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.