Radio frequency voice clipper demo with Faust, lv2, and JACK
We assume that readers are well familiar with IF-LO-RF mixers and SSB approach.
Original idea by Joachim Münch (df4zs) shown here:
https://www.qsl.net/df4zs/oszi.html
https://www.qsl.net/df4zs/index2.htm
and consist of heterodyne-based transmitter and receiver, and (hard) limiter between them.
The magic of this, at the point of view of modern DSP world, is that it makes soft clipping while not have any soft function. (It is more like compressor or normalize, but non-integrating, with momentary, per sample operation). If input is one tone, output will be one unity amplitude tone, without distortions if using mentioned analog circuitry, and almost without distortions when using limited DSP math.
Hard limiter generates a lot of out-of-band harmonics, but they can be easily filtered out due to carrier frequency is way higher than baseband bandwidth.
Here is the difference between analog and sampled system. Analog harmonics can be eliminated completely. This is impossible with DSP-based design, because it have well limited BW and it is Fs/2. All harmonics which can not be represented with current Fs, are aliased and can fall back to RF band, which makes result not exactly precise. In other words, harmonic can be filtered out only if they can be correctly represented first. See Figure 2 here https://www.soundonsound.com/sound-advice/q-what-aliasing-and-what-causes-it
Increasing Fs directly helps, and also reduces latency and baseband artifacts, but increases CPU usage. But exactly precision result, unlike of analog circuit, impossible anyway, due to it requires very high Fs.
Note, we talk here about processing Fs, it may not match with real DAC/ADC Fs. It is fine if JACK Fs is 384 kS/s while only 48 kHz allowed for i/o (h/w audio codec).
The more frequency "space" for harmonics (this is Fs/2 minus baseband audio BW), the more precise result (so, less audio BW, better result). Less overdrive/dynamic is also directly related to precision.
It can be noted that using some soft limiter function, instead of our hard one, not helps, but just eats CPU; but still need more tests. TODO
Here is not classic SSB processing used, but simpler substitution like on https://i.sstatic.net/65PtJ99B.png , it's mostly re-create of 2nd Nyquist alias. The difference is exactly zero gap between lower and upper sidebands at RF, it can lead to reduce of some very low frequencies, because one SSB should be filtered out with very sharp, but still not ideal band pass filter.
Do not expect spectrally pure result for something more complex input than just one tone. Even when exactly precise, clipper is non-linearity by its definition. In-band IMD3 products are should be there... and they are.
One may note that our receive heterodyne can be easily detuned (shifted) from transmit one. We welcome our reader to imagine what happens then, then test with real realtime setup.
It can also be noted that same or better result should be possible using regular baseband DSP techniques, while one needs to be quite experienced with math, to rethink it all in baseband way: at least, complex numbers are needed, i think. So, currently, it is demo mostly, due to it requires special mode of JACK engine, which is not supported by qjackctl, but only manually invoked.
But i really need it, but without all these "radio" tricks! :-[ ]
Well, it will work with regular 192k S/s. Narrower audio BW, and expect a bit more artifacts.
This digital processing unit, as well as classic analog single side band (SSB) radios, are never possible without frequency filtering. We have filters before and after every frequency conversion (mixer); also, after limiter. There are either LPF (low pass) and BPF (band pass) filters. As with analog LC filtering, digital ones have exactly same property: The more quality (more rectangular or "sharp") is filter, the more delay it introduces.
We use 33rd order filtering in our demo, and you welcome to tune it up to balance between delay and sound quality.
Sound recording engineers often use mixer term for sum of signals, and it's better if it is perfectly linear. We use mixer term here as radio crowd, when it is a multiplication, which is perfectly non-linear. Btw, this unit known by music people as modulator, and by radio people also as amplitude modulator.
-
Please tune up your Faust for higher speed, like
sed -i 's/192000/384000/' /usr/share/faust/platform.lib sed -i 's/192000/384000/' /usr/share/faust/math.lib -
Compile:
faust2lv2 -double rfclipper.dsp -
Place the newly created
rfclipper.lv2folder contains plugin suite, to/usr/local/lib/lv2/or similar place which your plugin host knows.
The realtime sound processing plugin we create, is intended to be used with so called plugin hosts with lv2 and JACK support, like Ardour (which is way more than just host, and you may find it quite useful). I've tested it with Carla plugin host. Or jalv.gtk3 (jalv.qt5) may be used. Please refer to its manuals how to add plugin and connect its input and output ports.
Btw, default URI ("address" required by host to load our plugin) will be https://faustlv2.bitbucket.io/rfclipper.
Please check here how to run JACK for higher Fs.
Let's look at .dsp code as it is, with its internal test signal source output connected to processing unit (rfclipper) input. You need to disconnect these two for real use. Note that eight output ports are in reversed order, unfortunately.
Block diargam built with https://faustide.grame.fr/
Plot it all, with six testpoints. Note how violet one, hard limiter output, occupies entire frequency band; some part of this wideband energy will pass the following BPF, thus create some distortions. Btw, light (near white) lines parts are overlay of several CRT rays.
We will use 47.5 kHz heterodyne frequency for this picture. You may tune it for best result (least distortions or metal sound ghosts); it is not via code change, but via slider or knob offered with plugin host.
Note how wide the frequency span: audible band is just tenth of screen.
What else is interesting here? One may note that our ideal upconversion IF-LO-RF mixer (which mathematically is just multiplier), orange (IF) to sky blue (RF), have 3 dB re:voltage conversion loss. It is 6 dB loss re:power, and is well known by "radio" people value for best passive mixers available.
[Command]
jasmine-sa -O -M 4 -d -110,10,12,64 -h 0,192000,20,64 RFClipper:out7 RFClipper:out6 RFClipper:out5 RFClipper:out4 RFClipper:out3 RFClipper:out2 RFClipper:out1 RFClipper:out0
Plot input and output only.
[Command]
jasmine-sa -O -M 4 -d -40,10,5,64 -h 0,24000,20,64 RFClipper:out7 RFClipper:out0
Real use, sum of 420 and 440 Hz clipping, with Simple Scope.
Thanks to gordonjcp for giving me an idea and original URL.
Thanks to all linux and audio dev teams for their valuable work and support.



