[PlanetCCRMA] Re: Help Needed: Ardour + Jack + MIDI = distortion -- Update

James P. Early earlyjp@purdue.edu
Mon Feb 12 07:18:00 2007

Hello again,

Some more investigation yesterday has convinced me that the problem is in Jack.
Ardour is merely recording the distorted audio emanating from Jack. Here's what
I did:

1) Changed window manager to fluxbox to conserve resources
2) Login and started qjackctl using 1024/4 buffers (no errors)
3) In qjackctl, opened connections and connected these alsa_pcm clients
   capture_1 -> playback_1
   capture_2 -> playback_2
4) Open envy24control and set the patchbay to
   PCM Out 1 -> H/W Out 1
   PCM Out 2 -> H/W Out 2

This configuration effectively creates an audio "loopback" through jackd. Audio
presented to inputs 1 and 2 of the Delta 44 appears at the Delta's outputs 1 and
2 (with roughly 100mS of latency). I can play my Alesis keyboard, and the audio
sounds just fine -- no distortion and no xruns.

The trouble starts when I open another xterm, launch aplaymidi, and send a
sequence to my Midisport 2x2. It sounds to me like the various "note-on"
messages create the distortion, because the distortion disappears on sustained
chords. I do see 2-3 xruns during the sequence, but these are very short (<0.1
mS), and the distortion is present when there are no xruns. Lastly, I installed
the Jack Bitmeter and attached it to each of the PCM streams. No errors were

Someone replied to me privately and speculated that my machine might be too
slow. However, it seems to me that a dual 400Mhz PII should be able to handle
one midi event stream while capturing one stereo audio feed. People have been
doing this for years on machines less capable than mine.   

I'd be happy to hear from anyone with ideas about how to address this issue.
I think I'm going to take the issue to the jack-devel list, but I will repost
the outcome here, if there is interest.


Quoting "James P. Early" <earlyjp@purdue.edu>:

> Greetings everyone,
>   I'm writing to ask for some help in locating the source of distortion when
> recording a stereo track in Ardour. I discovered this while attempting to
> play a
> MIDI sequence via Muse, through a USB Midisport 2x2 to an external Alesis
> keyboard, and recording its audio output. The distortion does not sound like
> clipping (i.e. level related) to me. It sounds more like timing fluctuations
> --
> perhaps lost samples.
>   I've tried many things to isolate the problem, but I'm not sure what to
> try
> next. Here are some observations:
> 1) Recording in Ardour without a MIDI sequence playing produces *no*
> distortion.
> 2) Before starting jackd, playing a sequence using aplaymidi and
> simultaneously
> recording the audio using arecord produces *no* distortion in the resulting
> file.
> 3) The distortion appears in Ardour whether the sequence is played using
> Rosegarden, Muse, or aplaymidi.
>   I'm running everything on a Dell Optiplex 410 PII/400 w/1GB RAM. I've
> tried
> using both the realitime and desktop SMP kernels -- no differencce. The
> 'top'
> command indicates plenty of free memory (no swap used) and the CPUs rarely
> get
> above 10% utilization. My card is a Delta 44, and I have experimented with a
> variety of buffer/period settings. I also experimented with 44.1K and 48K
> clock
> rates for the card and jackd -- no difference. I wondered if this might be
> an
> interrupt issue, but the fact that it works with the aplaymidi/arecord
> combination would seem to rule that out. The only time the distortion appears
> is
> when Ardour, Jackd, and some MIDI sequencer is running.
>   Can anyone offer some suggestions on what to try next? Also, I would
> appreciate some suggestions on "optimal" jackd settings for the Delta 44.
> Thanks,
> James