May 28, 2021

Dissecting the challenges relating to real-time audio on mobile platforms

This edition of Before DevBreak offers insight into the main aspects of real-time music apps that can dampen the user experience on mobile platforms. In this talk, Thomas Hezard, the Lead Audio Scientist at Music World Media offers a wide range of solutions to the major challenges in processing and delivering audio in real-time music apps on mobile platforms.

The main challenges of real-time music apps on mobile platforms

Firstly, real-time music apps on mobile platforms face latency issues. Think of latency as the time it takes from making an action like pressing a key on a piano synthesizer app to realizing the result i.e. hearing the sound from the speakers. Ideally, you want this time to be as short as possible, but it’s not always that easy.

Secondly, reproducing musical instruments through control interfaces on 2D displays comes with limited haptic feedback. Basically, users don’t have the same exact physical feeling of pressing a key, turning a knob, moving a slider, etc.

Thirdly, many mobile devices are constrained when it comes to audio inputs and outputs. They do not have all the ports needed to work with advanced audio setups.

Solutions

Latency

With real-time music apps, the recommended latency is something below 20 milliseconds. Low latency is usually achieved through a smaller buffer size (the amount of samples the audio API requests from the audio app with each call). However, smaller buffer size implies heavier CPU computation, eventually overworking the CPU and producing audio glitches.

Ultimately, it’s about striking a decent balance. Choose a buffer size that’s not so big that it produces high latency, but also not so small that it requires a lot of computational power, which can be achieved by precise benchmarks when you have access to all the devices targeted by your app, or by a quick runtime benchmark at the start of your app.

To avoid audio glitches, you need to provide continuous valid audio data on time at every single call of the audio API. When working on your real-time audio code, the code executed on the audio thread, you need to

  • always pay attention to the computational cost of your signal processing code,
  • ensure the integrity and continuity of your output audio signal,
  • stick to system-level language (C/C++),
  • and use only lock-free code and pre-allocated memory while avoiding disk and network access.

Control interfaces

Apps can harness tactile interfaces to extend the way they manipulate sound through touch. You can also use external controllers, for example through standard interfaces like MIDI, to bring back physical interactions and musical gestures to mobile music apps.

Audio inputs and outputs

Modern mobile devices support most USB audio interfaces, allowing developers to extend the audio I/O capabilities of their mobile apps and interact with external audio hardware.

📹 To learn more about these solutions and see some of them in action, you can watch the full talk here.

About talent.io and DevBreak

Before DevBreak is a series of live, online, tech talks. Each session features a senior tech expert from an innovative company, who demonstrates how they solved major programming challenges in their business. This series is part of DevBreak, the ultimate 2-day tech festival organised by talent.io.

talent.io is Europe's leading selective recruitment platform which has over €10m fund raised and is over 170 employees strong. We help great companies build great tech teams, in the simplest way: selected companies apply directly to vetted candidates. We cover most tech roles (software engineers, data scientists, product managers, DevOps engineers, CTOs). Our platform is open to permanent positions as well as freelance assignments, both on-site and remote.

  • 7,000+ companies use talent.io, such as Deliveroo, Volkswagen, N26, PayFit and Aircall
  • 6,000+ candidates recruited, for permanent contracts and for freelance assignments
  • 5 Countries / 11 cities (Paris, Lyon, Lille, Bordeaux, Toulouse, Berlin, Hamburg, Munich, London, Amsterdam, Brussels)

Consulter nos autres resources

October 6, 2021
Un guide pour construire votre équipe tech en remote
Regarder le replay →
June 16, 2021
talent.io s'associe à Deel pour créer la façon la plus simple de gérer l'embauche et la paie de vos équipes à l'étranger
Regarder le replay →
February 17, 2021
talent.io dévoile le salaire des professionnel·les de la tech en France
Regarder le replay →

Other articles picked for you

October 6, 2021
A guide to build your remote tech team
Read more →
September 30, 2021
How MDD can help tech team boost their productivity
Read more →
July 15, 2021
The journey of transitioning to a Shape Up methodology
Read more →