Spectrogram (libsoni.core.spectrogram)
- libsoni.core.spectrogram.sonify_spectrogram(spectrogram: ndarray, frequency_coefficients: ndarray | None = None, time_coefficients: ndarray | None = None, fading_duration: float = 0.05, sonification_duration: int | None = None, normalize: bool = True, fs: int = 22050) ndarray [source]
Sonifies a spectrogram using sinusoids.
- Parameters:
spectrogram (np.ndarray (np.float32 / np.float64) [shape=(N, K)]) – Spectrogram to be sonified.
frequency_coefficients (np.ndarray (np.float32 / np.float64) [shape=(N, )], default = None) – Array containing frequency coefficients, in Hertz.
time_coefficients (np.ndarray (np.float32 / np.float64) [shape=(K, )], default = None) – Array containing time coefficients, in seconds.
sonification_duration (int, default = None) – Determines duration of sonification, in samples.
fading_duration (float, default = 0.05) – Determines duration of fade-in and fade-out at beginning and end of the sonification, in seconds.
normalize (bool, default = True) – Determines if output signal is normalized to [-1,1].
fs (int, default = 22050) – Sampling rate, in samples per seconds.
- Returns:
spectrogram_sonification (np.ndarray (np.float32 / np.float64) [shape=(M, )]) – Sonified spectrogram.
- libsoni.core.spectrogram.sonify_spectrogram_multi(spectrogram: ndarray, frequency_coefficients: ndarray | None = None, time_coefficients: ndarray | None = None, sonification_duration: int | None = None, fading_duration: float = 0.05, fs: int = 22050, num_processes: int | None = None) ndarray [source]
Sonifies a spectrogram using sinusoids, using multiprocessing for efficiency.
- Parameters:
sample (np.ndarray (np.float32 / np.float64) [shape=(N, K)]) – Spectrogram to be sonified.
frequency_coefficients (np.ndarray (np.float32 / np.float64) [shape=(N, )], default = None) – Array containing frequency coefficients, in Hertz.
time_coefficients (np.ndarray (np.float32 / np.float64) [shape=(K, )], default = None) – Array containing time coefficients, in seconds.
sonification_duration (int, default = None) – Determines duration of sonification, in samples.
fading_duration (float, default = 0.05) – Determines duration of fade-in and fade-out at beginning and end of the sonification, in seconds.
fs (int, default = 22050) – Sampling rate, in samples per seconds.
num_processes (int, default = None) – Number of processes
- Returns:
spectrogram_sonification (np.ndarray (np.float32 / np.float64) [shape=(M, )]) – Sonified spectrogram.