thebigg73 / OpenSongTablet

Android port of OpenSong. Use your mobile device as a portable song book. Gareth Evans
GNU General Public License v3.0
32 stars 23 forks source link

v6 beta - Metronome stability #239

Open iv-gha opened 1 year ago

iv-gha commented 1 year ago

Data: Fast beat metronome is unstable. Metronome use with Pad makes this more pronounced (6/8 80 bpm with Pad being a case). Metronome pause/resume behaviour is poor. I think, a metronome stop calls need to be made on pause.

Visual/sound metronome needs stability for all speeds and when the sound system is under stress.

v6 uses different technologies for Metronome sound. v5 metronome code uses, I believe, a self adjusting lock with the clock for start of sounds - this, with caveat that first few beats could drift, may be a way to get v6 stable.

thebigg73 commented 1 year ago

Unfortunately Android has poor timing - fact. Android receiving the request and playing the note on a busy system is the issue. Particularly if we used background threads - the system prioritises for us.

V5 tried to manually measure and recalculate the sending of the next note based on the length of the sound starting from when the note should have been sent by making the silence at the end of a note longer or shorter. Both v5 and v6 glitch and the simplest thing would be to remove the metronome. I'll have a look at moving some code in V6 to the foreground at the risk of blocking the UI. On my slow old device V5 metronome was totally unusable and logged 120bpm songs sending beat requests anywhere between 100 and 125 BPM. Almost always ending up behind where it should have been. V6 sends 120bpm requests each time (see previous discussion thread with logcat). This means overall the beats are always synced to the clock and will fix on system resource clearing. We don't try to ignore the best/most stable timer source we have available on the device. V6 always catches up and beat requests are always locked to the system clock, fact, but I accept that system delays, background threads, etc mean the sound (or visual flash) is sometimes on catch-up. Most common during song indexing completion for me.

V5 uses a manual listener to monitor and adjust sending of notes around a manual timer measured relatively to the system timer by creating different length silences after a beat, not sending the next note until after IT THINKS the note has been played. This builds in different beat lengths still assuming the request and playing are the same thing. When a beat glitches, the delay or reduction of delay is added in (on top of previous delays or shortening) and the next beat is measured from this new time point and calculations continue from there. This ignores the system clock thinking it is doing better by trying to fix each beat, but over a short period of time, this causes external devices to drift out of sync.

I'd often play with a keyboard player triggering a midi start on his device and metronome on my device (for the start of a song). On v5 by 30s in to the song the two devices were often out by nearly half a bar despite having the same tempo set (very occasionally they were close enough). We monitored the tempo flashes gradually drifting apart. V5 always getting slower when another task happened (e.g a notification popping up). I ended up abandoning the metronome on that device (an older, slower Android tablet). Moving to V6, the two devices are locked perfectly, and yes, I occasionally hear a faster beat or slower beat as my system catches up, but the system timers are locked in and I know that 30s in on my system clock also means 30s in on his system clock.

Returning to v5 timing methods would be a huge downgrade for me.

I suppose it comes down to a definition of stability. 120bpm = 120bpm with glitches when there is system load, but still 120bpm staying at 120bm overall, or ignoring actual system timing to mask glitches and 120bpm being dependent on processor speed and system load and having relative timing.

On Sat, 27 May 2023, 07:50 iv-gha, @.***> wrote:

Facts: Fast beat metronome is unstable. Metronome use with Pad makes this more pronounced (6/8 80 bpm with Pad being a case). Metronome pause/resume behaviour is poor. I think, a metronome stop calls need to be made on pause.

Visual/sound metronome needs stability for all speeds and when the sounds system is under stress.

v6 uses different technologies for Metronome sound. v5 metronome code uses, I believe, a self adjusting lock with the clock for start of sounds - this, with caveat that first few beats could drift, may be a way to get v6 stable.

— Reply to this email directly, view it on GitHub https://github.com/thebigg73/OpenSongTablet/issues/239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3X52R3CYRFOYU7Z25BLILXIGPZTANCNFSM6AAAAAAYQ76E2M . You are receiving this because you are subscribed to this thread.Message ID: @.***>

iv-gha commented 1 year ago

