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);
This Sound Byte gives you control over a reasonably complex UGen chain. The meat of it is a UGen I’ve called Granulizer, which takes sample data and, based on some parameters, randomly chooses short sections of the data to loop before jumping to a different short section. This sketch gives you mouse control over the size of the sections that are looped, as well as how many times they are looped. There are also keyboard commands for controlling some effects that the Granulizer is being patched through, such as a double delay, a resonant filter, a sample repeater, a bit crusher, and a playback rate controller. The controls are outlined on the applet page, so check it out!
I never really got into using max/msp or pd, but now that I’ve got these UGens to play around with in Minim, I’m finally discovering the joy of patching!
This very simple sketch is a little musical physics simulation. Click in it to spawn a ball that will bounce off the walls, producing notes each time it does. Listen with headphones for the best stereo effect. Try it!
The Melodizer is a variation on the Beat Generator. It will constantly generate a tune with a “melody” and a “bass line” by looking at the settings every measure and generating a measure with those settings. Each big slider represents a 16th note in a one bar loop. The value of each slider is the probability that the program will choose to generate a note on that 16th note when it generates a measure. The actual pitch it chooses for the note is determined by the current key and scale, as well as what the previously generated pitch was. If you look in the Scales.pde file you’ll see that for each pitch in a scale, I’ve encoded which steps in the scale are legal next notes. It’s a pretty crude melody building algorithm, but it does give the output a little bit more musicality. The drum beat is always the same, but there are three toggles that let you turn off the parts of the drum loop you don’t want to hear.
Some other things you can adjust are: tempo, shuffle (how much it “swings”), the waveforms used for the melody and bass lines, the volume of the melody and bass lines, and of course there is a button for randomizing the note probabilities.
What started out as simply curiosity about what it would sound like to run a Noise UGen through a TickRate UGen and slow it way down, turned into this interesting sound generating sketch. I’m using modulated Noise to drive a WaveShaper. The waveform being used in the WaveShaper is a sustained chord from a Rhodes, but you’ll never quite be able to hear that. Essentially what this Sound Byte lets you do is scrub through small sections of the recording in random ways (since there is noise involved). Experiment with lots of different slider settings, there is surprising amount of variety that can be obtained. Have a look at the code to see exactly what you are controlling. Try out the settings in the screenshot above for a reasonably mellow sweeping formant sound with a really mesmerizing waveform.
I’ve been working on this one for a few days. It follows the same principle as the beat generator from my previous post: whether or not a note is added to the generated sequence at a given step is determined by a probability. However, unlike the beat generator, this one doesn’t sequence distinct sounds. Instead, it is essentially generating timed control changes for effects on two sound files that are continually playing.
The first file is the vocal track from Half Life by Imogen Heap. Its playback rate is adjusted to the chosen tempo and “notes” in the sequence for it are turning on a sample-repeat effect. For each trigger of the effect, the length of the sampled audio is determined randomly based on the settings in the Vox Glitch range.
The second file is a loop from the beginning of Hydra Remix By Koen Groeneveld. The notes in the sequence for that track are setting loop points in a looping FilePlayer, though the resulting sound is the exact same kind of thing going on with the vocals. Once again, the length of the repeated audio is determined based on the settings in the Perc Glitch range. You can also specify whether you want each triggered glitch to fade in over its duration or not, which is kind of a nice effect.
Finally, you can choose to have a steady kick drum play underneath all the glitching to give yourself a good reference point. I’ve had a lot of fun playing with different settings, it’s like endless minimal, glitchy remixes of Imogen Heap. Try it out!
Probably the coolest Sound Byte yet, this one will generate drum beats based on probabilities for each sixteenth note in a measure. The sound-set is basic: kick, snare, hat, plus a chime loop that is overlaid for a little melodic flavor. You can tweak the probability of all the steps independently, or just click a button to set them all to new random values. Two “modes” allow you to specify whether you want the kick and snare to ever play at the same time and some simple rules are used to determine the amplitude of each note. I considered putting in panning of some kind, but decided it could go in a later iteration. I may do a bassline generator along the same lines at some point. Check it out!
I wrote a UGen the other day that allows you to change the tick rate (or sample rate, if you like), of any UGen that you patch to it. After making a mouse-driven example to test it out, I created this example so that the change in the tick rate could be driven by the audio itself. Here, the current loudness (RMS amplitude, to be exact) of the audio being looped directly adjusts the playback speed. Louder parts result in a higher tick rate. What you get sounds like a really broken record player. Not only is it stuck looping the same four bars, but it sounds like the timing belt is having all sorts of issues. Check it out!
I’ve been meaning to try out some digital Moog filter code. A digital Moog filter is simply a filter that attempts to model the analog filters found on Moog synthesizers. It’s got two knobs: frequency and resonance. I yanked some code from musicdsp.org, a wonderful resource, and wrote a really simple UGen with it. I meant to write more of a song, but there’s never enough time for that in these evening coding forays. So instead, you get this kind of avant-garde slow tuning thing using amplitude modulation and tweaking of the filter values. Have a listen!
DarknessKight, one of the members of the TIGSource forum, made this video walkthrough of BOOMBOX. It sounds like it’s not playing too nice in the browser, but it should give you the general feel of the game if you haven’t been able to play it: