Waveform Generator¶
- pico_synth_sandbox.waveform.get_amplitude() int [source]¶
Retrieve the maximum level peak-to-peak (+/-) of waveform sample values as defined by WAVE_AMPLITUDE in the settings.toml file.
- Returns:
waveform amplitude level
- Return type:
int
- pico_synth_sandbox.waveform.get_noise() ulab.numpy.ndarray [source]¶
Generate a white (random) noise
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_offset_sine() ulab.numpy.ndarray [source]¶
Generate a sine waveform offset by a quarter period (PI/2).
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_offset_sine_noise() ulab.numpy.ndarray [source]¶
Generate a sine waveform offset by a quarter period (PI/2) with white noise added. Useful for percussion synthesis.
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_samples() int [source]¶
Retrieve the number of samples in a waveform as defined by WAVE_SAMPLES in the settings.toml file.
- Returns:
waveform buffer size
- Return type:
int
- pico_synth_sandbox.waveform.get_saw() ulab.numpy.ndarray [source]¶
Generate a decrementing sawtooth
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_sine() ulab.numpy.ndarray [source]¶
Generate a sine
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_sine_noise() ulab.numpy.ndarray [source]¶
Generate a sine waveform with white noise added. Useful for percussion synthesis.
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_square() ulab.numpy.ndarray [source]¶
Generate a square
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.get_triangle() ulab.numpy.ndarray [source]¶
Generate a triangle
- Returns:
waveform
- Return type:
ulab.numpy.ndarray
of type ulab.numpy.int16
- pico_synth_sandbox.waveform.load_from_file(filepath: str, max_samples: int = 4096) tuple[ulab.numpy.ndarray, int] [source]¶
Read an audio wave file (.wav) from the virtual file system up to a specified maximum sample length. Wave file must be mono or stereo and must have a sample width of 2 bytes (16-bit). If stereo, only the left channel will be used. By default, the data will be automatically normalized using pico_synth_sandbox.normalize.
- Parameters:
filepath (str) – The absolute path to the .wav file.
max_samples (int) – The maximum limit of which to load audio samples from the audio file. Used to avoid memory overflow with large audio files. Defaults to 4096 samples.
- Returns:
A tuple of the audio data in the format of a
ulab.numpy.ndarray
with a formatting of ulab.numpy.int16 and the sample rate of the audio file.- Return type:
tuple[
ulab.numpy.ndarray
, int]