# Additive Motion Synthesizer with Processing

**URL:** <https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607>\
**Category:** Gallery\
**Created:** [May 26, 2019, 12:35pm UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607 "2019-05-26T12:35:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yairkass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yairkass/32/5366_2.png) [@yairkass](https://discourse.processing.org/u/yairkass)\
**Post date:** [May 26, 2019, 12:35pm UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/1 "2019-05-26T12:35:53Z")

</div>

![AMOS%20demo](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/bbb0c6a034709a47860184edd97d23a2628b9aa5.gif)

```
                                   A. M. O. S. 
                           ADDITIVE MOTION SYNTHSIS  
                     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.

```

To download the software (processing .pde file) and all related readme and help, go to this link:

> **[AMOS](https://www.dropbox.com/sh/zvzbrr8bc6uhfd8/AAAR-dUVwkh6AJjZwoyJP_Q-a?dl=0)**
>
> Shared with Dropbox

---

<div class="post-metadata">

**Author:** ![raron](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/raron/32/13651_2.png) [@raron](https://discourse.processing.org/u/raron)\
**Post date:** [May 28, 2019, 7:28am UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/2 "2019-05-28T07:28:53Z")

</div>

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](https://www.mathworks.com/help/matlab/examples/square-wave-from-sine-waves.html).  
As a fun tidbit, the [opposite](http://www.thepulsar.be/article/generating-sine-wave-from-square-waves/) holds true too 🙂

Test program:

```auto

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() {
}

```

---

<div class="post-metadata">

**Author:** ![yairkass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yairkass/32/5366_2.png) [@yairkass](https://discourse.processing.org/u/yairkass)\
**Post date:** [May 28, 2019, 7:46am UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/3 "2019-05-28T07:46:50Z")

</div>

thanks so much, and also for your suggestion 🙂

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 1, 2019, 5:07pm UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/4 "2019-06-01T17:07:43Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![yairkass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yairkass/32/5366_2.png) [@yairkass](https://discourse.processing.org/u/yairkass)\
**Post date:** [June 2, 2019, 7:32am UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/5 "2019-06-02T07:32:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 2, 2019, 1:05pm UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/6 "2019-06-02T13:05:04Z")

</div>

> [@Upload files that are not images](https://discourse.processing.org/t/upload-files-that-are-not-images/5933/3):
>
> For code w/ data assets, just create a GitHub repo for it: octopus[Help.GitHub.com/articles/create-a-repo/](http://Help.GitHub.com/articles/create-a-repo/) After that, you can drag & drop your code’s root folder into your repo: file_folder[Help.GitHub.com/articles/adding-a-file-to-a-repository/](http://Help.GitHub.com/articles/adding-a-file-to-a-repository/) Here’s a repo example for a sketch containing lotsa data assets: card_file_box

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 2, 2019, 8:13pm UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/7 "2019-06-02T20:13:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![raron](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/raron/32/13651_2.png) [@raron](https://discourse.processing.org/u/raron)\
**Post date:** [July 5, 2019, 10:46pm UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/8 "2019-07-05T22:46:28Z")

</div>

Just thought I’d drop a link to this awesome [Fourier series video](https://www.youtube.com/watch?v=r6sGWTCMz2k) here for some reason 🙂

---

<div class="post-metadata">

**Author:** ![yairkass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yairkass/32/5366_2.png) [@yairkass](https://discourse.processing.org/u/yairkass)\
**Post date:** [July 8, 2019, 7:52am UTC](https://discourse.processing.org/t/additive-motion-synthesizer-with-processing/11607/9 "2019-07-08T07:52:51Z")

</div>

my thoughts exactly 🙂
