Reputation: 1
I'm building a metronome based android app, I only lately found out that my app is experiencing high latency and noticeable jitter so the metronome is useless. I'm using VS community 2022, the project is a C# cross platform MAUI based solution, I've benchmarked almost all sections of code, made sure the GC is not in the way, got direct calls to the play function.... nothing could cope with it.
I saw many musical applications that has zero latency and it frustrates me and prevents me from reaching the interesting parts of my app.
I couldn't find any useful information, according to android's model such latency make sense but I believe we can overcome it.
Microsoft's Copilot didn't have good answers, it offered writing an .so lib that implements the play logic, called by c# DllImport annotation which didn't make any sense to me since my env is Windows based (Dll and not so libs).
Please help Thanks!
P.S.
I'm using the following command to load the sound:
IAudioPlayer player = Plugin.Maui.Audio.AudioManager.Current.CreatePlayer(mCtx.Resources.OpenRawResourceFd(resId).CreateInputStream());
And this is how I play it:
IAudioPlayer player = (IAudioPlayer)osSoundObj; player.Play();
I used AudioTrack as well, but nothing seems to improve it.
Upvotes: 0
Views: 21