SynthMaker

My forst Code - Multimod

Archive · 2007 10 old posts

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

minione ·

Hello all, iv vaste alot of time with this:

streamin in; streamin mod; streamin amt; streamin samplrate; streamin freqC; streamin freqM; streamin phase;

streamout outFM; streamout outPM; streamout outAM; float A0, a, A1; float T; float pi; float W, W0, ph, ph1; float fdev, ratio, s, k; s= mod*amt; ph1 = ph + k*s; A0 = in; ratio = freqM / freqC; ph = phase*360; k = ratio; T = 1/freqC; pi = 3.141593; W0 = 1 / (2 * pi * T); W = W0 + k*s; outFM = A0*cos1((((W0*W0)/2)+(k*T*((s*s)/2))) -(((W0*W0)/2)+(k*0*((s*s)/2)))+ph);

outPM = A0*cos1(W0*T+ph1); A1 = k*s+A0; outAM = A1*cos1(W0*T+ph);

this is a multi modulation, what do you thing is it true or pseudo? here is the osm http://www.mediafire.com/?1nrknjqzzqr can u see a mistakes there? source: AM:

s - modulator, k - ratio. FM:

PM:

PS:i think that its wrong to assign integral's "t" to period, i think its time, but how can i get a time value? and phase, mb it must be multiplied with 2*pi(is it radians or degrees)? check check check)

unkargherth ·

well, some things to note even without trying you code:

a) sin1 and cos1 functions already internally multiply by 2*pi, so entry range is always 0..1 b) FM is usually implemented as Phase Modulation cause, the result is auditively very similar but much more stable c) AM is usually implemente as simple multiplication of two waves, rather than a code segment that generates the two waves, for eficiency reasons d) Why you multply phase by 360 ? As per a) phase goea always in range 0..1 e) At this line

outFM = A0*cos1((((W0*W0)/2)+(k*T*((s*s)/2))) -(((W0*W0)/2)+(k*0*((s*s)/2)))+ph);

the term (k*0*((s*s)/2))) seems to be always 0. If this is true you can simply delete it

f) Althought is probably matemathically correct, this is far from beign optimal in efficiency terms.

For last. There are simpler ways to do it all: in short

AM: take two sine primitives, rectify(convert to slways positive) one of them and multipliy by the other. Provided Freq of the positive one is very low ( in LFO range) you get AM

FM: Same two sines: the opuput of the modulator info the Fase Input of carrier. If you previously adjust the frequencies ( the famous M/C ratio) you get FM, ( but if its to deep you get heavy aliasing)

PM: Although I don't fully understand the conecpt I suspect that using a very small M/C factor (M much lesser than C) on the FM structure you get what can be called Phase Modulation

minione ·

thx for checkin, just iv created this not bcause didnt mind how to connect 2 osc between and get true modulation, just i wanna to create flexible controling of it, and i going to do some experiments with this code: try to make that one wave controlse the amplitude of second, second controls frequency of third, third phase of first etc etc, and i still want to make its code correct(of course ill simplify it, thanx for advices)... therefore i was requested for find some mistakes, anyway, when i create what i want ill post it here. PS: there is ringmodulation that included in schematic (not code), is that correct rm algorithm? PPS: Though on the other side, probably it is better to work with PWM oscs...

unkargherth ·

Get a sample of my point of view above on the wiki

minione ·

thank you for basics, but, unfortunely, i cant get not modulated signal without trning off the modulator, that cant i say about single modulation module 😕 bad... to make more enhanceblity, make more complicated... (all about FM now, for AM thanx, and if u no want to check the file my rm is so: acos carier + acos modulaatr ) * (acos car. - acosmodulatr) just your RM seems to be AM in real )

unkargherth ·

You're true in your RM definition, in pure analogical terms ( you get sum and diference sidebands). But Once you enter in digital terms you find that simply multiplying gives you same "harmonic content" at the end

The only problem is that made so simple it aliases a lot

On the FM issue simply turn all to right the depth knob to get a clean carrier. Remember. Phase input ADDS to phase, not MULTIPLY so inputing a 0 leaves phase free running, ie, without modulation

unkargherth ·

ok. here it comes a bit more complex fm sample

This itime i included Self modulation (AKA Oscillator feedback)

be carefull with the modulation ammounts ( amount knob on envelopes). It's very easy to get rubbish noise on high values

Also the whole thing have a strong tendency to alias at higher pitchs

As usual get it at Wiki

infuzion ·

unkargherth wrote: Get a sample of my point of view above on the wiki

By your definition unk, I don't see where the AM example gets to be all positive; I tested with a Poly Readout & see negitives. After I use this code from sambean/jeorge after the multiplied knob, it does seem do more what you say it should: streamin i; streamout o; float absmask; stage(0) { absmask = 3.4e38|0.999999|0.1; } stage(1) { o = i&absmask; }

Am I seeing things wrong? cheers

unkargherth ·

As always infuzion, you're true. I forgot to ABSolutize the modulator in AM. Corrected and reuploaded the file to wiki, same url as before

infuzion ·

unkargherth wrote: As always infuzion, you're true. I forgot to ABSolutize the modulator in AM. Corrected and reuploaded the file to wiki, same url as before

I'm not always true, just a bit more anal than most 🙂 Actually, I never could grasp the difference between AM & Ring untill now, thanks to your post here.

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.