Welcome

With the help of this blog I will document the work on my Google Summer of Code 2015 project “Creating cross-platform room correction for Kodi”.

Abstract: Kodi, formerly known as XBMC is an award winning state of the art opensource media player. Its Audio Engine (ActiveAE) includes a variety of features in the context of audio post-processing, decoding and channel mapping. In order to push the audio experience to a new level, the listener’s ambience needs to be taken into account. This GSoC project wants to optimize the audio itself during playback to perfectly fit into the environment of the listener.

1. Introduction / Motivation

Today’s typical home theater systems are created out of a lot of different components. There is an LCD TV or a beamer to display the content which is streamed from a blu-ray player or over the internet. Also Live TV via DVB-S/-C/-T is very popular around the world and widely used. In order to play games a state of the art gaming console is also integrated into this theater system. Finally for enjoying a brilliant audio experience an Audio Video Receiver (AVR) with a connected surround speaker system completes this complex setup.

The configuration of all those devices bears several issues as every device has a different configuration interface. Integration, e.g. customization into the existing setup is only possible to a certain amount. After 2 years warranty there is even no vendor support anymore.

A modern approach for integration and even for reducing the number of different devices in the living room is a minimal software/hardware combination that can fulfil all the before mentioned use cases. One of the most famous open source software that can replace almost all functionalities except the TV itself is Kodi, formerly known as Xbox Media Center (XBMC). Kodi supports live TV through its Personal Video Recorder (PVR) addons, one can play games through retro player and Kodi’s implemented players (dvdplayer and paplayer) are based on ffmpeg which allows playing a full range of media files.

Kodi is actively developed by a large community around the world and especially the Audio Engine (ActiveAE) was completely rewritten from scratch with performance, throughput and accurate delay measurement in mind. This modern implementation based on an active object pattern, which decouples method execution from method invocation has defined several interfaces like resampling or sink management in order to realize state of the art audio manipulation code, that you would normally only be able to enjoy by investing a large amount of money into commercial audio products.

Currently there is ongoing work to integrate Digital Signal Processing (DSP) features into ActiveAE, which will enhance Kodi’s audio processing further and therefore will reduce the gap to commercial high-end products even more. The DSP feature configuration dialog (see Figure 1) is a flexible approach that enables the user to define several processing steps in an easy wizard driven way. This will allow user-defined audio processing, which would only be possible with state-of-the-art and therefore expensive commercial hifi products.

Figure 1 Kodi’s Audio DSP Manager DialogFigure 1 Kodi’s Audio DSP Manager Dialog

But this is only the beginning. To go a step further in order to mimic all digital signal processing features of a full-featured AVR by Kodi’s Audio DSP System an additional extension point for audio-input-measurements needs to be defined to make room calibration and room correction possible.

One focus of this proposal is to integrate external input sources into ActiveAE. With this new extension point it will be possible to connect a microphone to a Kodi capable device. This allows you to digitally optimize your listening experience while sitting on your favorite listening position e.g. your couch or your armchair, by compensating the influence of the interior room factors. This feature is widely known as digital room correction or digital room equalization.

For digital room correction, three other implementation components are required. One is the implementation of a convolution engine to combine and compute the audio signal with a calculated room correction filter. At the time of writing a first prototype addon adsp.xconvolver exists, this addon was written by me in order to evaluate the technical feasibility of this project. The addon is based on the highly optimized cross platform library LibXConvolver. The second and third component is the measurement signal and filter generation, which I want to implement in adsp.xconvoler during my GSoC coding time.

Those four components are shortly presented in this proposal submission in the context of well-known room calibration systems.

 

2. Review of two available room correction systems

There is a big market for modern room correction systems and almost every new device has this function. To see what are advantages and disadvantages, two well-known and common approaches were compared. This allows to pick only the advantages and integrate them during this GSoC coding time.

 

2.1 Audyssey

Commercial AVRs often use Audyssey, which is used by the companies Denon-, Marantz- and Onkyo. The vendors ship with an included microphone; see Figure 2. Other AVRs support Audyssey MultiEQ, that needs a professional calibration kit, which is displayed in Figure 4. The costs of such a device though are around 800 €, which is far more expensive than many AVRs.

Both microphones can calibrate listening rooms through an interface that comes with the AVR; see Figure 3 for an example using a Denon AVR.

Figure 2 Audyssey microphone [1]

Figure 3 Denon Audyssey speaker calibration dialog [2]

Figure 4 Audyssey MultiEQ Pro Calibration Kit [3]

Pros and Cons of Audyssey:

+ Well known system
+ Often tested
+ Easy to use
– Expensive
– Proprietary closed source algorithms
– You have to trust the measurements, because of less analyzation functions
– Less customizations functions

Another approach is to use a separate computer software and an external device to store the generated correction filter, this is presented in the next chapter.

 

2.2 Room EQ Wizard

