Results

class spectrograms.Spectrogram

Bases: object

Spectrogram computation result.

Contains the spectrogram data as a NumPy array along with frequency and time axes and the parameters used to create it.

T

Get the transpose of the spectrogram data.

Returns

numpy.typing.NDArray[numpy.float64]

Transposed 2D NumPy array with shape (n_frames, n_bins)

data

Get the spectrogram data as a NumPy array.

Returns

numpy.typing.NDArray[numpy.float64]

2D NumPy array with shape (n_bins, n_frames)

db_range()

Get the decibel range if applicable.

Returns

tuple[float, float] or None

Tuple of (min_db, max_db) for decibel-scaled spectrograms, None otherwise

duration()

Get the total duration.

Returns

float

Duration in seconds

frequencies

Get the frequency axis values.

Returns

list[float]

List of frequency values (Hz or scale-specific units)

frequency_range()

Get the frequency range.

Returns

tuple[float, float]

Tuple of (f_min, f_max) in Hz or scale-specific units

n_bins

Get the number of frequency bins.

Returns

int

Number of frequency bins

n_frames

Get the number of time frames.

Returns

int

Number of time frames

params

Get the computation parameters.

Returns

SpectrogramParams

The SpectrogramParams used to compute this spectrogram

shape

Get the shape of the spectrogram.

Returns

tuple[int, int]

Tuple of (n_bins, n_frames)

times

Get the time axis values.

Returns

list[float]

List of time values in seconds