As I commented last time, I am going to use Ambisonics for sound spatialization. I presented in the last post the basic concepts of Ambisonics. Today I will go a little deeper into encoding.

We can develop the wave equation as a series of spherical harmonics. Since the series is infinitely long, we must truncate it at some point for a practical application. The number of terms used will give us the ambisonics *order.* For instance, for practical considerations I will use order 3. In following plot we can observe how the harmonics look like, represented in the horizontal plane.

We can do a physical comparision between microphone radiation patterns and spherical harmonics. First row plot is an omnidirectional microphone (receives signal equally from all angles). In second row we have the first order expansion (FOA) – they are figures-of-eight directional microphones, pointing in each one of the three physical dimensions. Above first order, the metaphor with physical elements gets more vague.

There are different coefficients to apply to the radiation patterns. As said in the figure, we are using Normalized 3D coefficients (N3D), which develops directly from the orthonormal basis, but other have been developed and used. See Daniel01, table 3.1 for the different coefficients, and in general chapter 3.1.2 for the encoding.

Using the spherical harmonics, the simplest thing we can do is to encode a punctual sound source. The equations are pretty much similar to the ones from the spherical harmonics, so basically what it will happen is that the harmonics will change dinamically their shapes between their original one and their opposite.

If we forget for now the amplitude/distance issue, this will be the gain information that we will encode in each one of the channels. From up to down and left to right, we have W (zero-th order), Y, Z and X (FOA), V, T, R, S, U (2nd order) and Q, O, M, K, L, N, P (3rd order) channels.

We can follow simulating how will be the reconstruction of the source, after our encoding. Following videos show the general shape for all channels in a given order (*i.e.* without adding the previous channels).

We can mainly observe three things: first, the total radiation pattern is pointing the sound source with equal gain for all angles. Second, the gain peak increases as the order increases, corresponding in the SN3D normalization with *2m+1 *(which is also the number of spherical harmonics for this order). Third, when the order increases, the directivity of the main lobe increases, which means that the encoding is more precise regarding the position of the punctual sound source.

These plots were taking into account only the components for a given order. If we represent the total amount of components up to a given order, as the ambisonics theory develops, we can appreciate better the directivity increase. In this animation, all gain peaks are normalized to 1, in order to focus on the directivity.

Another static representation of the directivity across orders:

All plots and animations are created with python matplotlib. As usual, code is available at https://github.com/andresperezlopez/rt-spatialization/