Category: Libraries
AHO RP 004 Object #1 - #3 [lo]

Rapid prototyping objects generated with Processing and output to STL using unlekkerLib.

I’ve just uploaded a new Processing library called unlekkerLib. It is a collection of tools and code snippets I use frequently, and which I’ve now just barely cleaned up enough for other people to use. Instead of releasing them piece by piece, I’ve decided to bundle them together in a package hierarchy.

The main reason I decided to release it now is the STL export code I’ve written for my rapid prototyping projects. Several people have asked for the code, so I wanted to get it out there for you to play with. Obviously, it works as well with Processing as it does with regular Java.

Caveat emptor:There’s not much documentation but I do provide the source code. This is v.0001 – the very first release, so it’s pretty basic. See below for an idea of what the library contains. Right now the most exciting new component is the unlekker.data.STL class, which supports export and import of STL stereolithography files for rapid prototyping. Have a look at the Javadoc for more details.

Updates will appear here: http://workshop.evolutionzone.com/unlekkerlib/.

Read the rest of this entry »

2 Comments »

After suggesting to my AHO class that they consider using RSS feeds in Processing, I realized that there is actually no built-in functionality to do so. The XML class built into Processing is too basic to handle feeds, it seems. To remedy the situation I’ve cooked up a quick hack using the ROME library for RSS / Atom syndication.

To run the code below you’ll need to download ROME and JDOM. Make a “code” subfolder in your sketch and paste “jdom.jar” and “rome-*.jar” into it, then run the code as given. The FeedReader and FeedEntry convenience classes take care of parsing the feed and returning the entries with the most common fields included. Error checking is rudimentary, however.

Code – feedParser.pde

Read the rest of this entry »

10 Comments »

Update: This hack is obsolete as of 0133. Read more here.

For those of you who have been using the hack I posted a while back to force anti-aliasing in Processing, here’s an updated version for Processing 0125. According to the source repository Ben has been fixing lots of little things in PGraphicsOpenGL, so it’s worth updating.

The hack is actually lying dormant in the PGraphicsOpenGL source, but it’s been commented out with the note “how to integrate this properly?”. Obviously, having to set hardware-specific settings goes against the ease of use that Processing is known for. I guess Ben and Casey are just trying to find a way to include it in a manner consistent with the rest of the application.

To use the hack simply download the ZIP archive below and unpack it to produce the hacked “opengl.jar” file. Drop the JAR into the “libraries\opengl\library” subfolder of your Processing application directory. Make sure to make a backup of the original opengl.jar. Once replaced, the new PGraphicsOpenGL class always initializes with 4x supersampling.

Downloads

5 Comments »

070324_tilesaver.gif

High-resolution images from Processing using tiling (1.6% / 20%)

UPDATE: This code currently doesn’t work with Processing 1.0 and later. Please use Karsten Schmidt’s TileSaver replacement instead.

A while back I posted about rendering very high-resolution images from Processing using a tiling technique. I had implemented a working version of a solution first described by "surelyyoujest", but didn’t have time to post a clean version of the code. (I did however post ImageStitcher.pde, which is code for stitching these tiled images back together.) But after a long delay, here is finally the more useful bit of code.

The code works by panning the camera over the original viewport area, subdividing the image into tiles. This way, OpenGL’s limitations on maximum resolution can be circumvented. As long as enough memory is allocated, the images created can be very big indeed. The images shown above are from a 15360 x 15360 pixel image, shown at 1.6% and 20% respectively. With 1.5 GB assigned to Java I have so far successfully saved 20k x 20k images. That’s large enough to print 2×2 meter prints at 260 DPI.

What follows is the aTileSaver class and a simple demo application. I will post a more complex example soon.

Update: I’ve changed a few minor details in the code. Make note of the version number if you have download it already. This code is likely to change..

Source code – aTileSaver.pde

Read the rest of this entry »

34 Comments »

Update 17 Jan 2008: This library is not available at the moment at the request of Sean Luke, who along with Michael Lecuyer were the original author of the Mersenne Twister code used in the library. In packaging the library for use with Processing I carelessly removed the copyright and license information from the original file, thereby falsely giving the impression that I had written the code myself.

I’m hoping to resolve the issue and provide the library in a different form in the near future.

1 Comment »

Update: SoniaHelper should be renamed FFTHelper and integrated into unlekkerLib, but that hasn’t happened yet. The best way to use it right now is to download the code examples from the VJ workshop I did at Cimatics 2007. That has the code you need as well as some examples of practical usage.

I’ve put together a hack for normalizing the FFT analysis values produced by Sonia’s LiveInput.getSpectrum(). It looks at the maximum values produced, and scales them according to the most recent maximum values. That way, quiet sections will produce relative differences according to the current maximum value, so that both quiet and loud sections give dynamic results.

It also allows you to dampen the values so that the rate of change in values can be controlled. This can be used to make the values change appropriately according to the quality of the music, making it easier to use them for visuals that match the music.

Source code

You initialize SoniaHelper like this:

  // SoniaHelper(int _n, int _nbands,boolean doAvg)
  // Start up Sonia
  LiveInput.start(spectrumLength);

  // ...or start up Ess
  Ess.start(this);
   myChannel=new Channel("hello.aiff");
  myChannel.setupFFT(512);

  // init SoniaHelper
  ffthelper=new SoniaHelper(spectrumLength,32,false);
  ffthelper.setMaxLimits(200,2000);
  damperval=0.1f;
  ffthelper.setDamper(damperval); 

Update SoniaHelper inside draw() by passing spectral values from Sonia or Ess:

void draw() {
  ...
  LiveInput.getSpectrum();
  ffthelper.update(LiveInput.spectrum); 

// Ess equivalent
  myChannel.loadSpectrum();
  ffthelper.update(myChannel.spectrum);

  for(int i=0; i< spectrumLength; i++)
	ellipse(i,height/2,
		100*ffthelper.spectrum[i], 100*ffthelper.spectrum[i]);
  ...
}

See the sample code in the ZIP file for more code examples.

Downloads

10 Comments »