An API to Measure Loudness, from Standards to Streaming
Tags: audio, streaming, media
Published: 2021-01-06 22:57:50

---
title: An API to Measure Loudness, from Standards to Streaming
published: true
description: The Dolby.io Media Processing Analyze API can be used to measure loudness and validate media workflows to streaming platforms.
tags: audio,streaming,media
cover_image: https://cdn.dolby.io/wp-content/uploads/2020/05/Noise-Reduction-Blog-Image-Desktop.jpg
canonical_url: https://dolby.io/blog/an-api-to-measure-loudness-from-standards-to-streaming
---
For content creators, loudness is an important consideration. Streaming services and broadcasters will enforce broadcasting recommendations and standards to insure a uniform experience for listeners. If you are creating an application or media workflow for content creators, measuring and reporting on loudness is an important feature.

# What is Loudness Anyway?

Loudness is the subjective perception of the level of sound. The loudness level should be kept consistent for the best listener experience. The reliable control of audio loudness has long been an issue for content creators, producers, and broadcasters.

The fundamental problem comes down to a standardized method of measuring loudness of an audio program. There have historically been some objective measures, but beginning in the early 2000s the International Telecommunication Union (ITU) started work to develop a loudness metric for use in broadcasting. The published recommendation ITU-R BS.1770 “Algorithms to measure audio programme loudness and true-peak level” describes a measurement algorithm that has become the “standard” for loudness of media in broadcast and online streaming services.

If you want to learn a bit more about how this measurement works you can check out the spec or take a look at our Measuring Loudness Guide.

# LUFS or LKFS

The result of a loudness measurement is a single loudness value in the units of LKFS, loudness K-weighted full-scale. It should be noted, that the unit of LKFS is equivalent to a decibel scale, such that a 1 dB increase will cause the loudness reading to increase by 1 LKFS. This is often referred to as a 1 LU increase in loudness. The EBU uses LUFS as an equivalent to LKFS, but they are identical measures.

This value is reported from the Media Analyze API, so if you follow the Quick Start Tutorial you can get a response on your own media that looks like this:

```
    audio: {
      ...,
      loudness: {
        measured: -20.45,
        range: 4.49,
        gating_mode: 'speech',
        sample_peak: -7.87,
        true_peak: -7.86
      }
```

This measured a loudness of -20.45 LKFS (or LUFS). For an explanation of the other data returned you can learn more in the Analyzing Loudness Guide.

# Loudness Ranges

For content creators, the target loudness may be a personal preference or it may be enforced by a media distribution platform. Generally, it is a good idea to measure loudness to avoid any issues later. We’ve heard horror stories of platforms that squash submitted media and creating clipping or other issues during ingest.

There are some broadcasting recommendations such as ATSC A/85 or EBU R.128. You can learn more about these standards in our Recommendations and Standards Guide. If you are targeting one of these standards you must be in the range (-22, -26) for ATSC and (-22.5, -23.5) for EBU.

# Streaming Platforms

You can find a table listing supported profiles including the target loudness ranges for many popular streaming services including Amazon, Apple, Facebook, Pandora, Spotify, SoundCloud, Vimeo, and Youtube.

Using the Media Analyze API you can check to see if your music or podcast conforms to the standards of a chosen distribution platform.

Here’s an example using cURL:
```
curl -X POST https://api.dolby.com/media/analyze \
  --header "x-api-key: $DOLBYIO_API_KEY" \
  --data '{
  "input": "dlb://in/example.mp3",
  "loudness": {
    "profile": "service_spotify"
    }
  }'
```

# Conclusion

Loudness is a key feature in audio production workflows. The Media Analyze API can be used to measure and validate loudness level. You can use the Media Enhance API if you want to adjust loudness to be within a particular range.

To add this feature to your media pipeline tools, plugins, or web applications you can find some helpful [code samples](https://github.com/DolbyIO/media-api-samples) in our GitHub repository.