Using hardware timers for the ALSA sequencer
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
Quoted 2 lines · Lee Revell
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.
Quoted 3 lines
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. :)
Quoted 1 line
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
Quoted 2 lines · Clemens Ladisch
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
Quoted 5 lines · Lee Revell
Quoted 2 lines · Clemens Ladisch
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
Quoted 2 lines · Clemens Ladisch
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
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.
Quoted 33 lines · Lee Revell
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Signature · 10 lines
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
Quoted 6 lines · Manuel Jander
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