music.bandlimited_note

music.bandlimited_note(freq=220.0, duration=2.0, waveform='sine', number_of_samples=0, sample_rate=44100, table_size=16384, rolloff_hz=0.0)[source]

Render a static-pitch periodic note with prefiltered harmonics.

Parameters:
freqfloat

Positive fundamental in Hz, strictly below Nyquist.

durationfloat

Seconds, ignored when number_of_samples is nonzero.

waveform{‘sine’, ‘sawtooth’, ‘square’, ‘triangle’}

A primary waveform. Arbitrary arrays are not accepted because their spectrum and source-pitch semantics are unknown.

number_of_samplesint

Overrides duration when positive, matching music.note.

sample_rateint

Samples per second.

table_sizeint

Resolution of the periodic prefiltered table (at least 4).

rolloff_hzfloat

Optional nonnegative linear transition width below Nyquist. The default zero keeps all allowed harmonics. A smooth rolloff avoids sudden harmonic changes between adjacent static pitches.

Returns:
ndarray

One-dimensional float64 samples. The method preserves the periodic waveform’s fundamental, not its original peak level; truncated discontinuous waves may exhibit Gibbs overshoot.

Raises:
ValueError

For invalid sampling parameters, frequency, duration, table size, or waveform name.

Parameters:
Return type:

NDArray[float64]

Notes

This is opt-in: music.note remains sample-identical to MASS. Band-limiting is frequency-dependent. Do not reuse one filtered table for glissandi or FM. Hard-gated isochronic envelopes, clipping, nonlinear effects and subsequent resampling can still introduce aliasing. Inspect downstream output separately.

Examples

>>> x = bandlimited_note(10000, duration=0.01, waveform="sawtooth")
>>> x.shape
(441,)