Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt

Lee Revell
2005-07-13T20:17:45Z

On Wed, 2005-07-13 at 12:33 -0700, Martin J. Bligh wrote:
>
> --On Wednesday, July 13, 2005 14:32:02 -0500 Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> > Hi,
> >
> > On 7/13/05, Lee Revell <rlrevell@joe-job.com> wrote:
> >> On Wed, 2005-07-13 at 12:10 -0700, Linus Torvalds wrote:
> >> > So we should aim for a HZ value that makes it easy to convert to and from
> >> > the standard user-space interface formats. 100Hz, 250Hz and 1000Hz are all
> >> > good values for that reason. 864 is not.
> >>
> >> How about 500? This might be good enough to solve the MIDI problem.
> >>
> >
> > I would expect number of laptop users significatly outnumber ones
> > driving MIDI so as a default entry 250 makes more sense IMHO.
>
> Could someone actually test it, rather than randomly guessing? ;-)
>

It's not just random guessing, the relationship between HZ and MIDI
clock is well known. But it's not trivial to give hard numbers because
of the range of hardware possibilities. Here's another linux-audio-dev
excerpt:

On Thu, 2004-07-01 at 16:32 +0200, Tim Goetze wrote:
> [Paul Davis]
>
> >until the high resolution clock timers patch is solid enough to be
> >used by any system, there is no way to schedule MIDI output with this
> >kind of resolution, and if you can't schedule it, then the receiver of
> >your MIDI clock signal will see a lot of jitter and may refuse to lock
> >to it. Even if it locks, its not clear what it will do with the jitter.
>
> fwiw, i'm achieving quite satisfying results driving MIDI out from a
> 1024 Hz RTC thread, with external hardware locking steadily onto the
> output MIDI clock stream, even at tempi up to 240 bpm.
>
> MIDI out jitter is about the audio block size at max. DSP load (~1.3
> ms) during audio processing cycles, a fraction of a millisecond for
> the difference between 1024 Hz and the wanted MIDI clock frequency
> otherwise; however this seems to be no problem for the hardware
> attached (a fairly recent synthesizer and infrequently an aging cheap
> drum machine).
>
> at lower RTC frequencies, the jitter effect on the MIDI h/w becomes
> noticeable (erratic rubato) but it still locks on.
>

I guess there's a good argument that we should have stuck with the RTC
like in 2.4, but sleep() based timing is a much nicer interface, and it
did work in 2.6.0 - 2.6.12 so the MIDI people have grown used to it.

Lee