All of lore.kernel.org
 help / color / mirror / Atom feed
* Using hardware timers for the ALSA sequencer
@ 2005-03-15  0:07 Lee Revell
  2005-03-15  8:55 ` Clemens Ladisch
  2005-03-17  0:21 ` Manuel Jander
  0 siblings, 2 replies; 7+ messages in thread
From: Lee Revell @ 2005-03-15  0:07 UTC (permalink / raw)
  To: alsa-devel

Hey,

The emu10k1 timer thread reminded me of an idea I had.

Currently the ALSA sequencer always uses the system timer by default.
If your sound cards timer is supported by ALSA (emu10k1 and ymfpci),
this provides 50-100x better resolution.  But in order to get the ALSA
sequencer to use it you have to use the seq_default_timer_*  options
(which BTW I had never heard of on the list, I stumbled across them
reading the source).

How hard would it be to get the sequencer to prefer the hardware timer
by default and fall back to the system timer otherwise?  Probably would
not be noticeable for a MIDI keyboard, but for applications like sending
MIDI clock/MTC, the system timer resolution can be inadequate.

Would this be a good idea?

Lee





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using hardware timers for the ALSA sequencer
  2005-03-15  0:07 Using hardware timers for the ALSA sequencer Lee Revell
@ 2005-03-15  8:55 ` Clemens Ladisch
  2005-03-15 19:10   ` Lee Revell
  2005-03-15 19:12   ` Lee Revell
  2005-03-17  0:21 ` Manuel Jander
  1 sibling, 2 replies; 7+ messages in thread
From: Clemens Ladisch @ 2005-03-15  8:55 UTC (permalink / raw)
  To: Lee Revell; +Cc: alsa-devel

Lee Revell wrote:
> How hard would it be to get the sequencer to prefer the hardware timer
> by default and fall back to the system timer otherwise?

Probably not very hard -- registering a hardware timer would change
the default timer, or something like that.

> Probably would not be noticeable for a MIDI keyboard, but for
> applications like sending MIDI clock/MTC, the system timer
> resolution can be inadequate.

For USB MIDI ports, 1000 Hz is adequate, and that is the system timer
resolution on 2.6 kernels.

The theoretical upper limit for other ports would be the MIDI bit
clock, i.e., 31250 Hz. :)

> Would this be a good idea?

I think the only application where a higher resolution would be useful
would be sending MIDI clock/MTC, and we would want a kernel module for
this to prevent _any_ scheduling latencies.  A special module like
this could easily have its own mechanism for selecting the timer to
use.


Regards,
Clemens



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using hardware timers for the ALSA sequencer
  2005-03-15  8:55 ` Clemens Ladisch
@ 2005-03-15 19:10   ` Lee Revell
  2005-03-16  8:26     ` Clemens Ladisch
  2005-03-15 19:12   ` Lee Revell
  1 sibling, 1 reply; 7+ messages in thread
From: Lee Revell @ 2005-03-15 19:10 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Tue, 2005-03-15 at 09:55 +0100, Clemens Ladisch wrote:
> For USB MIDI ports, 1000 Hz is adequate, and that is the system timer
> resolution on 2.6 kernels.

So how does MIDI work with 2.4?  Not very well?

Lee



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using hardware timers for the ALSA sequencer
  2005-03-15  8:55 ` Clemens Ladisch
  2005-03-15 19:10   ` Lee Revell
@ 2005-03-15 19:12   ` Lee Revell
  1 sibling, 0 replies; 7+ messages in thread
From: Lee Revell @ 2005-03-15 19:12 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Tue, 2005-03-15 at 09:55 +0100, Clemens Ladisch wrote:
> Probably not very hard -- registering a hardware timer would change
> the default timer, or something like that.

I was thinking even simpler.  If a hardware timer is present when the
sequencer is initialized, use it.  Handling the registration of a
hardware timer once the sequencer is up seems harder.

Lee



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using hardware timers for the ALSA sequencer
  2005-03-15 19:10   ` Lee Revell
@ 2005-03-16  8:26     ` Clemens Ladisch
  0 siblings, 0 replies; 7+ messages in thread
From: Clemens Ladisch @ 2005-03-16  8:26 UTC (permalink / raw)
  To: Lee Revell; +Cc: alsa-devel

Lee Revell wrote:
> On Tue, 2005-03-15 at 09:55 +0100, Clemens Ladisch wrote:
> > For USB MIDI ports, 1000 Hz is adequate, and that is the system timer
> > resolution on 2.6 kernels.
>
> So how does MIDI work with 2.4?  Not very well?

With the default settings, MIDI playback will have jitter up to 10 ms.
A few people use the RTC timer or a sound card timer instead.


Regards,
Clemens



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using hardware timers for the ALSA sequencer
  2005-03-15  0:07 Using hardware timers for the ALSA sequencer Lee Revell
  2005-03-15  8:55 ` Clemens Ladisch
@ 2005-03-17  0:21 ` Manuel Jander
  2005-03-17  4:31   ` Lee Revell
  1 sibling, 1 reply; 7+ messages in thread
From: Manuel Jander @ 2005-03-17  0:21 UTC (permalink / raw)
  To: alsa-devel

Hi,

At least the aureal vortex has a high resolution hardware timer too. So
if this leads to some code to support hardware timers, i would suggest
something useable for other hardware too.

Best Regards

Manuel J. 

On Mon, 2005-03-14 at 19:07 -0500, Lee Revell wrote:
> Hey,
> 
> The emu10k1 timer thread reminded me of an idea I had.
> 
> Currently the ALSA sequencer always uses the system timer by default.
> If your sound cards timer is supported by ALSA (emu10k1 and ymfpci),
> this provides 50-100x better resolution.  But in order to get the ALSA
> sequencer to use it you have to use the seq_default_timer_*  options
> (which BTW I had never heard of on the list, I stumbled across them
> reading the source).
> 
> How hard would it be to get the sequencer to prefer the hardware timer
> by default and fall back to the system timer otherwise?  Probably would
> not be noticeable for a MIDI keyboard, but for applications like sending
> MIDI clock/MTC, the system timer resolution can be inadequate.
> 
> Would this be a good idea?
> 
> Lee
> 
> 
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
-- 
Manuel Jander
Electronic Engineer



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using hardware timers for the ALSA sequencer
  2005-03-17  0:21 ` Manuel Jander
@ 2005-03-17  4:31   ` Lee Revell
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Revell @ 2005-03-17  4:31 UTC (permalink / raw)
  To: mjander; +Cc: alsa-devel

On Wed, 2005-03-16 at 20:21 -0400, Manuel Jander wrote:
> Hi,
> 
> At least the aureal vortex has a high resolution hardware timer too. So
> if this leads to some code to support hardware timers, i would suggest
> something useable for other hardware too.
> 

With Clemens' code for the ymfpci timer and the OSS emu10k1 driver I was
able to implement the ALSA timer support for emu10k1 in about 20
minutes.  If you know how to enable and disable timer interrupts and set
the timer rate (and have the hardware of course) you should try to
implement the support for the vortex.

Lee



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-17  4:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-15  0:07 Using hardware timers for the ALSA sequencer Lee Revell
2005-03-15  8:55 ` Clemens Ladisch
2005-03-15 19:10   ` Lee Revell
2005-03-16  8:26     ` Clemens Ladisch
2005-03-15 19:12   ` Lee Revell
2005-03-17  0:21 ` Manuel Jander
2005-03-17  4:31   ` Lee Revell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.