I'd like to do a project which involves creating sound-buffers in Minim, reading sample files into them, analysing them with FFT, processing them with both the Minim effects such as filters and my own algorithms (which means acting on the array of sample points), and finally saving transformed buffers to disk. I don't need to do this in real time.
Is there an object in Minim that I can use for this? The audio buffer objects I can find seem to be read-only. And the effects seem to be designed to be part of a chain rather than just applied to a buffer. Or can they be used in an "off-line" mode?
Has anyone successfully used Antlr in a Processing sketch?
I downloaded the antlr-3.3-complete.jar file from the site and put it in ~/sketchbook/libraries/antlr/library/ which is where I would expect Processing to find it, but no luck.
Anyone done this? And if so, where do you put the library?
Thanks to someone here, that problem was solved but I can't quite figure out how to create a PDF of a particular size, manipulate it, and then save it again.
What I
can do is this :
PGraphicsPDF pdf;
pdf = (PGraphicsPDF)beginRaw(PDF, "find.pdf");
pdf.beginDraw();
// do some stuff with pdf as the graphics canvas
pdf.endDraw();
endRaw();
This works to create a pdf, draw on it and save it to disk. But using beginRaw this way doesn't allow me to set the size / resolution of the pdf file.
Alternatively I can do this :
PGraphicsPDF pdf;
pdf = (PGraphicsPDF)createGraphics(paper_x, paper_y, PDF, "find.pdf");
pdf.beginDraw();
// do some stuff with pdf as the graphics canvas
pdf.endDraw();
Which would seem to let me define the width and height of the pdf file. But I can't find any example online of then saving the pdf into a file. In every pdf file writing example I've discovered, writing to file just seems to happen at endRaw()
But there must be another way of achieving this if you aren't using the beginRaw / endRaw methods.
cheers
phil
Update :
I should mention. If I just try to do a
pdf.save("fileName.pdf");
after the pdf.endDraw() I get the following exception :
java.lang.RuntimeException: No save() for PGraphicsPDF
at processing.pdf.PGraphicsPDF.nope(Unknown Source)
at processing.pdf.PGraphicsPDF.save(Unknown Source)
Clearly, something in Processing's PDF library knows how to write a PDF file. But it seems that that knowledge hasn't been incorporated into the PGraphicsPDF class.
I'm trying to create PDFs from my Processing sketch. But, crucially, the PDFs are not recordings of what I'm doing on the main screen. I want to treat them as any other PGraphics and have some code that knows about PGraphics to write on them while the screen shows something completely different.
Here's what I'm trying :
PGraphicsPDF pdf;
pdf = (PGraphicsPDF)createGraphics(paper_x, paper_y, PDF, "find.pdf");
pdf.noFill();
pdf.pushMatrix();
pdf.translate(width/2,height/2);
pdf.scale(2);
myThing.draw(pdf);
pdf.popMatrix();
The problem occurs in 4. It throws a NullPointerException :
Exception in thread "Animation Thread" java.lang.NullPointerException
at processing.core.PGraphicsJava2D.pushMatrix(Unknown Source)
Which suggests to me that something in the PGraphicsPDF didn't get constructed properly.
Is that because I haven't something I should have done? Or is it a bug in the pdf class?
Note that this isn't just a problem for pushMatrix(). If I comment that line, the problem just gets thrown in the next line, the translate. ( Though, interestingly, doesn't happen in the pdf.noFill )