The issue is basic, it needs to be usable. A visual metronome is very good for setting the initial pace of songs.

I agree, Android is weak in this area so we only expect a good result - I am impressed you have it close to midi! Like you I would defer to the best metronome in the room!

At the moment, for whatever reason, sound and flashes are unusable for 6/8 80bpm when using pad on my Moto G50, no slouch of a device - odd. So reported as unusable. My testing has not progressed to my £79 chinese 10" tablet (v5 workhorse)!

iv-gha commented 1 year ago

Just checked v5.6 on my chinese tablet, same scenario as detailed for v6 on moto G50, vision and sound good. I am not noticing glitches on menu use. Were you using other features like connect, midi too?

Not meant to distract - so no great detail needed - just interested.

edit: you alrady said Midi?

iv-gha commented 1 year ago

I see what you mean about stall and catch up on stress (menu use etc.) for v6. High rates with no pad, moderate rates with pad see irregular patterns - additional activities see stall and catch up.

I am a visual only user - for song speed - and some combinations (my 6/8 80bpm, pad example) are funky to the point of being unreadable for speed - doh.

iv-gha commented 1 year ago

I remember fun with v5 having 2 separate loops (sound and visual) and originally both drifting from beat timings and from each other! A variable silence was added as you detail, however 'the next beat is measured from this new time point' with suggestion this point drifts from the proper beat is not quite right.

Looking at v5, I seems to be clock based using calculations of type 'nexttime = nexttime + time_in_millisecs;' where time_in_millisecs is the beat period calculated outside of the do loop and never varies. In the do loop the silence is calculated to (usually) get up to this 'nexttime' by 'if ((nexttime - System.currentTimeMillis()) > 0) ' with a call to audioGenerator of length to get up to 'nextime'. This is then followed by the sound which starts close to 'nextime' . This seems likely to support stress delays well.

It should be short of a full beat and so require an adjust because it is created deliberatly shorter than the time_in_millisecs.. This forces the additional silence adjusts to bring next attempt at playing a sound close to the next 'nextime'.

Hitting a next time is fundamental to both do loops, visual and sound. I had forgotten the tricks being used!

I was surprised that this code can deviate between 100 and 125 bpm for a 120bpm setting. Am I missing an obvious problem? Is System.currentTimeMillis() not a good clock?

As I mention I am a visual metronome user so could have missed big problems with sounds! Doh.

iv-gha commented 1 year ago

Data:

My thoughts: The brief data collected suggests v5.6 'clock lock' is stable and remains stable under stress. Under test, a small variance 120 vs 121 (0.0083%) is immediately obvious, this suggests 120 on one device is particularly close to 120 on the second device. Drift may be occuring in other circumstances. At this point, for v5.6 I have not seen drift.

Visual sync, as expected, is disturbed as screen changes are made. As expected, visual returns to good display when settled on the song with flashes on beat. No drift of visual compared to sound was observed.

thebigg73 commented 1 year ago

Unfortunately I don't think V6 can't use the v5 logic as it isn't a generated generated sine wave, but a audio clip. Is interesting that v5 worked well on your device, but definitely didn't on mine (Samsung Tab A 10)

On Sun, 28 May 2023, 08:06 iv-gha, @.***> wrote:

Data:

  • Sound sync
  • Unit 1 - Moto G50 £220
  • Unit 2 - Vankyo Z10 £79
  • Two v5.6 doing 120 for 10 minutes, initially in sync. Fundamentally in sync even with storage > rebuild performed over the period.
  • One v5.6 doing 120 with one v5.6 doing 121, initially in sync. Very obviously out of step within a short period.
  • One device doing 120. Tap beat used on second device, tapping as per device one beat. Settles on reporting beat as 120.

My thoughts: The brief data collected suggests v5.6 'clock lock' is stable and remains stable under stress. Under test, a small variance 120 vs 121 (0.0083%) is immediately obvious, this suggests 120 on one device is particularly close to 120 on the second device. Drift may be occuring in other circumstances. At this point, for v5.6 I have not seen drift.

Visual sync, as expected, is disturbed as screen changes are made. As expected, visual returns to good display when settled on the song with flashes on beat. No drift of visual compared to sound was observed.

