Learning while making

I’ve just shipped off the first commission! I can’t say much about it yet, as it’s surprise birthday present for someone, but I’ll post a copy to my podcast shortly after their birthday arrives.

The patch for the piece I am sending off today

I learned a bit while making it, about how to better use a module I’ve had for a long time. Also, I think I set a personal record for most cables used in a single patch! It doesn’t look like much in the picture, but only because the black cables, are hard to see against the black synth and they outnumber the other colours. Details of what I learned and what all those cables were doing will go into the programme notes when I post the audio later.
I’m already hard at work on the next one, which I was making while updating on comet news. Probably all the sounds are recorded, so I’m just mixing it now. I thought it would be a good idea to do some more manual-sounding fades and pans, so I’m using some physical faders. The online documentation was a little bit spotty on how to get this work, so I’ll put some instructions at the bottom of this post.
Noise music commissions make great gifts, for birthdays, the holidays or just as a surprise! They are delivered not only as audio, but with a story of how it was made – including influences and even some instructions on how to recreate the sounds! This especially fun for people interested in music or sound design! If you order in November, delivery is guaranteed in time for Hanukkah or Christmas!

Using midifaders with Ardour on Linux

These instructions are for a NanoKontrol2, but will work for many other popular faders.

  1. The Ardour manual starts out very well, so follow it’s instructions to get going.
  2. Start Ardour.
  3. Go to qjackctl and click the connect button.
  4. Expand all to find the NanoKontrol2 in the list on the left.
  5. Draw a connection between the NanoKontrol2 on the left and Ardour on the right. (You will need to make this connection every time you start Jack and Ardour.)
  6. Go to Ardour and open preferences.
  7. Go to the Control Surfaces tab.
  8. Enable ‘Generic MIDI’.
  9. Then double click generic MIDI.
  10. A window will open listing a bunch of control surfaces.
  11. NanoKontrol2 is in the list twice. The one that mentions ‘Master’ maps the 8th fader to the master faders and has seven channels for tracks. The other one uses all faders for tracks.
  12. NanoKontrol2 does not support touch, so you will be able to use this on tracks when they are set to ‘Write’ or ‘Manual’, but not when set to ‘Play or ‘Touch’.
  13. Record enable will not behave correctly unless you run the NanoKontrol2 configuration software in WINE

Do you love noise music? Do you have fashion? Drop me an email if you’d like your image to be in forthcoming posts about noise and fashion

Ardour: Copying Gain Envelopes

Ok, let’s say you’ve got a project in Ardour and you’ve carefully drawn a bunch of gain changes using the Draw Gain Automation tool – which is one of the buttons on the upper left. You listen to your project and are forced to conclude that one of your tracks needs to be re-recorded or re-rendered. Alas and woe! However, there is a way to get your automation points onto the new track. Alas, it’s a bit tricky.
One of the great advantages of Ardour over other DAWs is that you can actually figure out what’s going on with the data files. If you open up a ProTools project in a text editor, you get gibberish, but if you open up a .ardour file, you get a human-readable XML file. I bring this up because you cannot select your gain change points in the Ardour GUI and move them to a new track. But you can move them if you’re willing to modify your .ardour file. Here’s how:

  1. Make a backup of the file in case something goes wrong.
  2. Open the file in the text editor of your choice – ideally one that you might use to write code
  3. Your tracks have names. Let’s say the track you want to copy is called “SourceTrack.” Search in the .ardour file for “SourceTrack.” You’ll find it many times, but one of those times, will have an XML node called <Envelope> a couple of lines below.
  4. Copy everything starting at <Envelope> and ending at </Envelope&gt, including those two lines.
  5. Ok, let’s say the track you want to copy to is called “DestinationTrack.” Search for that. If you drew some gain automation points on it already, look for the <Envelope> below it. If you have not drawn any gain automation, then look for <Envelope default=”yes”/>
  6. Blow away the <Envelope default=”yes”/> or the pre-existing envelope with the code you copied.
  7. The length of the envelope must match the length of the region. You can find the region’s length 2 or 3 lines above the envelope. It will say “length=” and then a number. Get that number and copy it.
  8. The envelope values are pairs of durations and amplitudes. If the length of DestinationTrack is longer than SoureTrack, then add a point at the end with the length you just copied. If it’s shorter, remove points with durations past the length you just copied. Then add a point with the length you copied.
  9. Scroll up to the very top of the file. The second line will end with “id-counter=” and then a number. Copy that number.
  10. Now replace the the number at id-counter with the number you copied +1. If you copied “123,” then replace it with “124.”
  11. Scroll back down to the envelop your just added to DestinationTrack. It has a property “id=” and then a number. Replace the number there with the one you copied from the top of the file. If the one at the top of the file was “123,” then you should have “id=123” in the Envelope of DestinationTrack and “id-counter=124” at the top of the file.
  12. Save the file and then open it with Ardour to see if it worked.

