[linux-audio-dev] Audio synchronization, MIDI API
Benno Senoner
sbenno at gardena.net
Sun Aug 15 11:37:35 UTC 2004
Steve Harris wrote:
>
>No, the roundtrip latency is *at least* 100usecs (or whatever), the hardware
>will keep re-transmitting until the packets get through.
>
>
Even if it is 100usec it's still a negligible amount of time.
Keep in mind serial MIDI is relatibely slow, press a 7 key chord and the
7th key will sound 6msec later than the 1st one.
Still people are not complaining and MIDI has survived for decades as
the intercommunication standard between musical instruments.
>In pratice people dont really demand hard realtime and it will be OK, but
>the maximum time taken to transmit a UDP packet is unbounded, it uses
>exponential backoff IIRC.
>
>
But this is on a non switched ethernet network.
In a non congested, switched network no backoff mechanism is needed
because each ethernet port can get the full 100Mbit.
This means if you don't saturate the network the UDP packet will get
sent at the first.
If you do pure host A -> host B communication it is impossible to
saturate the network since
the sender will send back to back packets and the receiver will be able
to receive them all (given enough CPU speed).
But we are talking of relatively sparse events.
For example assume we send only note on and note off messages. (3 bytes).
If you have a real serial midi interface you can do max about 1000
messages/sec and even average switches can switch
10000 ethernet frames/sec which means you can easily pipe a fully
utilized serial midi stream (coming from a real MIDI device)
into the 100Mbit network where you store only one MIDI message per
packet and you still use 10% of the switching capacity
of switch (and ethernet cards).
An even greater efficiency (but it would introduce 1-2msec latency)
could be achieved to gather incoming MIDI data from
the real MIDI device and send them in batches perhaps along with audio data.
(see the proposal I made some time ago for audio/midi over JACK).
That way you get full timestamping for MIDI (you can trigger sample
accurate MIDI events) and you send much less packets
around thus allowing for dozen concurrent audio/midi streams on a single
100Mbit network.
For example a stereo stream of 128 audio frames (32bit floats) per
packet would consume 1024bytes, and since ethernet packets
are 1500bytes you could use the rest for timestamped midi.
When I get some time will make a few proof of concept tests and
measurements to see if it is viable. (but I'm 99.9% sure it will
work well becaue there is already solution of audio/midi over ethernet
on Windows VST , see www.fx-max.com which seems to work well
and hollywood composers love it because they have large softsamplers/HDR
setups which they use for their film scoring.
cheers,
Benno
More information about the Linux-audio-dev
mailing list