# Additive Motion Synthesizer with Processing

``````                                   A. M. O. S.
simulating 2D motion with simple signals

**Motivation and concept:**

Simple Sine waves have always excited me for some reason.
I use them as building blocks in my creative processes whether it’s music synthesis,
generative art, video vediting (smoothing keyframes) 	or anything else that needs that “natural”
flow or pulse.	It wasn’t a surprise to see them appear in motion too.

I knew that many kind of motion, like walking cycles (human and animals alike),
can be expressed as a collection of simple waves applied to joints.
I was fascinated to see that in action so I built this project for doing just that.

Please consider that this is software I made for myself so I’m sure it could be better
in many ways and improved upon.
``````

7 Likes

Nice! Pretty cool. And nice layout of the window too.

Here’s my tiny addition to sine wave uses: A color spectrum. It’s not perfect though, colors are a bit off. Clipping off the bottom part helps (remove commenting in code). And maybe also the top, but then it’s not so much sine-like waves any more (more like triangle waves). But it’s kind of useless I guess.

Btw (as you probably know), you can make square waves out of sine waves.
As a fun tidbit, the opposite holds true too

Test program:

``````
final float offset = 64;
final float clipping = 64;
final float normalize = 256 / (256-clipping);

float waveLRed = 256;
float phaseRed = offset;

float waveLBlu = 256;
float phaseBlu = (256/3.0)+offset;

float waveLGrn = 256;
float phaseGrn = 2*(256/3.0)+offset;

void setup() {
size(800,400);
//background(82, 82, 82);
int xOrigo = 100;
int yOrigo = height-100;
int xsize = 512;
int ysize = 256;
float xScale = xsize/256.0;

stroke(0);

// Axises
line(xOrigo-50, yOrigo, xOrigo+xsize, yOrigo);
line(xOrigo, yOrigo+50, xOrigo, yOrigo-ysize);
line(xOrigo+512, yOrigo+50, xOrigo+512, yOrigo-ysize);

// Draw graph
float redc, grnc, bluc;
int ox = 0;
float oldr = 0;
float oldg = 0;
float oldb = 0;
for (int x=0; x<xsize; x++) {

redc = 127.5 + 127.5 * sin( TWO_PI * (((x/xScale)/waveLRed) + phaseRed/waveLRed) );
grnc = 127.5 + 127.5 * sin( TWO_PI * (((x/xScale)/waveLGrn) + phaseGrn/waveLGrn) );
bluc = 127.5 + 127.5 * sin( TWO_PI * (((x/xScale)/waveLBlu) + phaseBlu/waveLBlu) );

/**     // clip bottom
redc -= clipping;
grnc -= clipping;
bluc -= clipping;

if (redc<0) redc = 0;
if (grnc<0) grnc = 0;
if (bluc<0) bluc = 0;

redc = round(redc * normalize);
grnc = round(grnc * normalize);
bluc = round(bluc * normalize);
*/
// Draw sine curves
if (x>0) {
stroke(255, 0, 0);
line (ox+xOrigo, yOrigo-oldr, x+xOrigo, yOrigo-redc);
stroke(0, 128, 0);
line (ox+xOrigo, yOrigo-oldg, x+xOrigo, yOrigo-grnc);
stroke(0, 0, 255);
line (ox+xOrigo, yOrigo-oldb, x+xOrigo, yOrigo-bluc);
}

// show spectrum
stroke(redc, grnc, bluc);
line (x+xOrigo, yOrigo+10, x+xOrigo, yOrigo+50);

ox = x;
oldr = redc;
oldg = grnc;
oldb = bluc;
}

}

void draw() {
}

``````
2 Likes

thanks so much, and also for your suggestion

Thank you so much for sharing this exciting project.

Would you consider making it available as a github repository? (Dropbox shares tend to get broken rather quickly.)

thanks,
I would definitely consider but don’t laugh - I don’t quite know how to.

2 Likes

If you decide to do it and create a github account – and then get stuck for any reason – let us know and we can give you help with a walkthrough.

It can seem like overkill to set up at first, but it is a great way to make your code freely available – and get feedback / contributions as needed.

2 Likes

Just thought I’d drop a link to this awesome Fourier series video here for some reason

1 Like

my thoughts exactly

1 Like