ardour-record-midi

How To Configure Jack and Ardour in Ubuntu Linux for Recording Midi

This is an assignment for the Coursera course Introduction to Music Production

Introduction

Hi, I’m Sungwon. I grew up in the United States, have been in South Korea the past 9 years and am now living in France for the time being. In this post, I’ll be explaining how to prepare Jack and Ardour 3 for recording midi in Ubuntu Linux (I’m running UbuntuStudio).

Preparing Jack and Ardour 3 in Ubuntu for Recording Midi

In the Intro to Music Production course, instructor Loudon Stearns gave us a checklist for setting up our preproduction environment.

  1. Proper Project Name and Location
  2. Digital Audio Preferences
  3. Recording File Type
  4. Hardware Settings
  5. Buffer Size

When recording with a DAW like Ardour in Linux, we have to do some extra work setting up audio with Jack before we can even launch, let alone configure, our DAW. So our project checklist will look more like this:

  1. Jack
    1. Hardware Settings
    2. Digital Audio Preferences
    3. Buffer Size
  2. Ardour
    1. Proper Project Name and Location
  3. Jack
    1. Connection Settings
  4. Ardour
    1. Digital Audio Preferences
    2. Buffer Size
    3. Recording File Type

Setting Up Jack

jack-setup

I use QjackCtrl as a GUI interface for Jack. After launching QjackCtrl, go to “Setup”. In the window that pops up, find the “Interface” section and click the “>” to the right of it. A dialog will popup listing the available interfaces. You should select your audio interface if you have one, if not you can select your computer’s sound card (usually hw0 or hw1).

While you have the “Setup” window open, set your buffer size with the “Frames/Period” dialog and “Sample Rate” to your desired values (a smaller value like 128 for buffer size will help reduce latency if you will be recording non-midi instruments and a sample rate of 48000Hz is the standard for professional audio and video work). Here we also will want to set the “Midi Driver” dropdown menu to “none”.

Next, press “Ok” to save your changes to Jack and press “Start” to start the Jack daemon. If Jack is unable to start, it is usually because you have selected the wrong Interface. In this case, go back into “Setup” and choose another interface.

Setting Up Midi in Jack

command-line

After starting Jack, you will need to start a2jmidi to connect your midi device to Ardour. Try typing:

a2jmidid -j default

into the command-line. If you get a server socket error, the a2jmidi daemon may already be started. In that case, type in:

a2j_control start

and all should be well. If you are using a synthesizer like phasex or yoshimi with your midi device, you can launch it now.

Now we can also finally launch Ardour.

ardour-startup

Choose “New Session”.

 

session-setup

In Ardour, the Project Name is called “Session Name”. Name it anything that makes sense for your project. It’s a good idea to keep all your sessions in one folder so you know where to find them. I keep them in Home => Music => Ardour Projects. Note that you do not want to nest sessions/projects inside each other, i.e. save a session inside another session folder; this will make it difficult for you to differentiate which files belong to which session.

Back in Jack, open the connection settings window by pressing the “Connect” button.

jack-audio-connections

Make sure your synthesizer (phasex in this example) outs are connected to the system playback inputs. This will allow you to monitor your playing.

 

jack-midi-connections

In the MIDI tab, a2j’s Midi through should be connected to both a2j’s phasex in (to connect the MIDI device signal to the synthesizer)  and Ardour’s MIDI 1/midi_in 1 (so Ardour can also receive and record the MIDI signal). When you playback MIDI tracks in Ardour, you’ll also want to connect Ardour’s MIDI 1/midi_out 1 to a2j’s phasex in. However, when recording you’ll want to disconnect this because after a few minutes it will start producing feedback that will distort your MIDI signal.

 

jack-alsa-connections

Finally, make sure your MIDI device (an Oxygen25 keyboard in this case) is connected to your MIDI through in the ALSA tab.

 

Setting Up Ardour

ardour-display

Now that Jack is finally setup, you can configure Ardour for your session. In the top right, you’ll see the current values of some common preferences, including the sample rate (that we set before in Jack)  and the recording file type.

 

ardour-audio-setup

To check or change the buffer size, click “Window” and select “Audio/MIDI Setup” from the menu.

 

audio-setup

In this window we can change the buffer size if we are also recording non-MIDI instruments.

 

ardour-properties

To change the recording file type, choose “Session” => “Properties” from the main menu.

 

audour-media-properties

From the “Media” tab, we can choose our recording file type. “Broadcast WAVE” is the recommended type as it stores some extra backup information.

 

ardour-add-track

You’ll need a MIDI track to record to. Choose “Track” => “Add Track or Bus” from the menu.

 

add-track

Choose “MIDI Tracks” from the top dropdown menu. Now you’re ready for MIDI recording in Ardour!

 

ardour-record-midi

Toggle the main and track red record buttons on and press the play button and you’ll be laying down a sweet MIDI track! Rock and roll!

Reflection

Thanks to my fellow students for peer reviewing this assignment!

Originally I planned to take the assignment on how to record and quantize MIDI, but in experiencing the trials and tribulations of trying to configure a DAW in Linux with Jack, I thought that this subject would be much more valuable for my own reference and for others interested in music production in Linux. Indeed, even though I setup MIDI successfully while watching the lessons, in preparing this assignment, I again ran into new difficulties and ways to get feedback out of my MIDI configuration.

 

 

 

  • Thibault Delattre

    Thanks. This is by far the best article I found on the subject. I struggled with Jack, now it’s way clearer.

    • http://sungwonchoe.com sungwon

      Thanks for commenting, Thibault! Very glad that you found the article helpful.

  • Luis

    Yes! really nice article.. the best to make me understand it.. Thanks man! I just have two quick questions. 1st if I play a note on the midi keyboard the note will stay there for ever.. even that I take my finger out of the key.. do you know how could I fix this? and second… do you know how to record audio? how should I make the connection, etc?

    Best! and thank you once again!

    Luis

    • http://sungwonchoe.com sungwon

      Hi Luis, thanks for the kind comment. I’m afraid I don’t know the answers to your questions, though; I haven’t used Ardour for a while now. You might want to try http://linuxmusicians.com/ or some of the other Linux audio forums. Good luck!

      • Luis

        Thanks for your replay again. Just one last question, do you know by any chance some tutorial about jack and BItwig? Thank you!

        • http://sungwonchoe.com sungwon

          Sorry, I don’t. Bitwig looks awesome, though. Looking forward to trying it out someday.

  • mitsos

    Thanks! I’ve searched a lot of sites with ubuntu talk about this, but yours was the best for me to understand and make it work! I’m so happy!!
    I’ve also had the same coursera lesson, it’s great!

    The only thing to say is that I believe you must first make the channel MIDI 1 in ardour and then it appears in jack and you can make the connection form a2j to MIDI 1.

    Thanks!!