Electronic – How many harmonics are needed to produce a proper square/saw/triangle/etc wave

signalsoundsynthesis

I'm new to software sound synthesis, but I have a question that I can't seem to find the answer to.

I understand that, for example, a square wave at 100 Hz has its third harmonic at 300 Hz with 1/3 the amplitude; its fifth harmonic at 500 Hz with 1/5 the amplitude; ad infinitum…

My question is, how many multiples do I need to calculate for it to sound like a proper square wave using additive synthesis, i.e. calculating a Fourier series? How many harmonics is overkill?

Is that number the same for each type of basic waveforms: square, saw, triangle, and pulse waves?

Best Answer

As usual, there are several issues:

What is the highest frequency required?

The hearing ability of a normal young human is 20 Hz to 20 KHz, although most people are in the 20 Hz to 15 KHz. If you add harmonics that are higher in frequency than 20 KHz, almost nobody will notice and almost no sound system can reproduce it with any fidelity.

So to directly answer your question about the number of harmonics required: The absolute number is less important than the max frequency. You can stop adding harmonics when the frequency gets above 20 KHz (and possibly sooner). A high pitched note will require less harmonics than a bass note.

Back in the 80's and early 90's there were additive synthesizers (Kawai K5 comes to mind) that had 128 sine wave generators per note. The difference, however, is that many of those sine waves were generating non-harmonic frequencies. A piano, for example, has three strings per note and each string is tuned slightly off from the fundamental, and each string has its own harmonics and sub-harmonics. A flute has some "breath noise" that is unrelated to the fundamental. When you take these into account you could need much more frequencies than what would be obvious from the fundamental pitch and its direct harmonics.

Do I need accurate reproduction of the triangle/sawtooth/square wave?

Put another way, does the waveform when viewed on an o-scope need to look like an accurate wave? Absolutely not! Having a perfect waveform on the o-scope does not translate into having "higher fidelity" or "more faithful reproduction". All it ultimately means is that you have frequencies that are higher than what a human can hear.

Additionally, you are making a synth. And that synth will have its own set of quirks and nuances-- just like any other musical instrument. You will not be able to make a completely faithful piano our flute sound, for example. And even if you could, it would not be as expressive or controllable as a real flute. Having great sound is a good goal, but you don't need to make it call dogs to have a very usable and useful instrument.