Advertisement
  1. Code
  2. Dolby
Code

The Dolby Audio and Microsoft Edge Experience

by
Languages:
Sponsored Content

This sponsored post features a product relevant to our readers while meeting our editorial guidelines for being objective and educational.

Streaming online audio and video has been given a massive injection of awesome. No longer is the online experience limited to two-channel stereo sound. Dolby Digital Plus, an advanced codec from Dolby, has been designed specifically to enhance the online experience by providing a high-fidelity, low-latency solution for streaming surround sound media, and the codec is built into Microsoft Windows 10 as standard.

No special tricks or dedicated plugins are required to experience surround sound through a web browser, because the Dolby Digital Plus codec is available to HTML5 audio and video elements just like any other codec. That means you can experience engaging Dolby surround sound media online today, assuming the web browser and operating system you are using supports the Dolby Digital Plus codec.

HTML5 Feature Detection

If you are a web developer, and you want to provide your users with surround sound media, you will need to make sure the Dolby Digital Plus codec is available. If the codec is unavailable, you will need to provide an alternative media stream.

Needless to say, users running Windows 10 and the Microsoft Edge browser will be able to enjoy Dolby surround sound media streams, but feature detection is required to provide content to the widest possible audience.

Modern web browsers can actually deal with feature detection on your behalf if you add media elements directly to the HTML document. The following HTML snippet will attempt to play a Dolby Digital Plus encoded video stream, and it will fall back to a standard stereo encoded video stream if the Dolby Digital Plus codec is unavailable.

If you want to handle the feature detection with JavaScript, you can use the canPlayType function that is exposed by media elements.

It is a simple as that. You can also check out the attached silence.mp4 file to use in your own testing. Note that the usage of the Silence.mp4 file is because some browsers return false-positives. If you have worked with HTML5 media elements before, you are probably already comfortable with that type of feature detection in web browsers.

Note: Dolby Digital Plus is not limited to video streams. You can provide standalone surround sound audio streams to your audience if you wish to do so.

Surround Sound

So, what is surround sound exactly? In a nutshell, a surround sound audio stream typically consists of six or eight individual sound channels. It provides a way to immerse the listener in a dynamic, 3D soundscape, and is the de facto standard for movie theaters and home entertainment systems. In contrast, a stereo audio stream only consists of two individual sound channels, and a mono audio stream consists of a single sound channel.

5.1 Surround Sound

5.1 surround sound audio streams consist of six individual sound channels.

The first three sound channels (LCR) are positioned in front of the listener, to the left, center and right. They provide the majority of the sound and are, for the most part, compatible with the standard stereo left and right sound channels. The center sound channel is typically used for dialog, but it also helps to keep sound centered when subtle panning occurs in a movie.

The next two sound channels (LS and RS) are positioned behind the listener. They provide the "surround" in a surround sound audio stream, and are typically used to enhance ambient soundscapes. If you imagine a movie scene in which someone is walking through a forest, the LS and RS sound channels may be used to provide additional sounds for bird calls, rustling leaves, gusts of wind, and so on.

Finally, the sixth sound channel (LFE) in a 5.1 setup is for low frequency effects. The primary purpose of the LFE channel is to provide low frequency sound, typically any frequencies below 120Hz, to one or more subwoofers. This channel can provide a physical chest-thumping experience to accompany large on-screen explosions, etc.

7.1 Surround Sound

7.1 surround sound audio streams extend 5.1 with the addition of two extra sound channels (CL and CR) which are placed either side of the listener, providing a total of eight individual sound channels. These two extra channels are typically used in conjunction with the front channels (LCR) to provide a much wider angle of sound.

Speaker Locations

The ideal positioning of surround sound speakers, relative to the listener, have been standardized by the International Telecommunication Union. The following image shows the ideal, standardized speaker positions.

Standardized 51 Speaker Positions

The angle between the left (L) and right (R) speakers is 60 degrees, with the center (C) speaker placed directly in front of the listener. The left-surround (LS) and right-surround (RS) speakers are positioned approximately 110 degrees from the center (C) speaker. The position of the low frequency effects speaker (LFE), i.e. the subwoofer, isn't too important due to the low frequency limitation, but it is usually placed close to the listener, sometimes directly beneath the listener.

Audio Production

The production of surround sound audio streams is beyond the scope of this article, but a lot of modern sound editing software packages, including Audacity and Adobe Audition, allow you to create surround sound audio files and export them as WAV or AIFF files. The exported files can then be pushed through an encoder, or a service such as Microsoft Azure Media Encoder (see below), to produce high-fidelity Dolby Digital Plus audio and/or video files that are ready to be streamed over the internet.

Encoding With Microsoft Azure Media Encoder

Microsoft Azure Media Services provides an elegant, task-based solution for encoding Dolby Digital Plus audio and video online, and Microsoft has been awesome enough to provide everyone with a free trial of Azure. Beyond the free trial, the cost of encoding (as of writing) starts at $1.99 per GB, which is great value for money; you will no longer need to use expensive desktop software to get your fantastic Dolby Digital Plus surround sound out to the masses.

The following code describes the procedure required to programmatically encode a video file using the Azure services and the Dolby Digital Plus encoder, but it assumes you have some prior experience using the Azure services and the Media Services SDK for NET.

The configuration file, ddp720.xml, that is loaded into the program is as follows.

That configuration file produces a H.264 720p video with Dolby Digital Plus 5.1 surround sound. The EncoderMode attribute, "DolbyDigitalPlus", tells the encoder to use Dolby Digital Plus, and the AudioCodingMode, "Mode32", tells the encoder to use 5.1 surround sound. Also, the LFEOn attribute must be set to "True" to enable the low frequency effects (LFE) sound channel.

Additional information is provided in the Resources section at the end of this article.

Encoding With Adobe Premiere Pro

The latest versions of Adobe Premiere Pro provide support for Dolby Digital Plus, allowing you to mix 5.1 and 7.1 surround sound directly into your videos.

Additional information is provided in the Resources section at the end of this article.

Closing Thoughts

As an avid consumer of online audio and video, I'm excited by Dolby Digital Plus. We have now reached a point where true Dolby surround sound can be streamed over the internet, thanks to the impressive work by Dolby and the support of Microsoft.

Lux Ahoy game

Online games, oh yes, they can also benefit from Dolby surround sound, as demonstrated by the highly entertaining Lux Ahoy game, but remember, you will need to be running Windows 10 and Microsoft Edge for now!

Finally

There may be some controversy surrounding another proprietary web technology, but in all honesty, if proprietary technology allows companies like Dolby and Microsoft to provide us with codecs such as Dolby Digital Plus, you will not be hearing any complaints from me.

Resources

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.