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:
- freq
float Positive fundamental in Hz, strictly below Nyquist.
- duration
float 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_samples
int Overrides duration when positive, matching music.note.
- sample_rate
int Samples per second.
- table_size
int Resolution of the periodic prefiltered table (at least 4).
- rolloff_hz
float 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.
- freq
- Returns:
ndarrayOne-dimensional float64 samples. The method preserves the periodic waveform’s fundamental, not its original peak level; truncated discontinuous waves may exhibit Gibbs overshoot.
- Raises:
ValueErrorFor 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,)