— Reply to this email directly, view it on GitHub https://github.com/thebigg73/OpenSongTablet/issues/239#issuecomment-1565947513, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3X52QFHXZ46IUTZAVS4YLXIL2PBANCNFSM6AAAAAAYQ76E2M . You are receiving this because you commented.Message ID: @.***>

iv-gha commented 1 year ago

I think the logic is easily transferable. v6 problem is that the scheduler is poor. v5 programmatically schedules using a clock locked do loop running async. The Do can do clip etc and the trick of an aligning silence. v5.6 may have, by quirk, arrived at a way to force Android to behave!

Android!

Are there other cases of poor v5.6 Metronome stability? You are Samsung Tab A10 and v5.6?

thebigg73 commented 1 year ago

I'm not sure why you say the scheduler is poor in v6. The previous logcat I shared with you shows it is rock steady and locked to the system timer within a few ms per beat and never straying beyond the expected system time

On Sun, 28 May 2023 at 11:03, iv-gha @.***> wrote:

I think the logic is easily transferable. v6 problem is that the scheduler is poor. v5 programmatically schedules using a clock locked do loop running async. The Do can do clip etc and the trick of an aligning silence... mix and match! v5.6 may have, by quirk, arrived at a way to force Android to behave!

Android! Grrrr.

Are there other cases of poor v5.6 Metronome stability? You are Samsung Tab A10 and v5.6?

— Reply to this email directly, view it on GitHub https://github.com/thebigg73/OpenSongTablet/issues/239#issuecomment-1566059096, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3X52Q75T2NEORWXJKVC2TXIMPHVANCNFSM6AAAAAAYQ76E2M . You are receiving this because you commented.Message ID: @.***>

thebigg73 commented 1 year ago

The visual and audio timers are different entities, yet are both linked to the same system timer

On Sun, 28 May 2023 at 11:52, Gareth Evans @.***> wrote:

I'm not sure why you say the scheduler is poor in v6. The previous logcat I shared with you shows it is rock steady and locked to the system timer within a few ms per beat and never straying beyond the expected system time

On Sun, 28 May 2023 at 11:03, iv-gha @.***> wrote:

I think the logic is easily transferable. v6 problem is that the scheduler is poor. v5 programmatically schedules using a clock locked do loop running async. The Do can do clip etc and the trick of an aligning silence... mix and match! v5.6 may have, by quirk, arrived at a way to force Android to behave!

Android! Grrrr.

Are there other cases of poor v5.6 Metronome stability? You are Samsung Tab A10 and v5.6?

— Reply to this email directly, view it on GitHub https://github.com/thebigg73/OpenSongTablet/issues/239#issuecomment-1566059096, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3X52Q75T2NEORWXJKVC2TXIMPHVANCNFSM6AAAAAAYQ76E2M . You are receiving this because you commented.Message ID: @.***>

thebigg73 commented 1 year ago

Here's the latest log showing 80bpm for 6/8 timing

