Ring modulation with other wave types

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I've been experimenting around with ring modulation using sawtooth and square waves, and making an effort to get the result sounding a little better than just plain amplitude modulation with these waves. Especially at higher frequencies, they produce a lot of buzzing/distortion, and obviously aliasing.

The most significant improvement I found was actually reducing the number of harmonics used to calculate the sawtooth and square wavetables -- pretty much like how you would reduce the number of harmonics used to generate these waveforms as the frequency increases. Bringing the harmonics down to around 8 - 12 or so makes the ring mod effect a little more tolerable.

The other thing I did was wrap the ring mod process within an upsampling - ring mod - downsampling block to see what effect that would have (I'm using window-sinc filters). Fairly minimal I must say. Much, if not all, of the buzz remains and it's a bit hard to hear aliasing with so much buzzing going on. I wonder if it would be more noticeable as the frequency value is automated? You'd maybe heard the frequencies folding down like you would in a non-bandlimited wave sweep.

I'm wondering if upsampling-downsampling is worth it if the audible effects are so minimal. And are there ways to possibly get these waveform sounding just a little cleaner?

Another thing that seemed to help too was actually just low-passing the result after the ring mod. It gets rid of some of the buzz, though it affects the rest of the audio too.

Anyone have any experience with this?

Post

I guess you know that ring modulating two signals together produces an output signal containing frequencies at the sum and difference of all harmonics present in the original signals. So if signal A contains frequencies a1,a2,a3 and signal B is just a sine wave at b1 then you'll get a1-b1,a1+b1,a2-b1,a2+b1,a3-b1 and a3+b1 in the output. If B contains b1 and b2 then you'll get the above plus a1-b2,a1+b2,a2-b2,a2+b2,a3-b2 and a3+b2.

In general, the an+b1 terms will be harmonically unrelated to each other, the an+b2 terms will also be unrelated to each other, and the an+b1 and an+b2 terms will also be unrelated. So for every additional harmonic in the B signal you get a whole collection of unrelated partials appearing in the output, which will rapidly turn into the sort of buzzing you describe.

With regard to aliasing, the higher harmonics in A and B can easily sum to frequencies above Nyquist - it's not clear from your description whether the upsample-ringmod-downsample includes a low-pass filter before the downsample, but it ought to if you want to remove the aliased frequencies.

Alternatively, if you know the frequency of the highest harmonic in B is bn then you could low-pass filter A to block any harmonics above Nyquist-bn prior to ring modulation. This would have a different effect from upsample-RM-downsample, but might help tame the buzz as well as the aliasing. You could also simply LPF both A and B to N/2 - again, you'd get a different result but it may be what you want.

Post

Yep, definitely know of the theory behind it and why the buzzing happens due to the creating of additional harmonic bands above and below the original signal being modulated.

I am using a low-pass filter for upsampling and downsampling -- both are window-sinc FIR, so it goes:
upsample - LP filter (with cutoff just less than original Nyquist to allow for transition band) - ring mod - LP filter (again with cutoff at just less than original Nyquist) - downsample. A filter order of around 220 or so seems to do the job fairly well, just in testing the resampling by itself.

But you know I haven't tried actually LP filtering the modulating sawtooth/square waves. I'd imagine it would have a similar effect to just reducing the number of harmonics in them? I'll give that a try though.

Even though ring modulation produces some pretty interesting sounds just with a sine wave, I'm trying to find out ways to expand it by utilizing other wave types; if only they'd sound a little better. :) Of course there's also side-chaining..

Post

Ring modulation requires either both signals to be bandlimited as a function of amplitude and frequency, or the entire operation oversampled. There isn't a way around it AFAIK.

On the plus side, oversampling overhead is usually low enough until about 16x from 48khz, and the amount of operations overall is low. The more oversampling there is, the more ring modulation can occur before aliasing.

Post

LemonLime wrote:Yep, definitely know of the theory behind it and why the buzzing happens due to the creating of additional harmonic bands above and below the original signal being modulated.
Sorry, I didn't mean to sound patronising :)

Thinking about it some more, RM using a modulator that has high harmonics is going to produce frequencies that sound very much like aliasing even if the result is theoretically antialiased. Aliasing sounds like a reflection of harmonics above Nyquist, and RM can produce similar-sounding reflections if one signal is high in frequency and the other low to moderate.

If you are looking to experiment with extensions to RM, I think it might be more fruitful to try using a signal that produces results which occupy a more controlled frequency band - using a square/sawtooth for modulating will spread the result over a large chunk of spectrum, which is probably harder to fit into a musical context.

How about modulating with a wave made from the sum of several closely spaced sinewaves, to thicken out the effect without spreading it too much?

Or RM multiple times with low frequency sines to spread each harmonic of the original signal.

Or use filters to split the original signal, apply different RMs to each band, and then recombine.

Just a few thoughts.

Post

kryptonaut wrote:
LemonLime wrote:Yep, definitely know of the theory behind it and why the buzzing happens due to the creating of additional harmonic bands above and below the original signal being modulated.
Sorry, I didn't mean to sound patronising :)
No no, not at all. :)

Like you said, ring modulation with sawtooth/square waves is just prone to aliasing and that buzzing sound. It seems that it can be minimized through oversampling and low-pass filtering, but I like your suggestions on different uses of the sine wave for example.

Thanks!

Post

For ring-modulation (ie multiply two signals) you need 2x oversampling to eliminate aliasing: the bandwidth is the sum of the two original bandwidths, so if both are limited to fs/2, then the product is limited to fs.

Post

I would like to add that the "correct" ring-modulation result for two saw-tooths tends to be quite "buzzy" actually.

