ACNN3D formulas for High Order Ambisonics

The goal of this page is to provide an univoque, explicit set of formulas describing the amplitude of the Ambisonics polar patterns as function of the azimuth and elevation angles, and also as a function of the three cartesian coordinates of the unit vector pointing towards the sound source.
Unfortunately in the years many different Ambisonics formulations have been employed, differing in naming, channel order, and gain normalization.
Furthermore, the Cartesian and Spherical coordinate systems have also been messed up, again with wrong naming, polarity inversion, and so on.
So this page also serves for providing the correct information about all these possible causes of errors.
The Cartesian reference must be conforming to ISO standards (for example, ISO2631), as in the following picture:
The spherical coordinate system is coherent with this Cartesian reference system: the azimuth angle (a) lies in the XY plane, starting form the X axis and running towards the Y axis, so an azimut of 0 degrees means "Front", 90 degrees means "Left", 180 degrees means "Back" and 90 degrees (which also equates to 270 degrees) means "Right". Elevation angle (e) is measured from the horizontal plane, with positive elevations going up to the sky, so e = 90 degrees means Zenith (or North pole) and e=90 degrees means Nadir (or South pole).
In the formulas nelow, we use θ (theta) and j (phi) for naming azimuth and elevation respectively. Be aware that in other cases these synbols are swapped (there is no univoque correspondance establishing if theta is azimuth or elevation), and in some cases the value of elevation is not starting from the horizontal plane, but instead from the North pole and going down, as shown, for example, on the Wikipedia page https://en.wikipedia.org/wiki/Spherical_coordinate_system, where the two possible naming conventions are shown, but elevation is always wrong.
Also the sign of azimuth is sometimes reversed: for example, in FB360 Spatial Workstation the elevation angle is correct, but the azimut is reversed, with positive values going right instead of going left, as it should be. The same problem occurs in Audio Ease and Ambix plugin suites.
Luckily enough, most other software used for creating and manipulating High Order Ambisonics signals are usually perfectly coherent with the ISO 2631 standard adopted here, for example O3A, Noise Makers, Wigware, Ambdec, York University, Ambisonic Studio, Gerzonic, etc.
I hope that the information above serves for avoiding errors... And perhaps the authors of software employing wrong conventions cited above will decide to fix their crappy angular systems...
And now let's define the spherical harmonics functions, which provide the directiondependent gain of each of the Ambisonics signals.
These functions are defined in a series, with 2 more functions for each order, providing an increasing spatial resolution. The following figure shows these directiondependent gain functions up to 7th order
The meaning of the colors is as following:
RED means positive
BLUE means negative
And finally here we present the explicit formulas giving these gain functions, either in polar and Cartesian coordinates, worked out from the formulas given here, and corresponding to the obsolete MPEGH requirements (that is, channel ordering is ACN and gain normalization is N3D  Gain factors for converting to standard AMBIX are provided later down):
ACN 
Order 
Name 
Image 
Formulas 
0 
0 
W 


1 
1 
Y 


2 
1 
Z 


3 
1 
X 


4 
2 
V 


5 
2 
T 


6 
2 
R 


7 
2 
S 


8 
2 
U 


9 
3 
Q 


10 
3 
O 


11 
3 
M 


12 
3 
K 


13 
3 
L 


14 
3 
N 


15 
3 
P 


16 
4 


17 
4 


18 
4 


19 
4 


20 
4 


21 
4 


22 
4 


23 
4 


24 
4 


25 
5 


26 
5 


27 
5 


28 
5 


29 
5 


30 
5 


31 
5 


32 
5 


33 
5 


34 
5 


35 
5 


36 
6 


37 
6 


38 
6 


39 
6 


40 
6 


41 
6 


42 
6 


43 
6 


44 
6 


45 
6 


46 
6 


47 
6 


48 
6 


49 
7 


50 
7 


51 
7 


52 
7 


53 
7 


54 
7 


55 
7 


56 
7 


57 
7 


58 
7 


59 
7 


60 
7 


61 
7 


62 
7 


63 
7 

Although these are the formulas prescribed
for the MPEGH strandard, the current practice is to use instead a different
gain normalization (SN3D instead of N3D used here).
For converting from the N3D formulas shown here to the standard Ambix formulas,
with SN3D normalization, you should multiply the above formulas for the
following scaling factors:
order 0: 1
order 1: 1/SQRT(3)
order 2: 1/SQRT(5)
order 3: 1/SQRT(7)
order 4: 1/SQRT(9)
order 5: 1/SQRT(11)
order 6: 1/SQRT(13)
order 7: 1/SQRT(15)
If you want to get these formulas already converted to Ambix, and in a textformat suitable for being copied and pasted in Matlab or other programming languages, please visit the following page:
Explicit Formulas for High order Ambisonics (Ambix  ACN SN3D format up to 7th order)
If you find errors in these formulas, please point them out to the author of this page...
Angelo Farina, September 2022