time slip(ms):6  System.currenTimeMillis():1684982619547  this event should be at:1684982619541  beatTimeLength:250
2023-05-25 03:43:39.797 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982619797  this event should be at:1684982619791  beatTimeLength:250
2023-05-25 03:43:40.047 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982620047  this event should be at:1684982620041  beatTimeLength:250
2023-05-25 03:43:40.199 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.01ms min=116.38ms max=133.92ms count=8
2023-05-25 03:43:40.297 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982620297  this event should be at:1684982620291  beatTimeLength:250
2023-05-25 03:43:40.548 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):7  System.currenTimeMillis():1684982620548  this event should be at:1684982620541  beatTimeLength:250
2023-05-25 03:43:40.797 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982620797  this event should be at:1684982620791  beatTimeLength:250
2023-05-25 03:43:41.047 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982621047  this event should be at:1684982621041  beatTimeLength:250
2023-05-25 03:43:41.298 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):7  System.currenTimeMillis():1684982621298  this event should be at:1684982621291  beatTimeLength:250
2023-05-25 03:43:41.332 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.93ms min=116.45ms max=133.70ms count=9
2023-05-25 03:43:41.548 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):7  System.currenTimeMillis():1684982621548  this event should be at:1684982621541  beatTimeLength:250
2023-05-25 03:43:41.797 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982621797  this event should be at:1684982621791  beatTimeLength:250
2023-05-25 03:43:42.047 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):6  System.currenTimeMillis():1684982622047  this event should be at:1684982622041  beatTimeLength:250
2023-05-25 03:43:42.373 32251-32340 BufferPoolAccessor2.0   com...thevans.church.opensongtablet  D  bufferpool2 0xb40000757c4ea388 : 0(0 size) total buffers - 0(0 size) used buffers - 0/5 (recycle/alloc) - 4/8 (fetch/transfer)
2023-05-25 03:43:42.374 32251-32340 BufferPoolAccessor2.0   com...thevans.church.opensongtablet  D  evictor expired: 1, evicted: 1
2023-05-25 03:43:42.379 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):88  System.currenTimeMillis():1684982622379  this event should be at:1684982622291  beatTimeLength:250
2023-05-25 03:43:42.391 32251-32279 Parcel                  com...thevans.church.opensongtablet  W  Expecting binder but got null!
2023-05-25 03:43:42.452 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=112.02ms min=50.13ms max=134.20ms count=10
2023-05-25 03:43:42.541 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982622541  this event should be at:1684982622541  beatTimeLength:250
2023-05-25 03:43:42.858 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):67  System.currenTimeMillis():1684982622858  this event should be at:1684982622791  beatTimeLength:250
2023-05-25 03:43:43.044 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982623044  this event should be at:1684982623041  beatTimeLength:250
2023-05-25 03:43:43.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982623293  this event should be at:1684982623291  beatTimeLength:250
2023-05-25 03:43:43.375 32251-32340 BufferPoolAccessor2.0   com...thevans.church.opensongtablet  D  bufferpool2 0xb40000757c4e72f8 : 0(0 size) total buffers - 0(0 size) used buffers - 0/5 (recycle/alloc) - 4/8 (fetch/transfer)
2023-05-25 03:43:43.375 32251-32340 BufferPoolAccessor2.0   com...thevans.church.opensongtablet  D  evictor expired: 1, evicted: 1
2023-05-25 03:43:43.541 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982623541  this event should be at:1684982623541  beatTimeLength:250
2023-05-25 03:43:43.565 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=90.92ms min=16.88ms max=176.02ms count=12
2023-05-25 03:43:43.796 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):5  System.currenTimeMillis():1684982623796  this event should be at:1684982623791  beatTimeLength:250
2023-05-25 03:43:44.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982624042  this event should be at:1684982624041  beatTimeLength:250
2023-05-25 03:43:44.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982624293  this event should be at:1684982624291  beatTimeLength:250
2023-05-25 03:43:44.544 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982624544  this event should be at:1684982624541  beatTimeLength:250
2023-05-25 03:43:44.566 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.04ms min=115.34ms max=133.74ms count=8
2023-05-25 03:43:44.791 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982624791  this event should be at:1684982624791  beatTimeLength:250
2023-05-25 03:43:45.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982625042  this event should be at:1684982625041  beatTimeLength:250
2023-05-25 03:43:45.292 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982625292  this event should be at:1684982625291  beatTimeLength:250
2023-05-25 03:43:45.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982625543  this event should be at:1684982625541  beatTimeLength:250
2023-05-25 03:43:45.682 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=123.99ms min=115.77ms max=133.33ms count=9
2023-05-25 03:43:45.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982625792  this event should be at:1684982625791  beatTimeLength:250
2023-05-25 03:43:46.041 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982626041  this event should be at:1684982626041  beatTimeLength:250
2023-05-25 03:43:46.292 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982626292  this event should be at:1684982626291  beatTimeLength:250
2023-05-25 03:43:46.544 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982626544  this event should be at:1684982626541  beatTimeLength:250
2023-05-25 03:43:46.682 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.02ms min=115.43ms max=134.77ms count=8
2023-05-25 03:43:46.791 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982626791  this event should be at:1684982626791  beatTimeLength:250
2023-05-25 03:43:47.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982627042  this event should be at:1684982627041  beatTimeLength:250
2023-05-25 03:43:47.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982627293  this event should be at:1684982627291  beatTimeLength:250
2023-05-25 03:43:47.544 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982627544  this event should be at:1684982627541  beatTimeLength:250
2023-05-25 03:43:47.682 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.01ms min=116.94ms max=133.33ms count=8
2023-05-25 03:43:47.791 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982627791  this event should be at:1684982627791  beatTimeLength:250
2023-05-25 03:43:48.043 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982628043  this event should be at:1684982628041  beatTimeLength:250
2023-05-25 03:43:48.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982628293  this event should be at:1684982628291  beatTimeLength:250
2023-05-25 03:43:48.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982628543  this event should be at:1684982628541  beatTimeLength:250
2023-05-25 03:43:48.684 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.21ms min=116.06ms max=135.39ms count=8
2023-05-25 03:43:48.791 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982628791  this event should be at:1684982628791  beatTimeLength:250
2023-05-25 03:43:49.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982629042  this event should be at:1684982629041  beatTimeLength:250
2023-05-25 03:43:49.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982629293  this event should be at:1684982629291  beatTimeLength:250
2023-05-25 03:43:49.542 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982629542  this event should be at:1684982629541  beatTimeLength:250
2023-05-25 03:43:49.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982629792  this event should be at:1684982629791  beatTimeLength:250
2023-05-25 03:43:49.815 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.66ms min=116.41ms max=133.79ms count=9
2023-05-25 03:43:50.043 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982630043  this event should be at:1684982630041  beatTimeLength:250
2023-05-25 03:43:50.292 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982630292  this event should be at:1684982630291  beatTimeLength:250
2023-05-25 03:43:50.546 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):5  System.currenTimeMillis():1684982630546  this event should be at:1684982630541  beatTimeLength:250
2023-05-25 03:43:50.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982630792  this event should be at:1684982630791  beatTimeLength:250
2023-05-25 03:43:50.934 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=124.33ms min=113.44ms max=135.81ms count=9
2023-05-25 03:43:51.043 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982631043  this event should be at:1684982631041  beatTimeLength:250
2023-05-25 03:43:51.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982631293  this event should be at:1684982631291  beatTimeLength:250
2023-05-25 03:43:51.541 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982631541  this event should be at:1684982631541  beatTimeLength:250
2023-05-25 03:43:51.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982631792  this event should be at:1684982631791  beatTimeLength:250
2023-05-25 03:43:52.043 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982632043  this event should be at:1684982632041  beatTimeLength:250
2023-05-25 03:43:52.067 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.82ms min=116.60ms max=134.82ms count=9
2023-05-25 03:43:52.292 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982632292  this event should be at:1684982632291  beatTimeLength:250
2023-05-25 03:43:52.541 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982632541  this event should be at:1684982632541  beatTimeLength:250
2023-05-25 03:43:52.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982632792  this event should be at:1684982632791  beatTimeLength:250
2023-05-25 03:43:53.044 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982633044  this event should be at:1684982633041  beatTimeLength:250
2023-05-25 03:43:53.182 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=123.95ms min=115.39ms max=133.80ms count=9
2023-05-25 03:43:53.295 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):4  System.currenTimeMillis():1684982633295  this event should be at:1684982633291  beatTimeLength:250
2023-05-25 03:43:53.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982633542  this event should be at:1684982633541  beatTimeLength:250
2023-05-25 03:43:53.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982633792  this event should be at:1684982633791  beatTimeLength:250
2023-05-25 03:43:54.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982634042  this event should be at:1684982634041  beatTimeLength:250
2023-05-25 03:43:54.182 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=124.99ms min=115.42ms max=133.33ms count=8
2023-05-25 03:43:54.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982634293  this event should be at:1684982634291  beatTimeLength:250
2023-05-25 03:43:54.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982634543  this event should be at:1684982634541  beatTimeLength:250
2023-05-25 03:43:54.794 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982634794  this event should be at:1684982634791  beatTimeLength:250
2023-05-25 03:43:55.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982635042  this event should be at:1684982635041  beatTimeLength:250
2023-05-25 03:43:55.291 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982635291  this event should be at:1684982635291  beatTimeLength:250
2023-05-25 03:43:55.300 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=124.13ms min=116.17ms max=133.76ms count=9
2023-05-25 03:43:55.544 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982635544  this event should be at:1684982635541  beatTimeLength:250
2023-05-25 03:43:55.793 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982635793  this event should be at:1684982635791  beatTimeLength:250
2023-05-25 03:43:56.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982636042  this event should be at:1684982636041  beatTimeLength:250
2023-05-25 03:43:56.292 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982636292  this event should be at:1684982636291  beatTimeLength:250
2023-05-25 03:43:56.316 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=126.97ms min=113.72ms max=135.68ms count=8
2023-05-25 03:43:56.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982636543  this event should be at:1684982636541  beatTimeLength:250
2023-05-25 03:43:56.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982636792  this event should be at:1684982636791  beatTimeLength:250
2023-05-25 03:43:57.041 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982637041  this event should be at:1684982637041  beatTimeLength:250
2023-05-25 03:43:57.292 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982637292  this event should be at:1684982637291  beatTimeLength:250
2023-05-25 03:43:57.433 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=124.09ms min=114.58ms max=135.30ms count=9
2023-05-25 03:43:57.542 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982637542  this event should be at:1684982637541  beatTimeLength:250
2023-05-25 03:43:57.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982637792  this event should be at:1684982637791  beatTimeLength:250
2023-05-25 03:43:58.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982638042  this event should be at:1684982638041  beatTimeLength:250
2023-05-25 03:43:58.294 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982638294  this event should be at:1684982638291  beatTimeLength:250
2023-05-25 03:43:58.544 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684982638544  this event should be at:1684982638541  beatTimeLength:250
2023-05-25 03:43:58.567 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=126.07ms min=115.02ms max=135.74ms count=9
2023-05-25 03:43:58.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982638792  this event should be at:1684982638791  beatTimeLength:250
2023-05-25 03:43:59.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982639042  this event should be at:1684982639041  beatTimeLength:250
2023-05-25 03:43:59.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982639293  this event should be at:1684982639291  beatTimeLength:250
2023-05-25 03:43:59.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982639543  this event should be at:1684982639541  beatTimeLength:250
2023-05-25 03:43:59.682 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=123.88ms min=115.50ms max=133.25ms count=9
2023-05-25 03:43:59.791 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684982639791  this event should be at:1684982639791  beatTimeLength:250
2023-05-25 03:44:00.042 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982640042  this event should be at:1684982640041  beatTimeLength:250
2023-05-25 03:44:00.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982640293  this event should be at:1684982640291  beatTimeLength:250
2023-05-25 03:44:00.542 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982640542  this event should be at:1684982640541  beatTimeLength:250
2023-05-25 03:44:00.683 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=111.13ms min=44.47ms max=133.75ms count=9
2023-05-25 03:44:00.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982640792  this event should be at:1684982640791  beatTimeLength:250
2023-05-25 03:44:01.043 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982641043  this event should be at:1684982641041  beatTimeLength:250
2023-05-25 03:44:01.294 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982641293  this event should be at:1684982641291  beatTimeLength:250
2023-05-25 03:44:01.543 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982641543  this event should be at:1684982641541  beatTimeLength:250
2023-05-25 03:44:01.792 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684982641792  this event should be at:1684982641791  beatTimeLength:250
2023-05-25 03:44:01.815 32251-32279 EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.86ms min=116.65ms max=133.54ms count=9
2023-05-25 03:44:02.046 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):5  System.currenTimeMillis():1684982642046  this event should be at:1684982642041  beatTimeLength:250
2023-05-25 03:44:02.293 32251-32251 Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684982642293  this event should be at:1684982642291  beatTimeLength:250
thebigg73 commented 1 year ago

