Reverse detail from Kakelbont MS 1, a fifteenth-century French Psalter. This image is in the public domain. Daniel Paul O'Donnell

Forward to Navigation

Using WAV samples in ARDOUR

Posted: Oct 17, 2015 23:10;
Last Modified: Oct 17, 2015 23:10

---

It took me ages to figure this out, so here’s a quick note.

There are lots of free instrument samples on the web (and commercial ones you can purchase). To use these in a recording you need a sample synthesizer or engine that can play them.

There are several file types that are used, but the most common are “SoundFonts,” WAV, and AIG.

For sound fonts, a good ARDOUR plugin is the CALF Monosynth; for WAV files (and lots of other formats), the samplv1 looks like it works really well.

----  

Getting MIDI to work in Ardour/Jack

Posted: Sep 06, 2015 16:09;
Last Modified: Sep 06, 2015 16:09

---

I’ve been struggling for a while to get MIDI to work properly in Ardour—i.e. in a way that didn’t involve hand drawing of MIDI notes. Since what was stopping me was of the “is the computer plugged into an outlet” variety of problem, I thought I’d say what I fixed here.

Contents

The problem

The basic problem was that I couldn’t get any MIDI controller to register a note in Ardour. I could (I thought) hook up the connections correctly in JACK (and I was in fact doing it correctly), but no matter what I did, I couldn’t get my inputs to be reflected in Ardour when I tried to record. More annoyingly, it had worked in the beginning when I first set Ardour up.

The solution

The solution is to make sure that the MIDI input is enabled in your track. Basically what was going wrong was that the little MIDI symbol in the top right (circled in the image) wasn’t green. When I clicked on it to make it green, the connector worked.

----  

Using the M-Audio Audiophile USB Digital Audio Interface with Linux

Posted: Sep 07, 2008 10:09;
Last Modified: Nov 01, 2014 15:11

---

This describes how to get the M-Audio Audiophile USB Digital Audio Interface working with Linux/ALSA. It has been updated (2014-11-01) to reflect recent discoveries and now seems to work well.

Contents

Introduction

Many of my courses deal with sounds of speech, and I am increasingly looking to supplement my course materials with additional digital video and audio material.

The University of Lethbridge, like most universities, I imagine, is well equipped with computer labs and IT personnel who are able to assist faculty and students with production of this kind of material. But I am looking for something that will allow me both to experiment without committing to the time involved for arranging studio and personnel time, and something that will allow me to respond quickly to opportunities that arise in the course of the year or moments of pedagogical inspiration. The University also has lots of computer labs, after all, but most faculty have a computer on their desk anyway.

Since I was an avid home recording hobbyist in my teens and twenties, I had most of the most useful hardware in a closet: a decent microphone (necessary), and a mixer and patchbay (optional, though not if you want to do quality-sounding work); and the various cables (RCA, ¼ inch, MIDI, etc.) that make things cheaper and easier to set up. My mixer and patchbay were refugees from an old 1980s Yamaha MM30/MT44 Multitrack home studio (see image). Any old mixer will probably do, and I imagine you might be able to get some cheap ones on the internet. Having a mixer makes life easier in the sense that you have more control over the volume, stereo position, and quality of the audio signal before it gets to the computer. Certainly to begin, however, you can work without one, plugging your microphone directly into the card that acts as an interface between you and your computers.

M-Audio Audiophile USB Digital Audio Interface

The one thing I needed, of course was a way of connecting my microphone and mixer to the computer. I was in a music store on the weekend looking for some supplies, and I found a cheap used M-Audio Audiophile USB Digital Audio Interface (DAI) for sale. While you can buy microphones, record and cassette players, and MIDI cables that all convert a single input directly to USB for recording, a more general DAI like the Audiophile USB allows you to do more. With this, I’ll be able to convert cassettes of accents I have for my class on World Englishes to audio form as well, for example. The M-Audio was an extremely popular DAI, so there are likely thousands of used ones floating around.

A quick search on my cell phone found a page that described how to get the interface working and suggested that it is reasonably well supported in Linux. So I took a flutter. When I got home, I installed the audio software from Ubuntu Studio (a full-featured home studio suite, that is, of course, free). And used some hobby time getting things set up. All in all, it took me about 5 hours, including writing up this description of what I did.