Well, it’s easier than re-drawing every point, but it’s still a bit of a pain. If you think you might end up wanting to cut and paste automations, then you can start by using tha gain automation track instead of drawing gain enveloped directly on top of the audio. Click the ‘a’ button to show automation tracks. I prefer to draw directly over the waveform so I can really see what’s going on, but I must admit that transferring the points is a real pain.
Thanks to las, who was in the IRC channel on freenode and was able to tell me how to do this.

Ardour Report

I have advice. I spent some time with the native version of ardour yesterday, and, of course, a lot of time previous to that with the X11 version. If I were on OS X 10.4, I would run the X11 version because it’s very reliable and it’s pretty easy to install. The only drawback is that you have to first install X11, but that’s worth doing anyway.
On Intel 10.5, I’m going to run the native version. While using it, I encountered a crash bug, (which I reported). It crashed very reliably, but, unlike Audacity, crashes do not result in the loss of saved data. The way I work with audio software is that whenever I make a change to a project, I save. Record audio. Save. Adjust panning. Save. To use the native version of Ardour, you must work this way, but you should be working this way anyway. Save early and often!
(I’ve worked in higher education as a lab assistant and I can’t tell you how many times I’ve comforted weeping students who’ve just lost hours of work. Every program crashes occasionally. My sad students were all using commercial software and lost their data. Save. And backup!)

Getting Started

First do all the configuration and whatnot in my previous post. Then

  1. Start Jack Pilot
  2. Click it’s start button
  3. Start Ardour

That’s either version, native or X11. (The other issue I encountered with Ardour is that I keep forgetting to turn on Jack. This is not a big deal, as the friendly GUI will altert you and you can go do it. I’m forgetful enough that I created an Automator script to do it for me. If there is demand, I will distribute some version of the script.) After you start it, Ardour will open a dialog box in which it asks you to eiahter make a new session or open a previous one. Then, a large window opens which should look familiar to you if you’ve used other audio software before.

A Wee Bit More Configuration

Go to the Options menu, then go to Autoconnect. Put a checkmark next to “Auto-connect inputs to physical inputs”. Then, again in Autoconnect, put a checkmark next to “Auto-connect outputs to physical outputs”. Finally, still in the Options menu, go to Monitoring and select “Software Monitoring”.
These options are what I think most users will need. If you have fancy hardware or whatever, you may need to do something different.

Why I Recommend Ardour

  • Quality of product – Ok, the version I’m using has a crash bug, which sucks, but it’s beta. However, this is software does everything I need it to do and does so well. It might crash occasionally, but it doesn’t glitch. And let’s face it, protools has bugs too (what version is it where sometimes, inexplicably, it wouldn’t bounce to disk?). Ardour’s bugs are less annoying than the bugs I’ve faced with protools. And the developers tend to respond to bug reports.
  • Economic – This is a fully-featured audio workstation and it’s free. The developers would like it if you donate, but if you’re an impoverished student and you can’t, that’s ok. And if you’re an impoverished non-profit/NGO and you can’t, that’s ok. Or if you’re just impovershed and you can’t, that’s ok. Sliding-scale software means access for everybody. (The corollary is that if you’re not impoverished, you should make a donation.)
  • Support – Help is always available via IRC or the forums on the Ardour website. Also, unlike certain other software companies (grr), the developers of Ardour aren’t going to suddenly drop support for you to force you to purchase an upgrade.

Blogged with Flock

Audio software on 10.5 / Intel

Audacity

I’ve been starting to try to record things on my new mac, despite feeling cruddy with a bad cold. I first started out with trying to use the beta version of Audacity. It acted much more like an alpha version. After the 4th crash in which all my data was lost, I took a look back at the non-beta version of Audacity. This seems to be stable and work well. However, it just doesn’t have enough features to use it for composing. It’s great for recording a vocal-only podcast or running FX on pre-existing audio, but it’s not going to cut it for my needs now. So I turned to Ardour.

Ardour

Ardour does just about everything I need. It’s a competitor to Protools and Digital Performer. And it’s free!! W00t. In the past, I only ever used this on my macmini because I had a disk space shortage on my old laptop. I was less worried about the program itself and more concerned about having space for y projects. Audio files can take up a lot of space.
It has some system requirements. If you’re on 10.4, you will need to install x-windows, if you don’t already have it, which means you need to go dig out your system disk. If you’re on 10.5, you will have other issues. It requires a helper application called Jack.

