music.bandlimited_note¶
- music.bandlimited_note(freq=220.0, duration=2.0, waveform='sine', number_of_samples=None, sample_rate=None, 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 given.
- 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
intorNone Overrides duration when given, matching music.note; zero is no samples.
- sample_rate
intorNone Samples per second. None, the default, is the rate
music.get_sample_rate()returns.- table_size
int Resolution of the periodic prefiltered table: a whole number, 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,)