All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve deRosier <derosier@pianodisc.com>
To: Paul Davis <paul@linuxaudiosystems.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Sync between MIDI and audio
Date: Tue, 02 Sep 2003 09:39:04 -0700	[thread overview]
Message-ID: <3F54C7A8.8030006@pianodisc.com> (raw)
In-Reply-To: <200308290127.h7T1RWfg019789@oud>

Paul,

Ah, well that explains it.  Thanks.  Can you point me to some info on 
how I would link the two clocks (I guess it would be to make the seq use 
the PCM clock)?

As far as using kernel 2.5/2.6 or the backport of the hi-res timers 
code... unfortunately this isn't an option for me.  I can't change the 
kernel version and even if I could, the rest of the people wouldn't 
allow it at this point.  But, even if I used the hi-res stuff, wouldn't 
I still have the same problem with having 2 clocks and those drifting 
apart over time?

Thanks,
- Steve

Paul Davis wrote:
>>The problem: the MIDI and audio start synced up, but after a while they 
>>start to drift further and further apart.  I've checked my stuff 
>>exaustively to make sure that it's not the fault of my program, so I'm 
>>figuring it is caused by me not setting up something properly in alsa to 
>>make the two streams synced up.
> 
> 
> you either have to force the sequencer queue to use the PCM device as
> a clock, or you have to use the RTC as the clock for both (which will
> cause audio glitches every so often since it drifts w.r.t. the audio
> clock). you can't expect this to "just work" - you've created a system
> with two clocks (the sequencer queue and the PCM device), and such
> systems will never stay in sync.
> 
> this is a very tricky area of linux audio/MIDI programming, and my
> personal advice would be to use kernel 2.5/2.6 or the backport of the
> hi-res timers code. you can then get usec-accurate scheduling of
> events (in SCHED_FIFO tasks, anyway) and forget the ALSA
> queue. hopefully, the ALSA sequencer will at some point take advantage
> of the new timers. even so, its still not a simple thing to do.
> 
> --p
> 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

      reply	other threads:[~2003-09-02 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-28 21:44 Terratec Aureon Space 7.1 and digital out Dennis van der Meer
2003-08-29  0:48 ` Sync between MIDI and audio Steve deRosier
2003-08-29  1:27   ` Paul Davis
2003-09-02 16:39     ` Steve deRosier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F54C7A8.8030006@pianodisc.com \
    --to=derosier@pianodisc.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=paul@linuxaudiosystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.