Array tracker

A causal neural network that gives the directions of up to three simultaneous sound sources, every 8 ms, from the signals of a microphone array of any shape. You give it the audio and the coordinates of the microphones; it has 1.2 million parameters and runs on a CPU.

Quick start

pip install torch numpy scipy soundfile safetensors huggingface_hub
hf download GokseninYuksel/array-tracker --local-dir array-tracker
python array-tracker/localise.py recording.wav mics.json --out directions.csv

recording.wav has one channel per microphone. mics.json holds the microphone positions in metres, one row per channel in the order of the file:

[[0.032, 0.0, 0.0], [0.0, 0.032, 0.0], [-0.032, 0.0, 0.0], [0.0, -0.032, 0.0]]

From Python, for a whole data set recorded with one array:

import sys; sys.path.insert(0, "array-tracker")
import localise

net = localise.load("array-tracker")                      # add device="cuda" for a GPU
positions = localise.read_positions("mics.json")          # [microphones, 3] in metres
audio = localise.read_audio("recording.wav", net.cfg.fs)  # [microphones, samples] at 16 kHz
vector, time = localise.localise(net, audio, positions)   # vector [frames, 4, 3], time [frames] in seconds
declared, direction, azimuth, elevation = localise.decode(vector)

What you give it

  • Audio at 16 kHz, one channel per microphone (localise.py resamples other rates). Keep the scale the recording has: the model reads the level. It was trained with speech between about 0.00016 and 0.16 RMS at the array, where 1.0 is full scale.
  • Microphone positions in metres, in any coordinate frame and with any origin. The directions come back in the same frame. Wrong positions give wrong directions: the order of the rows must be the order of the channels.

What you get

For every 8 ms frame the model gives four vectors (vector[t, k]).

  • The length of a vector says whether a source is there: near 1 when the model is sure, near 0 when it is not. A source is declared when the length is above 0.5, the value used in training.
  • The direction of a vector is the unit vector from the centre of the array towards the source, in the axes of your microphone coordinates. azimuth = atan2(y, x), counter-clockwise from the x axis; elevation is the angle above the x-y plane.
  • Frame t covers samples 128 t to 128 t + 511 at 16 kHz. Its time in the output is the centre of that window. The model is causal: a frame's output uses no audio after the end of its window.
  • The four outputs are not identities. A talker can move from one output to another between frames; link them over time yourself if you need tracks.

If you know how many sources there are

Take the longest vectors of each frame instead of those above 0.5 (--sources N). In hard scenes the model often points the right way with a vector shorter than 0.5, so this finds more sources than its own detection does. The accuracy table below is measured this way.

Streaming

model.py also runs one frame at a time with a state of fixed size, and gives the same outputs as on the whole recording:

state = net.init_state(positions[None])                  # positions [microphones, 3], centred on their mean
out, state = net.step(newest_512_samples[None], state)   # [1, microphones, 512] -> out["vector"] [1, 1, 4, 3]

Call step every 128 samples with the newest 512.

Training data

Simulated rooms only (image-source method): rooms from 3 x 3 x 2.5 m to 10 x 8 x 6 m, reverberation times of 0.2 to 1.3 s, zero to three talkers per 4 s clip, static and moving, 0.3 to 2.5 m from the array. Speech is from LibriSpeech (train-clean-100), noise from MS-SNSD, at signal-to-noise ratios of -5 to 30 dB. The arrays are random points in three dimensions, 4 to 12 microphones, 7 to 13 cm across. Each clip was played at its own level, over a range of 60 dB.

Measured accuracy

Mean angular error and the share of frames within 10 degrees, over the frames in which a source is active, with the number of active sources given (the protocol of AGG-RL, Baek et al., 2026). The model was trained on simulated rooms only; the real recordings below served to compare training runs, not to train.

Recordings Microphones Mean error Within 10 degrees
LOCATA, robot head, one static talker 12 3.7 100%
LOCATA, robot head, two static talkers 12 3.7 98%
LOCATA, robot head, one moving talker (task 3) 12 4.2 97%
LOCATA, robot head, two moving talkers (task 4) 12 15.6 58%
LOCATA, Eigenmike, one static talker 32 7.9 97%
LOCATA, Eigenmike, two static talkers 32 8.1 93%
LOCATA, Eigenmike, one moving talker (task 3) 32 8.0 84%
LOCATA, Eigenmike, two moving talkers (task 4) 32 9.4 76%
RSL2019 test, one static loudspeaker 4 17.5 73%
STARSS23 test, speech, up to three talkers 4 22.8 52%
Simulated, 4 to 12 microphones, one to three sources 4 to 12 9.7 79%
Simulated, 13 to 16 microphones, one to three sources 13 to 16 8.6 83%

Known limits

  • Its own detection misses sources. With the threshold of 0.5 it declared 80% to 100% of the active sources with one talker on LOCATA, 42% to 56% with two moving talkers, and 57% on RSL2019. Of the directions it declared, 77% to 91% were within 10 degrees of a source. It also declares a direction in some frames in which no one speaks (0.04 to 0.22 per such frame on these recordings).
  • Microphones on a straight line do not work (errors of about 50 degrees in simulation).
  • Flat arrays give the azimuth, not the elevation. With all microphones in one plane (circles, grids) the azimuth error was 3 to 6 degrees in simulation, the error in three dimensions 18 to 23 degrees.
  • Wide arrays. It was trained on arrays up to 13 cm across. In simulation with one static source the error was 5 to 7 degrees up to 20 cm, 8 at 30 cm, 11 at 45 cm and 14 at 60 cm.
  • More microphones than in training are fine: 4 to 6 degrees from 4 to 64 microphones in simulation.
  • Speech. Every source in training was speech and every other sound was interference. What the model does with other kinds of sources has not been measured.
  • No source identities, at most three sources, 16 kHz.

Files

File What it is
model.safetensors, config.json The trained weights and the model's configuration
model.py The model (PyTorch); whole recordings, long recordings in pieces, and frame-by-frame streaming
localise.py Runs the model on a recording and writes the directions; also the functions used above
Downloads last month
15
Safetensors
Model size
1.23M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support