[LAU] Is ALSA using hrtimer?

Niels Mayer nielsmayer at gmail.com
Sun May 30 20:39:08 UTC 2010


On Sun, May 30, 2010 at 11:02 AM, Grant <emailgrant at gmail.com> wrote:
>> ALSA uses the sound card interrupt for timing.  The hrtimer is used only
>> for MIDI playback and for sound cards without interrupts, such as the
>> SuperH, i.MX, PC Speaker, and dummy devices.
>
> Are you sure?  CONFIG_SND_HRTIMER says:
>
> "ALSA uses the hrtimer as a precise timing source. The ALSA sequencer
> code also can use this timing source."
>
> Would ALSA use the sound card interrupt for timing with my USB DAC?

I too would like to better understand these statements and the
benefits, if any, provided by loading snd-hrtimer. For example, if
snd-pcm  wasn't dependent on snd_timer, why this dependency from
lsmod?::
> snd_timer              19840  5 snd_seq,snd_hrtimer,snd_pcm

What kinds of timing info is snd_pcm deriving from snd_timer?? What
are the benefits of  using HRtimer versus system timer with ALSA?
Which results in best performance (latency and drummer-accurate MIDI
timing).
Which uses least system resources?

On Fri, May 28, 2010 at 12:11 PM, Paul Davis <paul at linuxaudiosystems.com> wrote:
>> Does setting "--clocksource" only affect MIDI, or also Audio?
>>  ( http://old.nabble.com/Re:-Quality-of-sound-on-RHEL-6.0-beta-and-Fedora-13-p28587664.html )
>
> neither.

Then what is the purpose of the --clocksource flag, and what are the
advantages/disadvantages of the different settings:
"c(ycle) | h(pet) | s(ystem)"??

In a different thread you mention, regarding jackd's use of snd-seq:
> the timing behaviour of the two -X options (seq and raw) are not very good. some might be sufficiently uncharitable as to call them unusable".

Would using snd-hrtimer with snd-seq change this assessment? I haven't
done any precise measurements myself, but I didn't hear anything sound
terribly "off" w/r/t my usage of ALSA midi through qjackctl/jackd (
"/usr/bin/jackd -dalsa -dhw:M66 -r44100 -p256 -n2 -Xseq -zs -H -M").
Certainly not "unusable" just using MIDI alone.

Is this issue related to timing of MIDI versus audio, or MIDI timing
itself causing the music to sound different than the musician
intended?

Thanks for all the helpful advice,

Niels
http://nielsmayer.com

PS: To get snd-hrtimer at boot in Fedora:
http://old.nabble.com/-etc-modprobe.d-dist-alsa.conf-patch-to-boot-with-high-res-timer-for-ALSA-seq.-to28718916.html


More information about the Linux-audio-user mailing list