## How to deliberately create THD

For general discussions related to SynthMaker.

Moderators: electrogear, exonerate

### Re: How to deliberately create THD

Hi all,

I've started a broad discussion, but now think it has gone to broad, so let me narrow it back by using a specific example.

Let's say I know exactly what series of added harmonics I want. For the example, let me choose at least 6 harmonics, both odd and even and at the ratio of 0.1 from the original tone.

So, if the original tone at input is 100 Hz @ -3 [DbFS] I would like to receive at output 7 tones:

- Original
- 200 Hz @ -23 [DbFS]
- 300 Hz @ -23 [DbFS]
- 400 HZ @ -23 [DbFS]
- 500 Hz @ -23 [DbFS]
- 600 Hz @ -23 [DbFS]
- 700 Hz @ -23 [DbFS]

What is the most effiecient way to create this output?

As mentioned by Trog, I'm sure that there is a more efficient way than just detecting the input (FFT or zero cross count) and then synthesizing the sine waves based on that.

So, that is the core of my question - what mathematical function do the pro VST plug-ins use to "deliberately create THD" for the general case.

Thanks
rocko
essemist

Posts: 59
Joined: Mon Dec 07, 2009 5:25 pm

### Re: How to deliberately create THD

Take a look at Chebyshev Polynomials. However note that you'll find it difficult to implement this with 7 harmonics in SM without getting a fair bit of aliasing. Oversampling filters with only 32 bit coefficients just don't cut the mustard.
Andrew J
smanatic

Posts: 616
Joined: Tue May 29, 2007 4:53 am
Location: Australia

### Re: How to deliberately create THD

rocko wrote:That is to take any signal and produce higher harmonics out of it, odd or even harmonics.

I'm interestead in this for "saturation modelling" and such.

Any efficient way besides finding the frequency and creating higher harmonics synthetically?

As it happens, this is what I did for my first, getting my feet wet, synthmaker project. I was trying to model a 1950's valve oscillator (an Advance H1), and the manufacturer specified that the distortion was approximately equal amounts of second harmonic, third harmonic, and mains hum.

You don't need to 'find the frequency', just take it from the midi in component and multiply to generate harmonics.

Crappy osm attached (has no GUI yet). Comments welcome. Please ignore the failed attempt to make drift with a random number generator and detuner.
You do not have the required permissions to view the files attached to this post.
Nantonos
essemer

Posts: 1
Joined: Sun Jul 08, 2012 8:18 pm

### Re: How to deliberately create THD

Hi,

Thanks for the suggested help and answer, however I'm looking into an effect, i.e. the audio is given to me as is, not as MIDI.

But - as mentioned before, the answer is given by Chebyshev polynomials.

Thanks all !
rocko
essemist

Posts: 59
Joined: Mon Dec 07, 2009 5:25 pm

Previous