The M-Audio Audiophile USB works with Linux due to some heroic efforts by a couple of people, most particularly Thibault Le Meur, who wrote the kernel documentation. These people have ferreted out and developed patches for the various inconsistencies in the device’s use of the USB protocols. The instructions for getting it working, however, are not always that easy to follow, so I thought I’d collect what I found and write down what worked for me.

Process

Getting the M-Audio Audiophile USB to work with Linux involves two discrete steps:

A third step, which isn’t applicable to my current project, involves getting the MIDI (Musical Instrument Digital Interface) input to work with digital instruments like synthesizers and drum machines. Since I’m at the moment only interested in recording relatively high quality spoken work and analogue feeds from cassettes and records, I haven’t tried it to see if the discussion below gets the MIDI working as well.

Getting the M-Audio Audiophile USB recognised by ALSA

As the kernel documentation indicates, the M-Audio Audiophile USB works partially with current versions of ALSA right out of the box. If have the right modules installed (and you almost certainly do, as USB sound is something I suspect all distributions support), ALSA will recognise your device as soon as you plug it in and turn it on.

So if you have headphones plugged in and have set the card to be the choice for playback (either using whatever utility your desktop uses for letting you set Sound preferences [in Ubuntu: System > Preferences > Sound Preferences], or by giving the hardware address explicitly to a program via the command line or configuration utility), you will be able to hear audio files sent to it.

The problem, however, is that you won’t be able to record anything—or at least anything meaningful. Due to a technical problem, the details of which thankfully don’t have to concern us, audio inputs to the device are recorded as white noise by ALSA if you use the default setting (If you are interested in the problem or planning to do development using the M-Audio Audiophile USB, you can read about the details of the issue in the kernel documentation).

The solution, developed by Thibault Le Meur and others, and recorded in the kernel documentation, is to reload the ALSA USB module with some device specific instructions:

  1. Turn off your M-Audio Audiophile USB sound card
  2. At the command line, remove the usb module: sudo modprobe -r snd-usb-audio
  3. Reinsert the module with explicit information about Audiophile’s location and setup, e.g. sudo modprobe snd-usb-audio device_setup=0x01
    1. Note: I used to specify both the index value index=0 and a different device_setup =0x09, but I found that the index wasn’t necessary with only one USB and that 0×01 worked way better than 0×09—in fact it answers the questions about noisiness in the comments below.
    2. Note the different possibilities are:
      1. device_setup=0×01 (this is the one I use now)
        1. 16bits 48kHz mode with Di disabled
        2. Ai,Ao,Do can be used at the same time
        3. hw:1,0 is not available in capture mode
        4. hw:1,2 is not available
      2. device_setup=0×11
        1. 16bits 48kHz mode with Di enabled
        2. Ai,Ao,Di,Do can be used at the same time
        3. hw:1,0 is available in capture mode
        4. hw:1,2 is not available
      3. device_setup=0×09 (This is the one I originally recommended, but it creates a lot of background noise).
        1. 24bits 48kHz mode with Di disabled
        2. Ai,Ao,Do can be used at the same time
        3. hw:1,0 is not available in capture mode
        4. hw:1,2 is not available
      4. device_setup=0×19
        1. 24bits 48kHz mode with Di enabled
        2. 3 ports from {Ai,Ao,Di,Do} can be used at the same time
        3. hw:1,0 is available in capture mode and an active digital source must be connected to Di
        4. hw:1,2 is not available
      5. device_setup=0×0D or 0×10
        1. 24bits 96kHz mode
        2. Di is enabled by default for this mode but does not need to be connected to an active source
        3. Only 1 port from {Ai,Ao,Di,Do} can be used at the same time
        4. hw:1,0 is available in captured mode
        5. hw:1,2 is not available
  4. Turn your M-Audio Audiophile USB sound card back on.

You are now able to record and playback audio files. You can test it out by plugging a microphone into the one of the two ¼” (unbalanced) input plugs on the right hand side of the back and making a recording from the command line using arecord; if you have a mixer, plug your microphone(s) into the mixer and connect the mixer’s audio out/line out plug to the Audiophile’s RCA Input jacks (second from the right when you are looking at the back):

arecord -D hw:1,1 -c2 -d 10 -t raw -r48000 -fS24_3BE test.raw