Jack

Jack is awesome. If you’re on intel, once you install it, you will need to open /Applications/Utilities/Audio MIDI Setup. Under the Audio menu, open the Aggregate Device Editor.
Aggregate Device Editor

At the top part, you can create aggregate devices and give them names. In the bottom part, you can see the actual audio devices on your computer, with check boxes next to them. Check the ones that you want to use.
Then, you need to configure jack. Fire up JackPilot. You need to tell the preferences to use your aggregate device.

JackPilot Preferences

Patching the X version

10.4 is now ready to go, but 10.5 has some changes in how X windows is handled. You have two options on running Ardour. One is to run a patch. The development team has already figured out how to solve this problem, but they’re short staffed or something and haven’t updated the version or download. Ergo, you need to apply some small changes to the program by typing a few things at the prompt. This is easy enough, but if you don’t like prompts, skip to the alternate solution.
The terminal application is located at /Applications/Utilities/Terminal. Open it up. Between you and me, the terminal is awesome. It gives you all kinds of power over your computer. In a future post, I’ll link to a cool manual, but I can’t find it right now, alas. Anyway. Here’s what you do:

  1. Select the following text and copy it (by going to Copy under the Edit Menu or typing apple-C)
    Index: script
    ===================================================================
    --- script      (revision 2354)
    +++ script      (working copy)
    @@ -32,17 +32,22 @@
         sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
     fi
     
    -mkdir -p $TMP
    -cp -f "$CWD/bin/getdisplay.sh" $TMP
    -rm -f $TMP/display
    -open-x11 $TMP/getdisplay.sh || 
    -open -a XDarwin $TMP/getdisplay.sh || 
    -echo ":0" > $TMP/display
    +if uname -r | grep -sq '^9' ; then
    +    # leopard will auto-start X11 for us
    +    :
    +else 
    +    mkdir -p $TMP
    +    cp -f "$CWD/bin/getdisplay.sh" $TMP
    +    rm -f $TMP/display
    +    open-x11 $TMP/getdisplay.sh || 
    +       open -a XDarwin $TMP/getdisplay.sh || 
    +       echo ":0" > $TMP/display
     
    -while [ "$?" == "0" -a ! -f $TMP/display ]; do sleep 1; done
    -export "DISPLAY=`cat $TMP/display`"
    +    while [ "$?" == "0" -a ! -f $TMP/display ]; do sleep 1; done
    +    export "DISPLAY=`cat $TMP/display`"
     
    -ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
    +    ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
    +fi
     
     cd ~/
     shift
    
    
  2. Ok, now be relaxed. If you don’t want to know more about what that code is doing, you don’t have to. Go to your terminal and in the window there, type:
    cd; cat > ardpatch
  3. Now, still in your terminal window, paste in all the code from the clip board, by selecting paste in the edit menu or typing apple-v
  4. Still in the terminal window, type ctrl-d. What you did just then was change to your home directory (with “cd”) and then put the code into a file called “ardpatch” (with the cat > ardpatch). And then closed that file by typing ctrl-d.
  5. Ok, now you need to know the directory where you put Ardour. If you put it in /Applications, then you’re going to type:
    cd /Applications/Ardour2.app/Contents/Resources/

    but if you put it in a folder in /Applications called Audio, then what you’ll need to type is:

    cd /Applications/Audio/Ardour2.app/Contents/Resources/

    cd is changing directory and you need it to change to a hidden directory inside Ardour, so the first part is the location where you stuck the program.

  6. Then type:
    patch -p0 < ~/ardpatch

    It will tell you strange things and possibly give you an error. Ignore all that. Instead, start jack with JackPilot and then click on the Ardour2 icon to start the program. It should start up, but for me, this took several minutes, I think just because it was the first time.

You only have to apply the patch once, so you're good to go from now on. Or you can try a riskier but easier route.

Native Version

Beta software is always fun, isn't it? You can try running the native version instead. It's beta. It could crash terribly. I haven't tested it much, so I can't recommend it or warn you away or do anythng else aside from tell you it's semi-secret location.
Well, it's more an open secret. I got it from the IRC channel on freenode. If you need help, that's a good place to go, by the way. (Is IRC undergoing a renaissance or is it just me?)
The native version is at http://ardour.org/files/releases/Ardour2.2-Intel-2920.zip
It's probably a secret for a reason. I'll give it a try this afternoon and let y'all know what I think.
The native version still requires Jack. You will still need to do all the Jack configuration listed near the top.

