Friday, 12 October 2012

Beat Tutorial

I have played with a couple of techniques that I have learnt from a tutorial on beats.

I am able to make images appear on the sound of a beat from a song using a simple snippet of code and by having the song appear in the same folder as the program.

///The following is the code I have used for beat practice.


import ddf.minim.*;
import ddf.minim.analysis.*;

Minim minim;
AudioPlayer song;
BeatDetect beat;

void setup(){
    size(400, 400);
    noStroke();
    background(255, 0, 0);
    minim = new Minim(this);
    song = minim.loadFile("Somebody That I Used To Know.mp3");
    song.play();
    beat = new BeatDetect();
}

void draw(){
    fill(0, 10);
    rect(0, 0, width, height);                beat.detect(song.mix);
    if (beat.isOnset()){
     
PImage both;
both = loadImage ("Eyeball 4c.png");
both.resize (160,50);
image(both,random(50,450),random(50,450));

    }
}

void stop(){
    song.close();
    minim.stop();
    super.stop();
}




////////



This is entertaining as I can play differnt songs that have different beats and they will all make the images pop up at different times.

Some interesting songs that I have practiced with are:
psycho killer by the talking heads,
throw down by tenacious d,
somebody that I used to know by Gotye ft Kimbra.

No comments:

Post a Comment