Room EQ Wizard, as shown in Figure 5 and Figure 6, is a free java software tool, which runs on Windows, Mac OSX and Linux. It is a well-known software and often used for digital room correction or room analyzation.


Figure 5 Room Wizard EQ Main Window [4]


Figure 6 Room Wizard EQ Waterfall Plot [4]

Pros and Cons of Room EQ Wizard:

+ Free software
+ Many analyzation tools
– Very complex GUI
– Not Open Source, so it’s impossible to integrate into Kodi
– Can only generate correction filters and an external device (e.g. mini DSP [5]) or
external convolution engine (e.g. BruteFIR [6]) is strictly required to use the
correction filters

 

3. Implementation

As previously shown, both systems have their advantages and disadvantages. I want to emphasize on the advantages and combine the measurement and analyzation functionality into a multi media software like Kodi, which will result in increased flexibility while still being easy to use.

 

3.1 Digital room correction with the help of a chirp signal

For the filter generation a measurement of the Impulse Response (IR) between the speakers and your favorite listening position is needed (see Figure 7).


Figure 7 Listening position IR measurement [7]

To retrieve the IR I will use a sine sweep or a so called chirp signal. Other signals that can be used are white noise or Maximum Length Sequence (MLS [8]), but are not discussed here.

A chirp signal has the big advantages that they are easy to generate and very energy rich through their constant envelope. The right figure shows a linear chirp signal over time, which changes his frequency over the time and is described by the left formula [10].


Figure 8 Chirp signal plot [10]

To measure an IR from a listening position one established approach is to use the linear system theory. For a linear system it is well known that the following Fourier Transform pair [9, p. 256] exists, which says convolution in time domain is multiplication in frequency domain.

   

Where x(t) is the chirp signal, y(t) the measured signal and g(t) the impulse response between the speaker and the listening position. The capital letters can be directly mapped to their Fourier transforms. The IR can be calculated easily by the following equation:

For digital room correction the inverse measured IR 1/GMeas(f) is needed and later convolved with the audio signal M(f). Which leads directly to X(f)=M(f)/GMeas(f) and is sent through the speakers. The received audio signal Y(f) on the listening position can be described as follows:

with  

The mathematical derivation clearly shows, that we have the possibility to compensate modifications the ambience of the listener is introducing.

 

3.2 Software Architecture

To integrate a digital room correction system into Kodi I showed that four subsystems are needed.

At first we need a new extension point in ActiveAE, which allows capturing and storing external input signals from microphones. To keep the naming convention from ActiveAE, it will be called AESource. Because ActiveAE is cross platform and works on many platforms a between layer is needed to create an AESource for Windows, MacOSX, Linux, Android, iOS and Raspberry Pi, which is called AESourceFactory. The following figure shows the new extension point. Other parts such as AESink, AESinkFactory, AEBufferPool and its utils are not shown to preserve the overview of the AESource implementation.


Figure 8 AESource Implementation

The next subsystem is the convolution engine, which is used to convolve audio signals with the correction filter. For this task I want to use the before mentioned adsp.xconvolver addon. The convolution algorithm is already implemented, but the user interface and a corresponding filter manager is missing.

For room correction, a chirp signal generator and a filter generation module is needed, which will be implemented in adsp.xconvolver during this GSoC proposal. The next figure shows a schematic how those submodules will work together.


Figure 9 Interaction between each sub system

4. Summary

At first Kodi and his new Audio DSP System were introduced. After that a small review about well-known room calibration systems with their own advantages and disadvantages were presented. Afterwards an algorithm, which allows retrieving the room impulse responses with chirp signals and Fourier transform from listening rooms was motivated. After that the software architecture for the extension point of external input sources was presented, which I will implement during my GSoC coding time.

 

5. Conclusion

The presented algorithm for room impulse measurement, AESource and adsp.xconvolver will allow end-users to enjoy a new listening experience with Kodi. The implementation is open source, implemented based on clear interface and architecture patterns. This will allow developers around the world to improve, extend and contribute to this project.

End-users with older hardware will also highly benefit from this proposal, because the implementation will be cross platform and allows e.g. standalone HTPC’s and old AVRs without a microphone input to improve their audio listening room experience.

The whole room calibration system will be easy to use and smoothly integrated into Kodi’s user interface. It will be pushing free audio experience onto the next level.

 

6. Bibliography

[1] Audyssey microphone image

[2] Denon Audyssey speaker calibration dialog image

[3] Audyssey MultiEQ Pro Calibration Kit image

[4] Room EQ Wizard homepage

[5] minidsp homepage

[6] BruteFIR homepage

[7] Listening position IR measurement image

[8] Wikipedia, Maximum Length Sequence

[9] Will Pirkple, Designing Audio Effect Plug-Ins in C++: With Digital Audio Signal
Processing Theory

[10] Wikipedia, Chirp Signal

Leave a Comment

Your email address will not be published. Required fields are marked *