## Bandslimited synthesis - get number of harmonics

**Moderators:** khz, MattKingUSA

### Bandslimited synthesis - get number of harmonics

The question is here: https://stackoverflow.com/questions/468 ... -harmonics

### Re: Bandslimited synthesis - get number of harmonics

It wouldn't be so funny if it wasn't really so sad.

The answer is in your code copy-paste.

Obviously, the highest harmonic number is numharmonics.

The answer is in your code copy-paste.

Obviously, the highest harmonic number is numharmonics.

LSP (Linux Studio Plugins) Developer and Maintainer.

### Re: Bandslimited synthesis - get number of harmonics

It is so funny that you can't even read:

I wrote this code myself. I just don't know if numharmonics is correct.

Here's what I've come up with intuition

I wrote this code myself. I just don't know if numharmonics is correct.

### Re: Bandslimited synthesis - get number of harmonics

freq*n gives you the frequency of the nth harmonic. as long as its below nyquist (samplerate/2) then you are fine. So your equation for nharmonics is correct. I didn't really look at the rest of it.

_ssj71

music: https://soundcloud.com/ssj71

My plugins are Infamous! http://ssj71.github.io/infamousPlugins

I just want to get back to making music!

music: https://soundcloud.com/ssj71

My plugins are Infamous! http://ssj71.github.io/infamousPlugins

I just want to get back to making music!

### Re: Bandslimited synthesis - get number of harmonics

I just had a look at it quickly. Hope I am not too tired to figure out maths...

Pulse Wave:

It does look like the pulse wave is a sum of tones whose frequency grows as nf, where f is the fundamental and n = 1,2,3,....

So, if we call N the maximum allowed number of harmonics: Nf < fs / 2 <=> N < fs / 2f = harmonics order limit.

Where fs is the sample rate.

Triangle Wave:

This time the harmonic's frequencies goes like (2n + 1)f, hence:

(2N + 1)f < fs / 2 <=> N < (fs / 2f - 1) / 2 = harmonics order limit.

Sawtooth Wave:

As the Pulse Wave.

Pulse Wave:

It does look like the pulse wave is a sum of tones whose frequency grows as nf, where f is the fundamental and n = 1,2,3,....

So, if we call N the maximum allowed number of harmonics: Nf < fs / 2 <=> N < fs / 2f = harmonics order limit.

Where fs is the sample rate.

Triangle Wave:

This time the harmonic's frequencies goes like (2n + 1)f, hence:

(2N + 1)f < fs / 2 <=> N < (fs / 2f - 1) / 2 = harmonics order limit.

Sawtooth Wave:

As the Pulse Wave.

Check my Linux audio experiments on my SoundCloud.

Browse my AUR packages.

Fancying a swim in the pond?

Browse my AUR packages.

Fancying a swim in the pond?

### Re: Bandslimited synthesis - get number of harmonics

Alright, so my code was correct, phew.

Return to “Developer's Section”

### Who is online

Users browsing this forum: No registered users and 1 guest