SynthMaker

Sum?

Archive · 2006 11 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

tecknoize ·

Hi guys!

I'm on my way to make a wavetable generator using additive synthesis. I'm at one step close in fact. All I need to do is sum up my sin calculation.

Currently, my schematic is build this way:

I use only one sin module to do the calculation. I have an array of coefficient (calculated to make a saw wave). I have a counter for the number of sine wave that need to be added together. I have a counter for the time axis (x).

Since everything gets calculated from only one sin module, I'm having a hard time figuring out how I would sum up the values that gets out of it.

In a code module, it should look like this :

floatarrayin coefficient; floatout out;

float sum; float x; float cIndex; float acc;

loop(256){

loop(20){ sum = sum + (coefficent[cIndex]*sin(acc*x)); cIndex = cIndex + 1; acc = acc + 1; } x = x + 1; cIndex = 0; sum = 0; }

(mmm... green code module) 😇

Anyway, take a look at my messy shem.

Thanks!

rl ·

mh,... I could think of several ways: - at the end of your schematic connect a Float Add and chain a Float as a value accumulator. Feedback the out of the Float to the other input of the Float Add.

- alternatively (and maybe easier) use a Graph Create to build up a graph of the values and a Graph Sum for summing up the values.

does this help?

(edit) Another possible solution is to create a single cycle waveform by using an analyser and the code module with the code of your inner loop (the loop(20) block). Use 256 for the Number of Samples, so the Analyzer implements the outer loop. Feed the Graph out into a WaveTable module - et voilla - you have a bandlimited wavetable.

tecknoize ·

Well first of all thanks!

The Float Add/Float works well and the Graph Sum too. The only problem is that I need to reset that sum to 0 once I've finished a cycle. I'm at work right now so I can't really play with SM.

Any idea?

Also, I think I might need a little bit more explaination on the last method :P

And the silly question : what is a bandlimited waveform? 😊 Thanks!

rlahalla ·

it's a waveform limited with a band. . . . . .

hehe, I'm sorry that was so stupid, but I couldn't resist 😀

feel free to yell at me for that one -

tecknoize ·

😀 I think we need a 'AWESOME' from stefan for that one! 😉

rl ·

Bandlimiting means you limit upper spectral bands to avoid aliasing. Let's for example take a signal at note A=220 Hz. A saw as in your example using 20 bins has the highest frequency component 20*220=4400 Hz. If you play this note 2 octaves above this is 4 * 4400 Hz = 17600 Hz. Using a sampling frequency of 44100Hz you are below the nyquist frequence (fs/2, or 22050 Hz), but 3 octaves above you are at 8*4400 Hz=35200 Hz where you can expect heavy aliasing. So at this note A''' you have to limit the saw wave with 22050/(220*8) = 12,5 = 12 bins.

rlahalla ·

Ok, so RL went a bit more in depth on that 🙂 Actually, thats great info, and is extremely helpful, so thanks RL!

tecknoize ·

Thanks! Took me 2 reading to understand but I got it! But...

So at this note A''' you have to limit the saw wave with 22050/(220*8) = 12,5 = 12 bins.

Does that mean that the number of bins needs to fluctuate according to the note being played or it just need to use 12 bins steady?

rl ·

tecknoize wrote: Also, I think I might need a little bit more explaination on the last method :P

Here is a little sketch: The code module driven by the analyzer creates a single cycle wave which is fed into a wavetable module (the wavetable module internally does spectral analysis and creates a series of bandlimited waves) Download

tecknoize wrote: Does that mean that the number of bins needs to fluctuate according to the note being played or it just need to use 12 bins steady?

typically the number of bins would fluctuate. the lower the note the richer the spectral content. A 22050 Hz saw (at 44100 hz sample frequency) would remain as a simple sinewave.

oddson ·

rl wrote: ...A 22050 Hz saw (at 44100 hz sample frequency) would remain as a simple sinewave.

And inaudible to all but dogs with good hearing and great speakers.

tecknoize ·

That's some great info for my brain 😉 And while your at it .... 🙂

What is a 'cycle' ?

In your example, you're adding up 1 cycle of sin.

if the equation is sin1(x)

the cycle is x?

Also, what's means 256x256 wavetable?

256 samples x 256 cycles? 256 bins x 256 cycles?

Thanks!

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.