Qu

steer_delays

Builtin index · Signal processing

result = steer_delays(positions, angle_degrees, [c=343])

Input: positions, angle_degrees, c · Output: result

What it is

The geometry half of beamform on its own: the per-element steering delays tau_m = x_m*sin(theta)/c, in seconds, for element coordinates positions and a direction angle_degrees degrees off broadside (c as in beamform: m/s, default 343, also spellable c=).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = steer_delays(positions, angle_degrees, [c=343])
positions —not documented yet
angle_degrees —not documented yet
c optional (default 343)not documented yet
result vector
Returns a plain vector, so it composes directly with interpolate_at(sig_m, sig_m.t + delays[m], method) when you want per-channel treatment beamform cannot express — element weighting/shading, a different method per channel, or a subset of the array. Added in v0.3.0.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

fs = 48000
d  = 0.08
th = 30
c  = 343
mics = [-2, -1, 0, 1, 2] * d            # positions, metres, origin-centred

taus = steer_delays(mics, th, c)        # per-element delay, seconds

t = linspace(0, 4799, 4800) / fs        # 0.1 s of record

function channel(m)
    tone = sin(2 * pi * 1000 * (t - taus[m]))
    return signal(tone + 0.8 * randn(1, 4800, seed=m), fs)
end function
chans = [channel(0), channel(1), channel(2), channel(3), channel(4)]
beam = beamform(chans, mics, th)        # c=343, method="nearest" by default

print("beamformed {beam.len} samples at {fs} Hz")
output
beamformed 4800 samples at 48000 Hz

from signal-processing

How it works

steer_delays(positions, angle_degrees, [c=343]) (§ signal builtins, v0.3.0) — the geometry half of delay-and-sum, on its own: the per-element delays x_m * sin(theta) / c that steer an array towards theta. Returned as a plain Vec (seconds) so it composes directly with the EXISTING interpolate_at(sig, t + delay, method) — that hand-rolled spelling is what beamform below was factored out of, and it stays a first-class way to do it when the caller wants a non-uniform per-channel treatment (different methods, per-channel weights/shading, a subset of elements) that a single beamform call cannot express.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.