[PlanetCCRMA] Low latency kernel?

Paquita paquita@xs4all.nl
Mon Dec 5 08:11:02 2005


Fernando Lopez-Lezcano wrote:

>>If I try to e.g. 
>>listen to a Hydrogen demo song, there are very audible clicks. They 
>>unsurprisingly get worse if I decrease the period.
>>
>>The jack default command is: /usr/bin/jackd -R -dalsa -dhw:0 -r48000 
>>-p1024 -n2.
>>hw:0 is indeed the device I want to use. It's an external USB interface:
>>[paquita@marlon asound]$ cat cards
>>0 [Duo            ]: USB-Audio - USB AudioSport Duo
>>                     M Audio USB AudioSport Duo at usb-0000:00:1d.7-3.2, 
>>full speed
>>    
>>
>
>Ahhh, usb cards... that's the problem. Jack is not happy about the way
>that type of hardware works. You are already using sampling rate of
>48000 which is the best choice for usb. You could try a period of 480 or
>960, see for example:
>  http://lalists.stanford.edu/lad/2003/02/0205.html
>and/or use a bigger number for the number of periods, for example 3
>instead of 2. 
>
>  
>
It's also an old USB interface, so it's only USB 1.0. It's theoretically 
enough to play back 1 stereo channel in terms of rate, but of course I 
don't know about the way the buffers and interrupts are handled 
internally by USB. Anyway, it's what I have now, so I thought I'd give 
it a try.

I tried changing the period, but Jack doesn't accept a period that's not 
a power of 2:

loading driver ..
registered builtin port type 32 bit float mono audio
new client: alsa_pcm, id = 1 type 1 @ 0x805ba78 fd = -1
apparent rate = 48000
creating alsa driver ... hw:0|hw:0|480|3|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
configuring for 48000Hz, period = 480 frames, buffer = 3 periods
Note: audio device hw:0 doesn't support a 32bit sample format so JACK 
will try a 24bit format instead
nperiods = 3 for capture
JACK: frames must be a power of two (64, 512, 1024, ...)
ALSA: cannot configure capture channel
cannot load driver module alsa
starting server engine shutdown
freeing shared port segments
stopping server thread
stopping watchdog thread
16:39:21.296 JACK was stopped successfully.
16:39:22.953 Could not connect to JACK server as client.

>>and I've got this .asoundrc (I do hope to write a better one later):
>>[paquita@marlon ~]$ cat .asoundrc
>>pcm.usb-audio {
>>        type hw
>>        card 0
>> }
>>
>>ctl.usb-audio {
>>        type hw
>>        card 0
>>}
>>    
>>
>
>In general you don't need a .asoundrc for things to work (unless you
>want to create nice names for the devices). 
>  
>
My USB interface has 4 outputs and 2 outputs, I thought I needed a 
.asoundrc to use its multichannel capabilities. Am I mistaken? Currently 
I don't think the system sees the different channels. I have:

[paquita@marlon card0]$ ls
id  oss_mixer  pcm0c  pcm0p  stream0  usbbus  usbid

[paquita@marlon card0]$ cat pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: USB Audio
name: USB Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 0

This means alsa sees 1 playback and 1 capture channel only, doesn't it?

That might be more a question for the linux-audio-users list, but 
supposing I don't succeed in getting a usable latency with this USB 
interface, what type of interface would be recommended to record audio 
on a laptop? Would Firewire be better? This laptop doesn't have a 
Firewire port, but I could probably get hold of a PCMCIA adapter (that 
in turn would introduce its own buffer and latency, I guess...). Are 
there any other solutions? Or is it just unrealistic to do harddisk 
recording on a laptop under linux for now?

Thanks for the advice,
paquita