SignalSmith
Inherits: RefCounted < Object
Performs time-stretching and pitch-shifting on raw audio buffers using Signalsmith.
Description
SignalSmith is a low-level audio processing utility which wraps the Signalsmith time-stretching library. It operates on raw interleaved floating-point PCM audio buffers and allows independent control of playback tempo and pitch.
Methods
| AudioStreamWAV | change_tempo\ (\ path: String, tempo: float, pitch: float = 1.0\ ) |
|---|---|
| int | get_last_channels\ (\ ) const |
| int | get_last_sample_rate\ (\ ) const |
| PackedFloat32Array | process\ (\ input: PackedFloat32Array\ ) |
void | reset\ (\ ) |
void | set_channels\ (\ channels: int\ ) |
void | set_pitch\ (\ pitch: float\ ) |
void | set_sample_rate\ (\ rate: int\ ) |
void | set_tempo\ (\ tempo: float\ ) |
Method Descriptions
AudioStreamWAV change_tempo\ (\ path: String, tempo: float, pitch: float = 1.0\ ) 🔗
Loads an MP3 file, applies time-stretching and pitch-shifting using the Signalsmith engine, and returns a streamable AudioStreamWAV.
The tempo parameter controls playback speed without affecting pitch. A value of 1.0 preserves the original speed.
The pitch parameter is a transpose factor. A value of 1.0 preserves pitch, 2.0 raises pitch by one octave,
and 0.5 lowers pitch by one octave.
int get_last_channels\ (\ ) const 🔗
There is currently no description for this method. Please help us by contributing one!
int get_last_sample_rate\ (\ ) const 🔗
There is currently no description for this method. Please help us by contributing one!
PackedFloat32Array process\ (\ input: PackedFloat32Array\ ) 🔗
Processes a block of interleaved audio samples and returns a new buffer containing the time-stretched and pitch-shifted result.
The effective playback speed is determined by the ratio of input samples to output samples, as influenced by the current tempo setting. The input buffer must contain 32-bit floating-point PCM data and be interleaved according to the configured channel count.
void reset\ (\ ) 🔗
Resets the internal processing state.
This should be called when restarting playback or discontinuously changing input streams.
void set_channels\ (\ channels: int\ ) 🔗
Sets the number of audio channels.
Input and output buffers are expected to be interleaved according to this channel count.
void set_pitch\ (\ pitch: float\ ) 🔗
Sets the pitch transpose factor.
A value of 1.0 leaves pitch unchanged. Values greater than 1.0 raise pitch, while values less than 1.0 lower pitch.
void set_sample_rate\ (\ rate: int\ ) 🔗
Sets the sample rate, in Hz, used by the internal processing engine.
Changing the sample rate resets the internal state.
void set_tempo\ (\ tempo: float\ ) 🔗
Sets the tempo multiplier used during processing.
This value influences the ratio between input and output buffer sizes during time-stretching. A value of 1.0 preserves the original tempo, values greater than 1.0 speed up playback, and values less than 1.0 slow it down.