Conclusion

The nice thing about configurations is that you usually only need to do them once. Given the amount of awesomeness crammed into Ardour, it's totally worth the bother.

Jacked

Yeah, so I can get Ardour to display on a remote machine, but forget about making sounds thus displayed. Run it in VNC and it’s fine. Run with ssh X tunneling, and there are problems. What kind of problems, you ask?

allocate_mach_clientport: can't find mach server port
Can't allocate mach port

For the longest time, I thought that error was originating within Ardour. So I downloaded the source. Man, you need a ton of libraries to compile it, several of which are either in Fink’s unstable tree or not present within fink at all. Ardour developers use Darwin Ports, I guess. Anyway, the fink version of jack absolutely does not work for me. So I was giving up on the project, when I looking at console logs revealed that the problem seemed to be coming from Jack.

Maybe if I could just discover the name of the jack sever, there exists an undocumented command line argument to pass to Ardour to tell it which server to use! Fortunately, there exists a utility for just such discovery: jack_lsp. So after learning of it’s existence, I typed in the command and got:

allocate_mach_clientport: can't find mach server port
Can't allocate mach port
jack_client_open() failed, status = 0x  

aha! So I downloaded the JackOSX code and it was a terrible mess. So I downloaded the Jackit code, but it doesn’t play well with core audio. There’s some goofy thing on mactel computers such that you have to create an aggregate device or else in and outs are treated differently. There’s probably a command line argument to fix this, but I like the nice JackOSC GUI, so I went back to their messy, messy code and started banging away at the core audio driver, since that seemed like a possible culprit.
Several hours later, after learning about some macros in C that I’d never heard of and borrowing some code form JackIt and otherwise swearing, I got a new library for coreaudio to build and link. Hooray. That was way too much effort. And I fired up the JackOSC GUI and everything worked. Yay!
And then I typed jack_lsp and got the same error again. grrrr. The code for jack_lsp is not in the Jack OSX source repository, as far as I can tell. It is included with JackIt, but it’s clearly not the problem. The problem is some Jack library that they ship out as a binary. Perhaps using my special sekrit powers, I can build the JackIT kit to use my core audio library, since it’s got a bunch of jackit code in there now anyway. Or maybe I can give up and just use VNC.
Anyway, this is why I haven’t written any music the last few days, nor implemented a very, very fast pitch tracker that just uses the samples around zero crossings.
In other news, the weird mole on my back was not cancer. Wonder why it itched so much.

Securely Using a Macmini as a remote controlled audio workstation (or media center)

Let’s say you have a mac mini and a laptop and you’re too cheap and/or lazy to buy a screen, keyboard and mouse. You don’t need to! The answer lies with your laptop. It is possible to control a macmini (or any other type of mac) with another computer of nearly any variety. I happen to use a mac, but it is also possible with windows and linux.

VNC

To start off, you will need to borrow some peripherals, so you can do the initial setup. After you register and whatnot, You will want to setup VNC. This allows you access to the minimac’s desktop from your laptop. Open the minimac’s system preferences. Open sharing. Click the “Services” tab. Click the checkbox next to Apple Remote Desktop. After that, you want to set Access Privileges. This should open automatically the first time you turn remote desktop on, but if it doesn’t, click the “Access Privileges…” button.
On the left, you will see a list of users. Select yourself. On the right, you see a list of actions. If you want to allow remote control (which you do), select all of them. Below the line, there is a checkbox which says “VNC viewers may control screen with password:” Check that box and then give it a secure password. Click “ok”
You are back on the sharing – Services window. Check the box next to “Remote Login”. Ok, now click on the firewall tab to make sure your firewall is on. While you’re there, also give your computer a name that’s different from your laptop’s name then quit the user prefs.
Ok, now go to your laptop and get a VNC client. If your laptop is a mac, Chicken of the VNC is perhaps the most popular. It’s what I use. If you’re on another kind of computer, just search the internets to find a VNC client. Download and install to your laptop.

SSH Tunnelling

Ok, now it’s time to test this out. First, open a terminal on your laptop (/Applications/Utilities/Terminal.app). Then type:

sudo ssh -X username@macmini.local -L 5900/127.0.0.1/5900