This was set running and early on in the boot process there were two glitches at 88ms and 67ms, but the following beats were still scheduled within a couple of ms of the expected system time. I can't see an issue with this sequencer - locked to the system timer.

thebigg73 commented 1 year ago

Including logcat with visual metronome colour changes (flashbar #1 is on flashbar #2 is off half way through)

2023-05-25 04:35:00.893  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985700893  this event should be at:1684985700892  beatTimeLength:250
2023-05-25 04:35:00.899  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.018  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.143  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985701143  this event should be at:1684985701142  beatTimeLength:250
2023-05-25 04:35:01.148  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.269  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.393  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.394  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985701394  this event should be at:1684985701392  beatTimeLength:250
2023-05-25 04:35:01.519  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.532  9141-9174  EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.57ms min=116.27ms max=133.63ms count=9
2023-05-25 04:35:01.643  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.643  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985701643  this event should be at:1684985701642  beatTimeLength:250
2023-05-25 04:35:01.768  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:01.894  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):2  System.currenTimeMillis():1684985701894  this event should be at:1684985701892  beatTimeLength:250
2023-05-25 04:35:01.900  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.018  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.143  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985702143  this event should be at:1684985702142  beatTimeLength:250
2023-05-25 04:35:02.144  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.268  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.393  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985702393  this event should be at:1684985702392  beatTimeLength:250
2023-05-25 04:35:02.400  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.518  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.534  9141-9174  EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=125.27ms min=115.59ms max=134.28ms count=8
2023-05-25 04:35:02.643  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.647  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):5  System.currenTimeMillis():1684985702647  this event should be at:1684985702642  beatTimeLength:250
2023-05-25 04:35:02.768  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:02.892  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684985702892  this event should be at:1684985702892  beatTimeLength:250
2023-05-25 04:35:02.894  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.018  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.143  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.143  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985703143  this event should be at:1684985703142  beatTimeLength:250
2023-05-25 04:35:03.268  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.393  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.397  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):5  System.currenTimeMillis():1684985703397  this event should be at:1684985703392  beatTimeLength:250
2023-05-25 04:35:03.519  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.643  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.643  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985703643  this event should be at:1684985703642  beatTimeLength:250
2023-05-25 04:35:03.649  9141-9174  EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=123.84ms min=114.29ms max=133.98ms count=9
2023-05-25 04:35:03.785  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.893  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:03.893  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985703893  this event should be at:1684985703892  beatTimeLength:250
2023-05-25 04:35:04.019  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.143  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.160  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):17  System.currenTimeMillis():1684985704159  this event should be at:1684985704142  beatTimeLength:250
2023-05-25 04:35:04.269  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.393  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.405  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):13  System.currenTimeMillis():1684985704405  this event should be at:1684985704392  beatTimeLength:250
2023-05-25 04:35:04.523  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.642  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):0  System.currenTimeMillis():1684985704642  this event should be at:1684985704642  beatTimeLength:250
2023-05-25 04:35:04.646  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.649  9141-9174  EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=10.60ms min=1.64ms max=51.12ms count=38
2023-05-25 04:35:04.767  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.893  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:04.893  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985704893  this event should be at:1684985704892  beatTimeLength:250
2023-05-25 04:35:05.019  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.143  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985705143  this event should be at:1684985705142  beatTimeLength:250
2023-05-25 04:35:05.145  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.268  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.393  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):1  System.currenTimeMillis():1684985705393  this event should be at:1684985705392  beatTimeLength:250
2023-05-25 04:35:05.398  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.518  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.657  9141-9174  EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=78.66ms min=2.08ms max=134.34ms count=12
2023-05-25 04:35:05.681  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):39  System.currenTimeMillis():1684985705681  this event should be at:1684985705642  beatTimeLength:250
2023-05-25 04:35:05.694  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.816  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:05.922  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):30  System.currenTimeMillis():1684985705922  this event should be at:1684985705892  beatTimeLength:250
2023-05-25 04:35:05.931  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.017  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.143  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.179  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):37  System.currenTimeMillis():1684985706179  this event should be at:1684985706142  beatTimeLength:250
2023-05-25 04:35:06.268  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.418  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):25  System.currenTimeMillis():1684985706418  this event should be at:1684985706392  beatTimeLength:250
2023-05-25 04:35:06.432  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.518  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.645  9141-9141  Metronome               com...thevans.church.opensongtablet  D  time slip(ms):3  System.currenTimeMillis():1684985706645  this event should be at:1684985706642  beatTimeLength:250
2023-05-25 04:35:06.646  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
2023-05-25 04:35:06.665  9141-9174  EGL_emulation           com...thevans.church.opensongtablet  D  app_time_stats: avg=13.84ms min=1.87ms max=132.84ms count=32
2023-05-25 04:35:06.767  9141-9141  MyToolbar               com...thevans.church.opensongtablet  D  flash bar
iv-gha commented 1 year ago

