I have 4ch Spatial Audio (Ambisonic) WAV file and I want to calculate sound source position and put it on 2D plane.

What I know so far is the following:

WAV file consists of signals that support of 360 video playback

  • Channel 1 = omnidirectional sphere (named W: $w(t) = p(t)$)
  • Channel 2 = left-right dipole (named Y: $y(t) = \sqrt{2}p(t)\sin(a)\cos(b)$)
  • Channel 3 - has no data
  • Channel 4 = front-back dipole (named X: $x(t) = \sqrt{2}p(t)\cos(a)\cos(b)$)

How to calculate sound source position at any point of time using these data?


calculation like this gives mess:

theta = Math.Atan2(y, x);
px = r * Math.Cos(theta);
py = r * Math.Sin(theta);

Edit 2:

So imagine we have Spatial Audio/Ambisonic/B-Format WAV file and we need to draw/visualize a microphone in the center of screen and a sound source around the microphone at any time reading WAV file

Edit 3:

We use H2n SPATIAL AUDIO mode that gives 1 WAV file with 4 Channel Using the suggested wiki-formula here is our result for first 1000 ticks using MatLab (does not look proper):

enter image description here

  • $\begingroup$ what are you computing ? i know "sound source position", but which parameter is it ? $\endgroup$ Feb 14, 2019 at 12:30
  • $\begingroup$ we need to find any parameter for source position, for example angle 0-360 degrees around microphone or X and Y relative to center of circle/sphere $\endgroup$
    – okarpov
    Feb 14, 2019 at 13:02
  • $\begingroup$ so we need to draw a microphone and sound source around it at any time reading Ambisonic WAV file $\endgroup$
    – okarpov
    Feb 14, 2019 at 13:11

2 Answers 2


I know nothing about Ambisonic decoding, but the Wikipedia page suggests: $$ p(\theta_n) = w(t) + x(t) \cos(\theta_n) + y(t) \sin(\theta_n) $$ Perhaps you could form that and vary $\theta_n$ to find the direction of highest power?

Note: I realize that's not what the page is really saying. It's saying that this is the signal to feed to a speaker at $\theta_n$... but that seems similar to finding the directionality of the source. Also note that it does not find the distance of the source, just the $x-y$ plane angle.

  • $\begingroup$ we need to get angle or x and y 2d coordinates from the WAV file. not sure what does this formula/wikipage explain really $\endgroup$
    – okarpov
    Feb 14, 2019 at 14:21
  • 1
    $\begingroup$ @okarpov : It will get you the angle: find the angle at which the $p(\theta_n)$ is largest. $\endgroup$
    – Peter K.
    Feb 14, 2019 at 17:29
  • $\begingroup$ we have tested your suggestion and formula - bet seems not really promising @peter-k $\endgroup$
    – okarpov
    Feb 15, 2019 at 10:33
  • $\begingroup$ @okarpov OK! Thanks for posting the image of the result. I'm wondering if the sound field recording has a single source, or multiple sources? $\endgroup$
    – Peter K.
    Feb 15, 2019 at 15:12
  • $\begingroup$ this is a record of meeting with a few people talking around H2n Zoom microphone on a table $\endgroup$
    – okarpov
    Feb 15, 2019 at 17:13

That's tricky, especially if it's an in-room recording and not anechoic. In a room, the energy at the microphone is typically dominated by the reflections and not by the first arrival.

Here is what I would try

  1. Look through the omni channel and see if you can find identifiable events: best are broad band transients after some quieter passages. Claps, plosives, pops, hits, something like this
  2. Cross correlate the dipoles with the omni channel. Determine amount and phase of correlation.
  3. Do inverse geometry using the correlation values. E.g. if it's negatively correlated with the left-right dipole but uncorrelated with the front back dipole it's coming from the right
  4. Total amount of correlation gives you an estimate for elevation and the ratio of the correlations can determine the azimuth. It'll be noisy though.

You can only resolve one hemisphere, you can't distinguish between up and down. That's obvious from your original equations: if you flip the sign of $b$, nothing changes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.