Qu

multisine

Builtin index · Signal processing

result = multisine(freqs, amps, fs, n, [phases=])

Input: freqs, amps, fs, n, phases · Output: result

What it is

freqs, amps: length-K vectors (Hz, amplitude per tone); fs: number (Hz); n: number (integer sample count); phases (optional length-K vector, radians).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = multisine(freqs, amps, fs, n, [phases=])
freqs vectorfreqs, amps: length-K vectors (Hz, amplitude per tone).
amps vectorfreqs, amps: length-K vectors (Hz, amplitude per tone).
fs numberfs: number (Hz).
n numbern: number (integer sample count).
phases vector, optionalphases (optional length-K vector, radians).
result Signal
Returns a length-n Signal. Sum of cosines at the given frequencies/amplitudes. Defaults to Schroeder's phase formula (phi_k = -k(k-1)*pi/K) when phases isn't given — keeps crest factor low without iterative optimization.

Examples

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

x = multisine([2, 5, 11, 17] * (64 / 64), [1, 1, 1, 1], 64, 64)

from numerics-dsp

signum_chirp = chirp(20, 20000, 48 kHz, 4800) |> sign

# DIBS (Discrete-Interval Binary Sequence): a multisine tuned to

# concentrate power at chosen frequencies, then binarized

excitation = multisine([50, 150, 400], [1, 1, 1], 1000, 4000)
dibs_signum = excitation |> sign            # simple thresholding

dibs_sigma_delta = excitation |> sigma_delta  # higher fidelity, more switching

from numerics-dsp

How it works

multisine(freqs, amps, fs, n, [phases=]) — sum of cosines at the given frequencies/amplitudes, wiring up qu_core::signal's existing MultisinePlan/synthesize_cpu (the same kernel qu-gpu's batched synthesis parity-tests against, per BOARD.md — previously real but never callable from a Qu script). Defaults to Schroeder's phase formula (phi_k = -k(k-1)*pi/K, 1-indexed tone number k of K total) when phases isn't given — a well-known deterministic choice that keeps crest factor low without the iterative optimization this session's private L-BFGS work targets.

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