(this command uses the following options: -D hw1:1,1, the likely hardware address of your Audiophile USB card; -c2, two-channel recording [required for this card]; -d 10 duration of recording in seconds [default is infinite and is stopped by sending a break signal to the program]; -t raw, a .raw file type; -r48000, sampling rate; -fS24_3BE, number and order of bits).

You can then use aplay to play the recording back

aplay -t raw -r48000 -fS24_3BE test.raw

(the above command will output to your default sound card [i.e. probably the one that drives your speakers]; if you want to hear it in the headphones through your Audiophile, add -D hw:1,0 to the command).

Getting the M-Audio Audiophile USB recognised by JACK

update: I’m not sure the following is necessary any more. I was able to record well within Audacity without going to this step.

Command line recording is not a particularly user-friendly way of working, though knowing how to do it has its uses. For daily work, we are going to want to get the sound card working with the many excellent studio programs available for Linux, all of which (or at least all the most serious of which) work with the connection utility JACK. The fact that your Audiophile is recognised by ALSA, unfortunately, doesn’t seem to mean that it is recognised by JACK (actually your card does seem to be recognised by JACK without modification if you use the default module settings for snd-usb-audio; but it seems no longer to be recognised automatically by JACK or by the GNOME sound preferences manager after you add the device-specific options.

To get it recognised by JACK, you need to modify the JACK settings. You do this using jackctl (also known as qjackctl). While you can work from the command line with jackctl, Ubuntu Studio comes with a graphic version (Applications > Sound & Video > JACK Control).

  1. Once JACK Control is open, choose the “Setup” button;
  2. In Setup click on > beside “Input Device”;
  3. Choose the device that matches the hw: address you used above with arecord: probably hw:1,1 USB Audio #1
  4. Close the setup and start (or restart if you had already started) JACK.

Open up another JACK device (e.g. Ardour, the sound recording program, or even Meterbridge, the sound meter), and see if you are getting an audio signal from your microphone through your Audiophile USB sound card. If things are working, the audio will be available from system/capture 1 or capture 2 (if you used a microphone directly) or system/capture 1 and capture 2 (if you used a mixer); if these inputs are connected to something in the “Connection” button on the Jack Control, you should be able to record audio. If they or JACK are not working, you may need to play with some settings. I found, for example, that I basically was unable to record anything at under 1024 frames/period, and I got the best results by setting the frames/period to its maximum value of 4096. Unfortunately, this brings with it the cost of a very high latency (the time between a signal being triggered and its reception at the computer end): 171 msec. Many people, in contrast, seem to be working with latencies of <10 or even <5 msecs.

Since others appear to be able to get reliable functioning with much lower frames/period (and lower latency), I assume I still need to play with the various JACK settings and perhaps even some of the hardware connections. For the specific type of projects I have in mind at the moment, however—making single voice, spoken word recordings of sounds and words for my classes and converting tapes and records I have used in classes in the past to digital format—I suspect this is a relatively minor issue. I would appreciate any tips, however!

Examples

My first examples, recorded with a good mike, the mixer mentioned above, but otherwise unprocessed and recorded with my computer fan roaring in the background are available here: http://people.uleth.ca/~daniel.odonnell/Teaching/english-3450a-the-pronunciation-of-old-english

Problems

In addition to the latency issues mentioned above, I’m aware of/suspect there may be some additional issues.

  1. I’m not sure how the Audiophile USB card, or the special device specific instructions required to set the module up for it will affect other USB sound cards I use, particularly the USB headset I use for audio conferencing.
  2. Setting the JACK input to the Audiophile USB card looks like it may disable your ability to use other inputs in Jack without changing things back: I did a quick test with Hydrogen (a drum machine), for example, and it looks like I need to change the input back to get it to record in Ardour (though I’m not 100% certain this is true, since none of my spoken word requirements—at the moment!—require a drum track or other instrumentation).
----  

Back to content

Search my site

Sections

Current teaching

Recent changes to this site

Tags

anglo-saxon studies, caedmon, citation, citation practice, citations, composition, computers, digital humanities, digital pedagogy, exercises, grammar, history, moodle, old english, pedagogy, research, student employees, students, study tips, teaching, tips, tutorials, unessay, universities, university of lethbridge

See all...

Follow me on Twitter

At the dpod blog