A Theory Question on Octave Effects and Harmonics

Started by turdadactyl, September 02, 2016, 10:39:34 AM

Previous topic - Next topic

turdadactyl

I've been diving into some theory.  Batting this stuff around is always helpful to me in fully comprehending it.  So, a thought/question.

I've been reading about the harmonics produced by distorting sinusoidal waves and even vs. odd transfer functions.  An odd function (symmetrical about the origin) will produce odd order harmonics when clipped.  An even function (symmetrical about the Y axis) will produce even.  Here's my question (in multiple parts, for good measure):


  • If I take a sinusoidal input, split it, rectify one of the signals, distort both the original signal and the rectified version, and then sum them, will I get both odd (from the original) and even (from the rectified) harmonics?

  • Assuming so, is it correct that the even harmonics (and particularly the second order harmonic) will produce an octave up effect?

  • If I then use a pot to mix the balance of the two signals, would I get the octave up without the original when it was all the way toward the rectified input and the original without the octave when it's all the way toward the original?


amptramp

The following website has Fourier transforms for various operations including halfwave and fullwave rectification.  Fullwave rectification eliminates the fundamental, so all you get are higher-order harmonics.  The second harmonic is a signal that is one octave up.  There is a table of Fourier Coefficients here:

http://www.calpoly.edu/~fowen/me318/FourierSeriesTable.pdf

and you can see it more graphically here, although you have to choose sine or cosine then fullwave or halfwave to see the coefficients, which you can see by moving the cursor over the harmonic in question:

http://www.falstad.com/fourier/

There have been some interesting uses of signal distortion and mixing:  I have a Minshall Model E organ with vacuum tube dividers.  Since the dividers were such a problem to design, they used an interesting method to get the pedalboard signals: they combined a signal and a signal musical fifth above that and multiplied them to get an octave down e.g. C1 multiplied by G1 will give a difference frequency of C0 where the numbers are the octave order of the note and C0 is an octave down from C1.

The answer to your question 1 is yes if you use fullwave rectification.
The answer to your question 2 is you will have the second harmonic which is an octave up but also a number of other higher harmonics so you may have to filter these out to get something that sounds like a clean octave up.
The answer to your question 3 is that you can go from all of one output and none of the other to an additive sum of both signals.  Note that the fullwave rectified signal has many higher harmonics, so if it is filtered, you will get a cleaner second harmonic output.


turdadactyl

Well that sounds like a big ol' mess of impossible math (at least in the analog world).  Based on the input frequency I guess you could set up a LPF with the cutoff at the second harmonic.  Of course, that sounds like a job for digital.  (That all assumes I insisted on using the FWR method to get the even harmonics.)

Rixen

With a polyphonic input things are much more complicated with intermodulation products being produced, as well as the harmonics. In theory if you can isolate each string and distort it individually it is possible to get harmonics without intermodulation products, but the result sounds thin and lacks balls..

Transmogrifox

Rixen beat me to it regarding polyphonic signals.

Octave up and octave down effects in analog are messy because you can't expect that all incoming signals are pure sine waves.  You can do something that approximates a fourier transform with a bank of narrow-bandpass filters, do nonlinear junk to the filter outputs and run it through another bank of filters spaced at musical intervals and mix the outputs of the filters you want (there's a bit project to build and tune all those filters). To be very selective about which output filters you grab then you need to use a bank of envelope detectors and VCA's to decide which filter taps to use and at what ratios.

However, practical octave-up and down circuits do work relatively well with judicious (simple low-pass) filtering based on generalizations we can make about signals coming from a typical instrument.  Existing analog octave-up and down designs represent a good balance of function and simplicity.

In the end working out perfect theory on pure sine waves doesn't give you much more advantage than generalizations since all your theory goes out the window when you present the input with a polyphonic signal. 