(Use your username and the mane of your macmini.) It will prompt you for a password (and may quote Spiderman at you.). Type the password for your account on your laptop. (It may ask you if you’re sure you want to connect, etc. Yes, you’re sure.) Then it will ask you for a password again. Type the password for the account on your macmini. You should see a unix-type prompt. Hooray, you are logged into your macmini.
You are logged in securely, which is even better. Don’t dispair, the graphical connection is coming next, but first an optional, brief explanation of the command you just typed: Ssh is a secure way to connect with another computer. In this case, it’s also doing something called port mapping. This makes a secure connection between a port on your computer and a post on a remote computer. If you connect to that port on your local computer, it will actually, really form a secure connection with the remote port. What this means for you is that nobody can eavesdrop over your connection (an issue if you’re wireless). The reason you type sudo is because you need root privileges to tunnel on important ports.

Back to instructions

Ok, open Chicken of the VNC on your laptop. A login window will open and there will be a list of servers, hopefully with your macmini on the list. However, you are not going to click on it. Instead, click on the + button in the lower left. A new server name will come up. Type in something like “secure minimac”. On the right hand side, type in your password. Don’t change any of the other info. You want it to connect to localhost on the default port. You can tell it to remember the password if you feel like your laptop is not going to be “borrowed” by non-trusted people. Don’t click any other checkboxes. Click connect.
A window should open with a view of the screen of your minimac. If this doesn’t happen, try the following:

  1. Do you see the name of your mac in the list of servers? If not, make sure that you’ve turned on Apple Remote desktop on your minimac.
  2. Can you connect to the remote server directly, not via the secure connection? If so, you’ve got weird problems and will need to ask for help from somebody else, like your network administrator.
  3. If you cannot connect at all, the problem may be a firewall. Make sure that the firewall on your LAN allows connections on port 5900. You may need to talk with your network administrator.

Now that you have a window open onto the remote computer, try doing something. Start itunes. Play a tune! Your minimac can be a remote controlled media center. woot.

X Windows

I like free software. Therefore, I want to use Ardour, which is free. My minimac has a large, external disk. Therefore, I want to run it on the mini, but control it with my wimpier laptop. First, you must install X11, which comes on the operating system CD from Apple. Install it on your laptop AND on your macmini. Also, install the developer kit on both (or at least the mini). Then, install Ardour on the macmini.
Ok,you may have noticed that sometimes VNC has a bit of lag. Because Ardour is an Xwindows application, it’s possible to reduce the lag by not using VNC. Instead, you can tell it to run on the macmini and to display on your local machine. However, this requires a smidgen of additional effort.
Apple has a bunch of information on X. It’s a good thing to read if you’re having a problem or just want to understand what’s going on.
First, you need to tell your macmini what you’re up to. Go back to the terminal ssh connection that you made from the laptop to the macmini. (If you closed the connection, reopen it). Then cut and paste the following commands to the terminal window:

sed 's/#X11Forwarding no/X11Forwarding yes/' /etc/sshd_config > /tmp/sshd_config
sudo mv /tmp/sshd_config /etc/.
sudo chown root /etc/sshd_config

You will need to type the password for your account on the macmini. These commands tell the ssh daemon to allow X forwarding. You may need to restart the sshd (or, if you don’t know how to do that, just reboot the whole computer by typing “sudo shutdown -r now” (without the quotes)). It would also probably be a good idea to repair disk permissions at this time.
Now, reconnect to your computer, using the same ssh command above. The -X flag allows X forwarding. That one typed command enables all your secure communications! Open X-windows on your laptop. Type into the terminal connection to the minimac:

/usr/X11R6/bin/xeyes

If all is working, a pair of eyeballs should open on your laptop. If all is not working, you’re going to have to look at some apple documents to figure this out.

Remote Ardour

Ardour, by default,opens windows on the machine that launched it. This means that if you launch it on your macmini, you can control if via VNC right away. But this is not efficient. It’s better to close VNC and just use X for this process. There are a few ways to make this happen. The one I’m describing is not the best, but it does work (hopefully). Note that the following assumes that you put Ardour.app in /Applications. If you put it someplace else, you will have to modify the path below
On your macmini, type:

cd
mkdir bin
cd bin
cat > ardour
#/bin/sh -l

/Applications/Ardour.app/Contents/Resources/bin/exporter

type control-D. Then type:

cd
cat >> .profile

PATH=$PATH:$HOME/bin

export PATH

Type ctrl-d again. What you’ve done is create a tiny executable file that uses the right path to open Ardour and added that path to your shell. You could also do this with an alias.
Logout. (type “exit”). Then log back in (with the long ssh command way above). Open X-windows on your laptop. Type “ardour” (without the quotes) at the terminal prompt. A window should open on your local machine.
Hopefully this all will save somebody else a lot of time.