Re: [linux-audio-dev] Synchronizing sound to MIDI events?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Synchronizing sound to MIDI events?
From: Albert Graef (Dr.Graef_AT_t-online.de)
Date: Mon Oct 27 2003 - 13:12:50 EET


Denis de Leeuw Duarte wrote:
> If you have an evenly spaced font, here's a graphical representation of
> the problem:
>
> |...e.....e|e....e....|...ee...e.|.....e.e.e|....e...e.| midi events
> |..........|...rrr....|.rr.......|......rrr.|....rrrr..| rendering
> |..........|..........|ssssssssss|ssssssssss|ssssssssss| sound

Hi, Denis,

a while ago you posted a question concerning rendering audio in response
to midi events. I've been thinking about that problem, too (I'm using
PortAudio instead of Jack, but the fundamental problem of rendering the
audio with the goal of keeping latency low while avoiding jitter is the
same). I don't know whether you got any replies through lad, but I was
curious what solution you would eventually come up with, so I filed your
mail for later consideration.

My background is that I'm developing a functional programming language
with MIDI and audio interfaces (based on MidiShare and PortAudio). I've
recently started thinking about adding some softsynth functionality to
that, so I'm facing exactly the same problem. Probably this is folk
knowledge for audio programmers, but it's difficult to find anything on
the web about that. I must admit, though, that I haven't taken a look at
sources of other softsynth projects like fluidsynth or one of the
modular synths out there yet.

Well, that being said, I would imagine that you'll have to record the
exact offset (from the beginning of the block) at which the midi events
came in, and then start rendering at exactly the same offset one or two
blocks later, to avoid jitter. (Translating the midi offsets in, say,
milliseconds, to sample numbers is trivial, just multiply the time with
the samplerate and truncate or round to an integer.) At least that's how
I would go about this, but I haven't actually implemented it.

So what solution did you come up with, and does it work reasonably well?
If you don't mind sharing. :)

Cheers,
Albert

-- 
Dr. Albert Gr"af
Email:  Dr.Graef_AT_t-online.de, ag_AT_muwiinfa.geschichte.uni-mainz.de
WWW:    http://www.musikwissenschaft.uni-mainz.de/~ag


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Oct 27 2003 - 13:11:38 EET