As ever my word choices can confuse - my scheduler comment being overall ability to easily code to hear a sound at a specific time.

thebigg73 commented 1 year ago

I've added in a buffer of 100ms. Any measured delay is subtracted from this and the result postdelayed by the difference. This is similar to the calcsilence in v5. Still, with Android there will always be audio jitter when there is system load. Unfortunately it doesn't have a real time low latency kernel in the same way Mac and Linux can. These changes along with the others above, hopefully fix this issue as best as possible by removing the latency up to the audio call (after that we have to rely on the system to play it as soon as possible as it did in v5). Hopefully you'll find the changes an improvement and like the updated visual metronome and ability to completely separate audio/visual metronomes while ensuring they both stick to the system.currentMillis() time requests.

iv-gha commented 1 year ago

I like the BB beat animation. It is clear.

Please test at your end with a pad playing.

4/4 - Above 120 - please test 299 6/8 - Above 80 - please test 299 Test with in-built and external pad running please.

I remember v5 with pad and metronome would severely stall in song change - causing 10s wait for song change. Pad and metronome (I think) were moved to independent thread pools - to stop stall of main.

I have tried an independant thread for metronome sound and my test gives irregular patterns of sound beats.

Visual is good - regular and easy to see with the new display. Great.

At the moment Soundpool appears to be unsuitable for regular playing of short mp3 files. At least, in the way it is currently invoked.

