Bandslimited synthesis - get number of harmonics

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

User avatar
Lyberta
Established Member
Posts: 650
Joined: Sat Nov 01, 2014 8:15 pm
Location: The Internet
Contact:

Bandslimited synthesis - get number of harmonics

Postby Lyberta » Wed Nov 08, 2017 8:59 am


User avatar
sadko4u
Established Member
Posts: 610
Joined: Mon Sep 28, 2015 9:03 pm

Re: Bandslimited synthesis - get number of harmonics

Postby sadko4u » Wed Nov 08, 2017 3:41 pm

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.
LSP (Linux Studio Plugins) Developer and Maintainer.

User avatar
Lyberta
Established Member
Posts: 650
Joined: Sat Nov 01, 2014 8:15 pm
Location: The Internet
Contact:

Re: Bandslimited synthesis - get number of harmonics

Postby Lyberta » Wed Nov 08, 2017 4:35 pm

It is so funny that you can't even read:
Here's what I've come up with intuition


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

ssj71
Established Member
Posts: 1262
Joined: Tue Sep 25, 2012 6:36 pm

Re: Bandslimited synthesis - get number of harmonics

Postby ssj71 » Wed Nov 08, 2017 5:39 pm

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!

User avatar
CrocoDuck
Established Member
Posts: 960
Joined: Sat May 05, 2012 6:12 pm
Contact:

Re: Bandslimited synthesis - get number of harmonics

Postby CrocoDuck » Wed Nov 08, 2017 6:43 pm

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.
Check my Linux audio experiments on my SoundCloud.
Browse my AUR packages.
Fancying a swim in the pond?

User avatar
Lyberta
Established Member
Posts: 650
Joined: Sat Nov 01, 2014 8:15 pm
Location: The Internet
Contact:

Re: Bandslimited synthesis - get number of harmonics

Postby Lyberta » Thu Nov 09, 2017 4:24 am

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