Minim & PDF - Repetetive waveforms
in
Core Library Questions
•
1 year ago
Hi there!
So, I'm currently working on project for my friend, and she had idea about making a real physical wallpaper out of the waveform. Just a pure waveform, derived from some piece by Mozart or Bach, or someone. Well, it's kind of working. My plan is to print it out on multiple sheets and put them together. So far I've managed to draw waveform to Pdf file, even printing on multiple pages, using Minim & PDF libraries. But my problem lies in the result.
I have no idea why, but result is very, very repetitive.And maybe it's not reading the way it supposed to be reading, because I tried to run some wav samples it dubby basses with few upper harmonics and result was nothing even nearly looking as waveform in Audition or Ableton Live.
Anybody has an idea why is this happening?
- import processing.opengl.*; //just for testing
import processing.pdf.*;
import ddf.minim.*;
Minim minim;
AudioPlayer groove;
int parts = 50;
int count = 0;
boolean test;
void setup()
{
//size(1200, 900, OPENGL);
size(841, 1200, PDF, "test_out.pdf");
frameRate(400);
minim = new Minim(this);
// try changing the buffer size to see how it changes the effect
groove = minim.loadFile("groove.wav", 12000);
groove.play();
background(0);
}
void draw()
{
PGraphicsPDF pdf = (PGraphicsPDF) g;
pushMatrix();
strokeWeight(0.05);
stroke(255);
translate(count*(width/parts), 0);
for ( int i = 0; i < groove.bufferSize() - 1; i++ )
{
float x1 = map(i, 0, groove.bufferSize(), 0, width)/parts;
float x2 = map(i+1, 0, groove.bufferSize(), 0, width)/parts;
pdf.line(x1, height/2 - groove.left.get(i)*400, x2, height/2 - groove.left.get(i+1)*400);
}
count++;
if (count > parts) {
pdf.nextPage();
background(0);
count = 0;
}
popMatrix();
println(frameRate);
test = groove.isPlaying();
if (test == false) {
println("done!");
exit();
}
}
void stop()
{
// always close Minim audio classes when you finish with them
groove.close();
// always stop Minim before exiting
minim.stop();
super.stop();
}
1