Making shapes move with audio in Processing.

25/01/2019

Today Chris showed us on Processing he mad a shape and when he played music started playing and the shape would move to the beat/song and now we’ve to find our own song and get creative with the shapes and drop down what we want.

I’ve downloaded a song called ‘Sail’ it’s got good beats to it so the shapes should move real good. For the shape I’m going to go with a circle or maybe a triangle, I’ll try both and see what’s best.
Next we had to go and download a program called Sonic Pi, that’s the program we’re going to be using for the coding with audio.

We got sent a code and we had to put our own song into the code and our own shapes.

Code

import ddf.minim.*;
Minim minim;
AudioPlayer player;
void setup() {
  minim=new Minim(this);
  player = minim.loadFile(“myTrack.mp3”);
  size(800,800);
  player.play();
}
void draw() {
 background(250);
 ellipse(400,400,player.left.get(1)*800,200);
}
Update
After I finished adding my song into it and adding shapes this is what it looks like. (picture below) as you can see the song is playing and the shapes go along with the song/beat.

This is my code after sorting out my code and shapes.

Code

import ddf.minim.*;

Minim minim;

AudioPlayer player;

void setup() {
minim=new Minim(this);
player = minim.loadFile(“myTrack.mp3”);
size(800,800);
player.play();

}

void draw() {
background(250);
fill(0,170,233);
ellipse(350,140,player.left.get(1)*800,200);
fill(205,32,54);
ellipse(350,180,player.left.get(1)*800,200);
fill(0,173,140);
ellipse(350,220,player.left.get(1)*800,200);
fill(141,38,124);
ellipse(350,260,player.left.get(1)*800,200);
fill(133,209,213);
ellipse(350,300,player.left.get(1)*800,200);
fill(100,100,100);
ellipse(350,340,player.left.get(1)*800,200);
fill(0,0,0);
rect(350,340,player.left.get(1)*800,30);
fill(0,255,0);
ellipse(0,800,player.left.get(1)*800,200);
fill(255,0,0);
ellipse(800,800,player.left.get(1)*800,200);
}

Leave a comment

Blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started