Post

Some time ago I created a patch for a sytrus. I think it sounds good, and it uses RM+chorus. If you're interested how it's done - download the patch (name Juvenile, second in the mp3) here: http://forum.image-line.com/viewtopic.php?p=581793

The patch come from "accident", so I can't recommend anything of how I thought about it. I just noticed the patch actually uses this idea somewhat:
How about modulating with a wave made from the sum of several closely spaced sinewaves, to thicken out the effect without spreading it too much?
So maiby try experimenting more in this direction.

Hm. About chorus. What about putting AM sections in front of feedback\feedforward chorus paths? (Just a random thought). Even more generally: what about incorporating AM in places where it "shouldn't" be? (Again, just a random thought).

Post

mystran wrote:I would like to add that the "correct" ring-modulation result for two saw-tooths tends to be quite "buzzy" actually.
Ok. I was a little unsure about this, particularly since many ring modulators that I've tried don't really offer any other waves types except for sine, so I didn't have a whole lot of reference to go by. Some give the option of "warping" the sine wave to different shapes, though.

Post

Ring modulation with square/sawtooth waveforms can make some really nice sounds at sub-audio frequencies. For example, ring modulating with a square wave LFO inverts and uninverts the signal at 2x the LFO frequency. Send this to one channel, and the non-modulated signal to the other channel, and you can get a really cool stereo effect. Brian Eno used this technique in this 1974 track (it was used to process the guitars starting at 2:16):

https://www.youtube.com/watch?v=aaF_2l4vRrs

EDIT: Wow, this is one of those signal processing tricks that doesn't hold up well to the YouTube audio compression. I just listened to the YouTube track the whole way through, and there is a phasiness that is not on my CD copy of the album.

I first discovered this technique when listening to "The Third Wheel," and it sounded a lot different than before. It turns out I had accidentally pressed the "mono" button on my ancient stereo receiver, which mixed the ring modulated track with the dry track to produce a choppy tremolo effect.

Sean Costello

Post

I have now written my own resampling class to help handle the sawtooth/square waves for ring modulation. It works well, and I've verified it against other resampling libraries, but I've hit a little snag.

I've implemented the resampling into the ring mod routine but I'm still getting very noticeable aliasing when automating the frequency of the oscillator wave. It seems to be fine when the frequency is steady, but when it changes at around 2000Hz+ the aliasing is quite strong. Here's a sample:
http://www.christianfloisand.com/assets ... iasing.mp3

I've tried upsampling by up to 6X and it doesn't have an effect. I also tried upsampling the actual wavetables as well as the incoming audio signal, but again.. nothing.

After reading earlevel's post about generating band-limited wavetables ( http://www.earlevel.com/main/2012/05/04 ... or—part-1/ ), I'm wondering if they need to be generated using different numbers of harmonics based on the frequency range and split into sub-tables as in the article? Although I was under the impression that upsampling before processing the ring mod would have taken care of this issue.

Basically what I'm doing in the processing function (in pseudocode) is:

Code: Select all

upsample/interpolate incoming audio signal
while (--number of samples in upsampled audio signal >= 0) {
    perform ring mod on upsampled signal using linear interpolation from wavetable
}
downsample/decimate resulting signal into output
Does automating the frequency of ring modulation bring about extra challenges/issues that need to be handled?

Post

I would use naive oscillators and just oversample. The aliasing is usually gone after 16x oversample. Also, you should vectorize the operation according to a SIMD operation.

Post

Ring modulation doesn't produce much new harmonics... it's too linear. That's why it's rarely used as a primary synth technique, but rather to supplement other synthesis techniques:

- Subtractive synthesis: used to create bell tones which would be hard otherwise
- Casio phase distortion: used to remove the buzzy jump in osc sync
- Roland D-50: used to create the saw wave, starting from a square wave
- Roland D-50(bis): used to add exponential decay to sines to fake resonance

Essentially you need to have a synthesis technique that can fully morph between a saw or square wave with more or less infinite spectrum and a sine wave. And then ring modulation lets you adjust the distance between harmonics and potentially correct other aspects of your waveform.

Post

camsr wrote:I would use naive oscillators and just oversample. The aliasing is usually gone after 16x oversample. Also, you should vectorize the operation according to a SIMD operation.
Yep, that's pretty much my next step. I found my problem with the oversampling, fortunately. I had misunderstood some details in implementing my polyphase interpolator/decimator. Gladly, it works! Though with the window-sinc as it is I'm getting about -74dB of stop-band attenuation, so there is some very light aliasing getting through. But it all sounds much better.

I think I'm going to try and convolve the filter kernel with itself for some extra stop-band attenuation and also take advantage of the symmetry of the filter to further optimize and see how that turns out.
MadBrain wrote:Ring modulation doesn't produce much new harmonics... it's too linear. That's why it's rarely used as a primary synth technique, but rather to supplement other synthesis techniques:

- Subtractive synthesis: used to create bell tones which would be hard otherwise
- Casio phase distortion: used to remove the buzzy jump in osc sync
- Roland D-50: used to create the saw wave, starting from a square wave
- Roland D-50(bis): used to add exponential decay to sines to fake resonance

Essentially you need to have a synthesis technique that can fully morph between a saw or square wave with more or less infinite spectrum and a sine wave. And then ring modulation lets you adjust the distance between harmonics and potentially correct other aspects of your waveform.
True. Though while I found that ring modulation didn't produce too many harmonics (even with square and sawtooth waves) while the frequency remained static, I really noticed it quite prominently when I automated the frequency from about 2000 - 3000Hz+.

Post Reply

Return to “DSP and Plugin Development”