We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey everyone!
I need some help with this sketch/project I'm doing for class. Right now I am trying to get my lines to respond to sound, I want them to extend outward as the music plays. I am new to processing and would really appreciate the help, thanks.
If you need more info just ask.
Code:
import ddf.minim.*;
Minim minim; AudioPlayer player;
static final int numLines = 63; float z;
void setup() { minim = new Minim(this); player = minim.loadFile("generic song"); player.loop(); background(20); size(800, 800); } void draw() {
background(20); stroke(167); strokeWeight(5);
translate(width/2, height/2); for (int i = 0; i < numLines; i++) { line(x1(z + i), y1(z + i), x2(z + i), y2(z + i)); } z+= 0.05; }
float x1(float z) { return sin(z/10) * 100 + sin(z); }
float y1(float z) { return cos(z/10) * 100; }
float x2(float z) { return sin(z/10) * 200 + sin(z); }
float y2(float z) { return cos(z/10) * 200 + cos(z/12);
Answers
Did you look at the reference for minim? It’s all there
I have been and narrowed it down to a couple. Have any recommendations?
the fft routines will get you the music's frequencies, about 20 or 30 numbers a frame. the left / right / mix methods will get you the waveform, about 1000 numbers per frame. choose which better suits what you want to do.
http://code.compartmental.net/minim/audiooutput_field_mix.html