WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Bluetooth Audio Lag

Forums > Swift

How can I detect actual realtime latency lag between iOS Swift app and a bluetooth audio device?

Scenario

I'm working on an app with bi-directional audio (i.e. playing audio and recording audio to later be layered over the original - think karaoke). I've got the session set so it is handling bi-directional w/ adequate quality, but the recorded audio is typically behind up to 500ms so getting them in synch is not happening.

Not sure the best approach, as latency can change for a variety of reasons in realtime. Maybe is there a way to "ping" the headset periodically in order to get a 'current' latency and adjust my offset accordingly?

Apps like TikTok are handling this, so it must be solvable, but every search I do tells me how to correct delay on my device within the XYX app...which is not what I need. I need to build a solution in code.

If this isn't a good forum for this, any suggestions on where to look would be appreciated as well.

Happy Swifting.... :-)

audio #bluetooth #ios #swift

   

Save 50% in my Black Friday sale.

SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.