If you are worried, I would try to use alsa sequencer queues, where you
specify when you want the event to be sent and ALSA makes sure its as
accurate as possible.

https://github.com/alsa-project/alsa-lib/blob/master/test/playmidi1.c

This example sets the queue to use tempo but its possible to use clock time
events, relative or absolute.

Anyway, a back of the napkin calculation shows that the old MIDI protocol
at 32650 kbit/sec needs around 245 022 us to send a byte. Missing a byte
should not make a huge difference. So you can not really get more precise
than that.. on old DIN5 MIDI. USB MIDI is faster but many times limited by
the same speed for compatibility.

Regards,
David

On Tue, 21 Feb 2023 at 00:35, Jeanette C. <jul...@mail.upb.de> wrote:

> Hey hey,
> I'm experimenting with c++ trying to program something nice for MIDI. I'm
> now
> experimenting with clocks, using both the standard c++ chrono library and
> the
> boost chrono library. My example program sets a desired delta between
> ticks of
> 250ms. I see that there is a difference, since Boost chrono can also use
> pthread thread parameters foor realtime scheduling and priorities.
>
> With the standard chrono and thread library my ticks are usually out by
> anything between 150.000 to 290.000 nanoseconds. Using boost a tick is out
> anything between 110.000 to 124.000 nanoseconds. Yes, much better. But,
> assuming that I correct the drift, does it make a difference for MIDI
> instruments?
>
> I know one of my MIDI instruments with a clock sync'able delay can be
> rather
> touchy with MIDI clocks, but are there good estimated guidelines
> experience
> values how precise ticks should be?
>
> Best wishes and thanks for any help,
>
> Jeanette
>
> --
>   * Website: http://juliencoder.de - for summer is a state of sound
>   * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>   * Audiobombs: https://www.audiobombs.com/users/jeanette_c
>   * GitHub: https://github.com/jeanette-c
>
> Top down, on the strip
> Lookin' in the mirror
> I'm checkin' out my lipstick <3
> (Britney Spears)
> _______________________________________________
> Linux-audio-dev mailing list -- linux-audio-dev@lists.linuxaudio.org
> To unsubscribe send an email to linux-audio-dev-le...@lists.linuxaudio.org
>


-- 
David Moreno Montero

dmor...@coralbits.com
+34 658 18 77 17
[image: Coralbits.com] <http://www.coralbits.com/>
http://www.coralbits.com
_______________________________________________
Linux-audio-dev mailing list -- linux-audio-dev@lists.linuxaudio.org
To unsubscribe send an email to linux-audio-dev-le...@lists.linuxaudio.org

Reply via email to