Wednesday, May 16, 2012


So, you can get Seq24 for Windows, but without a way to pipe it to PureData it's not much use.  In Linux this seems to basically be done out of the box, although I offer you one warning: disable Jack support for Seq24, as this seems to result in what I'm calling the "Keyboard-Butt of Doom Crash" where Seq24 freezes in a loop and sprays MIDI messages at maximum bitrate until anything looking at the port has a heart attack.  (Or disable ALSA, I think it might be you can have one but not the other...)

BUT, once you get past that, Seq24 is a totally indispensable companion for PureData.  Seq24 will send MIDI messages with channels attached, allowing PureData to peel them apart from each other.

With this setup, I now have all the features I used to get with the ancient Voyetra tracker, except that the MIDI patches are all of my own design.

While PD can definitely do sequencing (and do a ton of tricks Seq24 could only dream of), you have to build your own piano rolls, which is not only tedious but prone to errors, and PD's selection of widgets is pretty limited unless you go out fishing for plugins.  Seq24 fills a gap in the capabilities of the PureData + Ardour juggernaut that kept me from really jamming with loops.  Loops in Seq24 aren't just easy, they're intrinsic to normal operation, IE effortless.

And as always, remember that MIDI messages coming into PureData don't need to be interpreted as simple notes.  You can do anything with them, so your coded sequence in Seq24 might actually be tied to a channel dedicated to tweaking your synth or reverb settings.  One patch and one stored Seq24 MIDI file could be a complete, nondestructive performance, and as I've discovered, you can pipe multiple audio channels to Ardour separately, which means Pure Data can be meticulously peeling each one of the instruments in your ensemble apart and pushing them through their own channels for Ardour to record separately.

Now THAT'S a Digital Audio Workflow.

Saturday, May 12, 2012

The following, is freaking sweet:

Both of these are pretty simple bits of code, trivial really, but look at what's happening here.

My Arduino board is talking to Pure Data.  Not only that, but it's doing so in a tidy, scalable way.  Here's how it works:

The Arduino program waits to see a character (any character) appear on the COM port.  When it gets one, it waits 10ms and sends one byte, then another 10ms and sends another one.  I've made them have different behavior so I could tell them apart for debug, but they could be anything.

The Pure Data side sends a random number to the COM port when you click the top bang.  Doing this also resets the packet counter on the right.  Each received byte increments the packet counter, which is then used with my crude routing spigots below, so that each byte is allocated, in sequence, where it belongs.

If I did a long list of sends (say, one for each potentiometer on a nice big loaderboard) from the 'duino, it could sort these too.  I can now build arbitrary input hardware to talk to Pure Data.  How sweet is that.

Get the Pure Data Patch
Get the Arduino Code

Sunday, May 6, 2012


So far I've been learning synthesizers, directly "inventing" sound from known, easily-made mathematical waveforms.  Today I've got some recipes for sampling with the microphone (or other audio equipment).

First, basic sampling.  With an array called loop01 stuffed into its own patch (better for various performance reasons), I set up a bang to trigger the tabwrite~ function and put half a second of data into the array.

This streams straight in from the ADC and into the array, which I've made 22000 samples long to store half a second of 44000Hz data.  (Working on a more sophisticated version of this patch that'd have adjustable length, but one thing at a time.)

Next, playback.  I had a lot of fun hooking up a phasor~ object to the tabread4~ block and sliding it around, but for simple sampling, just feed it a vline~ that goes to near the end of the array based on an input argument.

My input argument here has been hacked up a little so that middle C on my nanoKey leaves the pitch unaltered.  This creates the (wrong, but useful) impression that the sample is taken at "normal" and the MIDI keyboard slows it down and speeds it up depending on how high or low you go.  I wired the "mod" button on my keyboard to take samples, but the bang is accessible in case you don't have that particular feature.  I also put a slider in so that if you're using this without a keyboard, everything will still work.

Before I go to the more sophisticated sampler with polyphonic MIDI control, I want to thank GuitarExtended for this excellent patch for detecting sounds at the input.  I appropriated this into a patch called threshbang which I used to give the next version of the sampler the ability to detect things like claps or vocalizations and trigger the sampler.  (Its details are currently beyond the scope of the blog, but I've included it so the whole polyphonic sampler patch works.)

Packing the note interpreter, pitch shifting part, line generator and tabread4~ object all into a subpatch and then duplicating it up for polyphony works about the same as for any other sound effect, but now the keyboard can play chords of whatever sound you've put into the half-second memory space of this simple patch.

Sampling and pitch-shifting sounds from around the desk quickly yields a lot of rich sound, and I can't wait to store all the funky audio I'm getting from this!

Today's Files:
Simple Sampler
Polyphonic Sampler
"Bang on Threshold" generator