Geeky Software Stuff/Why I am so Awesome

Craig’s off to the football, so there’ll be no sonic culinary adventures this week. I have, however, done a bit more to last week’s track, so here’s an updated version:

Whiffle

And to tide you over till next week, a long post about music software:

Warning: the rest of this post is going to be very geeky…

So, so far the music we’ve made has very much relied on a computer to pull everything together, add the necessary sparkles etc. This is fine if you’re not working in realtime and can play about with all sorts of computer-only effects, but assuming we do get a full band together and start playing live, I’m not going to have the luxury of a desktop PC and plenty of time to shuffle things about. And my guitar pedals, being guitar pedals, aren’t going to be enough to take up the slack.

So, I’ve come up with a plan. Armed with my trusty netbook (above), I’m going to write the software I need, and run my guitar through it. It’ll sound amazing (or, you know, a big mess – either way’s good…).

This isn’t the first time I’ve attempted this kind of thing. But that was a while ago, and it was kind of clunky, and Windows-only (like all good netbooks, mine’s running Linux). This time I can do much better.

So without further ado, I give you Pedalboard2:A proper modular plugin host designed around my own needs. Yeah I’m reinventing the wheel, but the wheel was kind of ugly, and it was the wrong shape anyway – my wheel’s going to be far, far better.

It’s not radically different to all the other similar apps out there, but it’s different enough to matter (to me). Firstly, in a single save file, it lets you save a number of patches (effects configurations) which you can switch between at will without having to bring up a load/save dialog (i.e. it’s easy to switch configurations between songs). Two, it’s going to be controlled via an Arduino-powered[1] box with all sorts of switches and expression pedals (to be assigned to control whatever plugin parameters etc. I want). And c.) it’s going to host plugins of my own special format, the NiallsAudioPlugin format.

Why create my own plugin format? Well, apart from demonstrating how awesome I am, the existing formats just don’t suit me. And since I’m building Pedalboard2 for me, and not anyone else, I don’t see any reason to try and make do with someone else’s handmedown clothes. VST isn’t compatible with the GPL, and is kind of clunky on Linux; LADSPA has no support for GUIs; LV2 is just way too much typing with all that rdf stuff (and all those ‘optional’ extensions which you’d need to implement to create anything useful?). The real reason though is that I’m lazy, and if I want to code a plugin, I don’t want to have to write a bunch of supporting code. The only existing plugin formats require a lot of typing to set things up, and I just don’t think it’s necessary. As an example, here’s the code for a basic distortion plugin using my NAP API:

// TanhDistortion.h – A test NAP plugin.
// —————————————————————————-
// This file is part of Pedalboard2, an audio plugin host.
// Copyright (c) 2009 Niall Moody.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/&gt;.
// —————————————————————————-

#ifndef TANHDISTORTION_H_
#define TANHDISTORTION_H_

#include “NiallsAudioPlugin.h”

/// A test NAP plugin.
class TanhDistortion : public NiallsAudioPlugin
{
public:
/// Constructor.
TanhDistortion();
/// Destructor.
~TanhDistortion();

/// Where the audio is processed.
void processAudio(float **input, float **output, int numSamples);

/// Creates an editor for the plugin.
Component *createEditor() {return 0;};
};

#endif

// TanhDistortion.cpp – A test NAP plugin.
// —————————————————————————-
// This file is part of Pedalboard2, an audio plugin host.
// Copyright (c) 2009 Niall Moody.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/&gt;.
// —————————————————————————-

#include “TanhDistortion.h”

#include <cmath>

//——————————————————————————
//——————————————————————————
extern “C”
{

NiallsAudioPlugin *createPlugin()
{
return new TanhDistortion();
}

}

//——————————————————————————
//——————————————————————————
TanhDistortion::TanhDistortion():
NiallsAudioPlugin(1, 1, 1, “Tanh Distortion”)
{
setInputName(0, “Audio In”);
setOutputName(0, “Audio Out”);
setParameterName(0, “Gain”);
}

//——————————————————————————
TanhDistortion::~TanhDistortion()
{

}

//——————————————————————————
void TanhDistortion::processAudio(float **input, float **output, int numSamples)
{
int i;
float *gain = input[1];

for(i=0;i<numSamples;++i)
output[0][i] = tanh(input[0][i] * gain[i]) * 0.8f;
}

Now, ignoring the comments (and cursing the lack of tab indents), that is not a lot of code. It’s missing an editor, but that’ll just be a JUCE[2] Component with a single knob[3] – for the whole thing you’re looking at 15 minutes coding, at most. Which is how it should be.

I’ve only just got started on the app, so expect more posts like this as I get further on with the development and start writing plugins etc. Also, the more observant among you will have noticed that the screenshot above is full of LADSPA plugins – Pedalboard2 does support LADSPA (I stole the hosting code from juced), because I’m not great at DSP and there are some things that are forever going to be beyond me. But, any plugins I write will be NAPs, for all the above reasons.

A quick list of the plugins I intend to write initially (I’ll expand on them in later posts):

  • A delay (using the same algorithm I developed for Fragmental).
  • A granulator (probably a modified version of the Fragmental granulator).
  • A tuned delay line resonator thingy (Feedback-y Thing, but far more useful).

I’m not sure if I’m going to release the software to the public, because it’s so tailored to my own needs, but I could be convinced to release it if people want it…

[1] – My favourite thing about Arduino is that it can be powered off USB, so I don’t need to faff about with batteries or power supplies or anything, just write some code to chuck the sensor data to the netbook, plug it in, and that’s me.

[2] – The whole app is written with JUCE, because I know it so well, and because it’s packed full of the kind of support classes you need in an app like this.

[3] – I plan on giving most of the plugins I write a cel-shaded Boss-style GUI similar to Soul Force! and done in Blender. There will probably be a post about this – Blender’s had some very powerful functionality added since I last used it, which should make GUI design ridiculously easy.


One response to “Geeky Software Stuff/Why I am so Awesome

You must be logged in to post a comment.