Over a million developers have joined DZone.

3 Tips for Ensuring Flawless Streaming Audio Applications

DZone's Guide to

3 Tips for Ensuring Flawless Streaming Audio Applications

Digital content delivery has changed the face of the music industry. Learn how successful brands ensure seamless audio streaming in their apps.

· Mobile Zone ·
Free Resource

The music industry has been going through a tremendous transformation for some time now, aiming to

  • Discover new ways to drive adoption and usage.

  • Explore new revenue streams and innovation.

The introduction of digital content delivery (MP3, iTunes, etc.) was the first immensely disruptive wave,  followed by live music streaming.  After over a decade of gloomy outlook, things are starting to look promising, thanks to the rise in digital music services.

Image title


Interestingly, many music-related vendors are finding new innovative paths to success: Shazam, one of the well-known brands in this space, is now capable of not only recognizing a song, the app can recognize an image, and there’s even a TV show

Users are reacting favorably to new services and devices: According to Nielsen, on-demand audio streams grew by 76% in 2016. Interestingly, while digital sales are dominant, users are preferring streaming experiences. Streaming experiences enable users to enriched discovery experiences and flexibility.

Image title

Nowadays, with offline access and proliferation of unlimited cellular plans, streaming records are breaking: in 2016, over 27 songs passed 200 million on-demand streams. Spotify is another example, readying to go public with 60 million subscribers.

With such tremendous potential in the music business come challenges. Much like other industries (finance, healthcare, and retail), users’ expectation for a flawless experience is high. In addition, users are extremely impacted by the quality of the song being played. That is the case for paid services as well as free ones.

For music vendors, there are many challenges: competing in a challenging and busy market, achieving revenue and user goals, and driving innovation and quality to end users. For testers of mobile music applications, this represents yet another quality requirement in a shrinking agile cycle. As always- the answer to this challenge comes through automation.

Through the introduction of the audio-testing capable lab, it is possible to introduce test automation to audio applications such as Spotify, Pandora, Shazam, and Audible. The ecosystem is extensible such that integration with song recognition engines, for example, is possible as well.

In the demo below (open source code available here), the following is shown:

  • Launching the iHeart Radio app and recording a snippet of a song:

    // http://developers.perfectomobile.com/pages/viewpage.action?pageId=14878149
    public static String startAudioRecording(RemoteWebDriver driver) {
        Map<String, Object> params = new HashMap<>();

        String audioFileURL = (String) driver.executeScript("mobile:audio.recording:start", params);
        return audioFileURL;

    // http://developers.perfectomobile.com/pages/viewpage.action?pageId=14878153
    public static void stopAudioRecording(RemoteWebDriver driver) {
        Map<String, Object> params = new HashMap<>();
        driver.executeScript("mobile:audio.recording:stop", params);
  • Recognize the song (using the snippet) using an integration with a song recognition algorithm (ACRCloud). Compare the song name and artist to the meta data shown on the app.

public static String detectSong(String url){
// Reads the audio file into memory
String resultString = null;
try {
Path filePath = download(url);  

ACRCloudRecognizer acr = new ACRCloudRecognizer();
resultString = acr.recognizeByFile(filePath.toString(), 0);
catch (Exception e) {
// TODO Auto-generated catch block
return resultString;

  • Recognize the song (again) using the Shazam App, and compare again.

    // http://developers.perfectomobile.com/pages/viewpage.action?pageId=13893806
    public static void injectAudio(RemoteWebDriver driver, String repositoryKey) {
        Map<String, Object> params = new HashMap<>();
        params.put("key", repositoryKey);
        driver.executeScript("mobile:audio:inject", params);

Going through this exercise was fun. If you’re developing an audio app, we recommend you check out the documentation on audio functions, specifically about the audio quality validation capabilities. Here are a few points for you to consider:

  • Ensure the basic functionality of the app works via standard test automation. Run those scripts nightly or even as part of the smoke test every commit.
  • Include audio test automation in your nightly test. Ensure that the stream is comprehensible (audible text or recognizable music) via appropriate engines.
  • Last, add audio quality measurement to your testing. Repeat both in ideal conditions as well as in sub-optimal network and device load conditions.

Music streaming and audio services are gaining popularity these days. Testing of those services is a task that best managed via objective, automated process. This approach enables the development team to focus on innovation while ensuring on-time delivery of a high-quality app to the market. Seems like Spotify is getting it right:

Image title

Spotify's app rating in the App Store.

music app development ,mobile ,mobile app development ,audio ,test automation ,mobile testing

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}