Kr0oked / Metronome

Simple and beautiful metronome for Android
GNU General Public License v3.0
84 stars 10 forks source link

Improve metronome precision #3

Closed Kr0oked closed 2 years ago

Kr0oked commented 2 years ago

Currently the metronome is out of sync. This issue is clearly audible. Especially with a high tempo and lot of subdivisions. This is because of the standard Timer class. The scheduled task is often 10ms or more behind the actual planned execution.

When scheduling ticks with a typical Thread-sleep mechanism the precision will probably never be good enough to sort out this issue. Instead we should investigate an approach that writes the audio data in before to an AudioTrack so it gets played exactly in time.

strk commented 2 years ago

Yes please, I noticed this too and thus uninstalled the app. An out of time metronome makes no sense. But thanks for sharing your work !