Is it fixable? Not sure. Slightly depressing!

Beta performance has gained from your live use for over a year with it good in your use case.

At first beta Stage and presentation were not working at all - no section split handing, sections not being rendered. We have moved it on a lot. I am happier that we are focusing more on Stage and Presentation.

iv-gha commented 1 year ago

After much trying - I think we have to conclude that soundPool is not good for metronome. I agree with you

"Unfortunately Android has poor timing - fact. Android receiving the request and playing the note on a busy system is the issue. Particularly if we used background threads - the system prioritises for us."

The system priority for soundPool queue is so low that it is unsuitable for the metronome feature of opensongapp.

I think to revert to v5.6 use of generated main and timing adjustments sounds in a clock locked loop - with a note to look at mp3 again later.

(#102, #104, #131 are the v5 commits that added the clock lock for beat timing and moved to use of a separate thread pool. These commits made it into v5.4.1 in Nov 21.)

thebigg73 commented 1 year ago

I'm looking into using Oboe - low latency audio api on Android. Reverting back to v5 behaviour would require a rewrite of the metronome setup and would degrade functionality. Hopefully moving to Oboe will improve it and I'd rather spend the time fixing it rather than trying to force fit old code back in. Leave it with me.

On Mon, 5 Jun 2023 at 13:32, iv-gha @.***> wrote:

After much trying - I think we have to conclude that soundPool is not good for metronome. I agree with you

"Unfortunately Android has poor timing - fact. Android receiving the request and playing the note on a busy system is the issue. Particularly if we used background threads - the system prioritises for us."

The system priority for soundPool queue is so low that it is unsuitable for the metronome feature of opensongapp.

I think to revert to v5.6 use of generated main and timing adjustments sounds in a clock locked loop - with a note to look at mp3 again later.

(#102 https://github.com/thebigg73/OpenSongTablet/pull/102, #104 https://github.com/thebigg73/OpenSongTablet/pull/104, #131 https://github.com/thebigg73/OpenSongTablet/pull/131 are the v5 commits that added the clock lock for beat timing and moved to use of a separate thread pool. These commits made it into v5.4.1 in Nov 21.)

— Reply to this email directly, view it on GitHub https://github.com/thebigg73/OpenSongTablet/issues/239#issuecomment-1576698475, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3X52XWZ3XE2UY7NAXD2QTXJXGVVANCNFSM6AAAAAAYQ76E2M . You are receiving this because you commented.Message ID: @.***>