music.gaussian_noise¶
- music.gaussian_noise(mean=1, std=0.5, duration=2, sample_rate=44100)[source]¶
Synth gaussian noise
- Parameters:
- mean
int,optional The centre of the band the noise occupies, in units of 3000 Hz, by default 1 – so 3000 Hz.
- std
float,optional The width of that band, in the same units, by default 0.5 – so 1500 Hz wide, running from 2250 to 3750 Hz.
These name a band rather than a distribution, despite the routine’s name and theirs. What is Gaussian here is the shape of the samples that come out, which is what a sum of many random-phase partials tends to; the samples’ own mean and standard deviation are set by the normalization at the end and have nothing to do with these two. A band reaching below 0 Hz is read as the positive part of itself.
- duration
int,optional How long in seconds will the noise be, by default 2
- sample_rate
int,optional The sample rate to use, by default 44100
- mean
- Returns:
arrayAn array for the gaussian noise
- Raises:
ValueErrorIf
meanandstdname a band that holds no frequency at the resolution the length gives. A band of no width zeroed every coefficient, and normalizing an all-zero spectrum divides by its own zero range: the caller got an array of NaN behind a warning. A duration too short to hold a sample is not refused – it renders nothing, as everything here does.
- Parameters:
- Return type:
NDArray[float64]
Examples
>>> grains = gaussian_noise(mean=1, std=0.5, duration=0.5) >>> len(grains) 22050 >>> gaussian_noise(duration=0.3).shape # a fractional duration (13230,)