beat.isOnset but for kick,snare,hat etc.

edited October 2015 in Library Questions

Hello would you help me, please? I would like to have this ellipse to move by beat, but also but other other sounds like snare, kick or hat for example. Is there some way to do it easy? I tried something like beat.isKick instead of beat.isOnset but it didn't work. Thanks for all tips guys!!

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

Minim minim;
AudioPlayer player;
AudioMetaData meta;
BeatDetect beat;

int  r = 200;
float rad = 70;

void setup()
{
  fullScreen();
  minim = new Minim(this);
  player = minim.loadFile("lilB.mp3");
  meta = player.getMetaData();
  beat = new BeatDetect();
  player.loop();
  //player.play();
  background(0);
}


void draw()
{ 
  beat.detect(player.mix);
  fill(0, 20);
  noStroke();
  rect(0, 0, width, height);
  noFill();
  if (beat.isOnset()) rad = rad*0.9;
  else rad = 70;
  int bsize = player.bufferSize();  
  if (beat.isOnset()) rad = rad+5;
  else rad = 1;
  for (int i = 0; i < bsize; i+=200)
  {  
  fill(255);
  ellipse(200+rad,200,20,20);


}}
Sign In or Register to comment.