Minim without Processing

I’ve been asked many times to remove the PApplet dependency from Minim and tonight I have done it. If you’d like to try out Minim in your not-Processing Java app, you can grab the latest from the repo to do so. I’ve put the details in the Javadoc, but I’ll lay out the basics here, as well.

Processing provides two key methods that the JavaSound implementation of Minim uses when dealing with sound files. The sketchPath method is used by createRecorder to generate an absolute path from the file name provided to that method. The createInput method is used to get InputStreams for reading audio files. In order to remove the dependency on PApplet, the Minim constructor that required a PApplet as an argument has been replaced with one that takes an Object. This Object is then passed to the JavaSound implementation, which uses reflection to try to locate sketchPath and createInput methods on that Object.

What it boils down to is that if you are building a not-Processing Java app, you must simply write sketchPath and createInput methods for one of your application classes and then pass an instance of that class to the Minim constructor. The exact method signatures are:

String sketchPath(String fileName);
InputStream createInput(String fileName);