MasterEx / BeatKeeper

Just another android metronome!
The Unlicense
39 stars 32 forks source link

audio syncing #2

Open mgood7123 opened 3 years ago

mgood7123 commented 3 years ago

I can't get the audio to be 100% in sync with the text, as (unfortunately) the audio itself plays out in sync in comparison to a professional metronome such as PFSeq but I can't get it to sync up with the UI, especially at high/low bpm's :(

MasterEx commented 3 years ago

Hi @mgood7123, a handler does not guarantee when it will process the message. For this reason in the current implementation the text won't perfectly sync with the sound and the outcome will vary depending outside factors such as if a garbage collection is happening etc. I guess an approach to achieve this would be to create a "video" stream that carries both the visual representation of the metronome and the audio sound.

In other words instead of just generating sound use the same principle and generate sound and "image".

I am not sure how other implementations of metronomes are handling this. Maybe there is another good solution which I cannot think at the moment.

Feel free to submit a PR if you implement this.

MasterEx commented 3 years ago

This seems relevant: https://developer.android.com/reference/android/media/MediaSync