The thing you miss in pure-sine theory is the fact that distorting or rectifying a multi-frequency signal creates multiples of the differences between all frequencies involved, so what you get is a spectral mess that you would never care to sort out with an analog circuit unless somebody was paying your living to just play in a lab and do interesting stuff whether or not you produced something marketable.

If you want clean pitch changes then digital certainly makes it easier.  Here's one method that uses some CPU cycles, but it works very well on guitar:
http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/
And the last item in the FAQ reveals some of the limitations:
http://blogs.zynaptiq.com/bernsee/category/faq/

And I don't know where the code has moved since the demise of dspdimension but there is a working C++ implementation of it in the Rakarrack repository (I know because I modified it to use the Ron Mayer FFT function swiped from PureData).

Also there are the more simplified resampling methods, and some better when combined with spectral analysis to make resampling intervals pitch-synchronous (like autotalent)

All that said, you might get decent single-note cleaner octave-up effect with a bank of, say, 8 state-variable biquad filters then apply traditional rectify/distort/frequency divider type of things then map nonlinear process outputs to another set of 8 bandpass filters and recombine.  Maybe even start more simple by dividing the spectrum into 2 or 4 bands and see if it's an improvement on existing implementations.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

TejfolvonDanone

The real problems with analogue octave up effects are:
1) you can't easily produce polyphonic octave up
2) you can't really produce a clean octave effect
You can't have a clean output because the original signal had a lot of frequencies beyond the fundamental and rectificating won't just double all the frequencies of the harmonics. There will be residual 3rd 5th and all sort of harmonics of the original signal.
If the octave up is not clean (you have only the harmonics of the octave frequency: if you have an input with 110 Hz fundamental you get only the 220 Hz 440Hz 660 Hz etc frequencies) your brain will hear the original fundamental signal as if it were there. So if you have signal with frequencies of 220Hz 330Hz 440Hz 550Hz etc you hear it as an A with a fundamental of 110Hz.
You also can't clear out those residual non-harmonic-to-the-octave type of frequency components with a simple low pass filter because you will clear all the harmonics of the octave too. You certainly can make it cleaner but it will never be clear.
That's why analogue octave effects work best when you play on the 12+ frets: they are much more like a sine than all the lower notes.
So whatever rectification you use and however you mix your signals you won't get a clear octave up on the lower frets. Don't be disappointed.

Quoteeven vs. odd transfer functions
The term transfer function in electronics generally means that the system is linear. That means no (harmonic) distortion is created. Rectification is a really big distortion in this sense.
...and have a marvelous day.

ElectricDruid

Quote from: turdadactyl on September 02, 2016, 10:39:34 AM
If I take a sinusoidal input, split it, rectify one of the signals, distort both the original signal and the rectified version, and then sum them, will I get both odd (from the original) and even (from the rectified) harmonics?

If you take a sinusoidal input and rectify it, you'll get a non-sinusoidal signal at twice the frequency. It will have quite a lot of harmonics because of the narrow spike. You just changed your sine wave into something much more like a curved version of a narrow pulse wave, after all.

Assuming your distortion process is symmetrical, it will only produce odd harmonics (although many distortions are designed to *avoid* exactly this) and you'll get odd harmonics from your original input and even harmonics from the rectified version (although that would be true without the distortion too).

In practice, the input waveform to the rectifier won't be identical top and bottom, so when folded over, the fundamental won't completely disappear.

QuoteAssuming so, is it correct that the even harmonics (and particularly the second order harmonic) will produce an octave up effect?

Yes. If you can/could eliminate the fundamental, you'd have a pure octave up effect. That's a fairly big "if". In practice, you get a sound which is like a mixture of the fundamental and some octave up effect.

QuoteIf I then use a pot to mix the balance of the two signals, would I get the octave up without the original when it was all the way toward the rectified input and the original without the octave when it's all the way toward the original?

Yes. If you've overcome the other problems, this is the easy bit! Just mix and go!

HTH,
Tom