Display
- rythm_forge.display.spectrogram(data: ndarray, sr=44100, hop_length=512, yaxis=None, time=True, fmin=None, fmax=None, ax=None) None[source]
Displays a precomputed spectrogram in linear, log, or mel scale on the y-axis.
Parameters:
- datanp.ndarray
The STFT matrix (2D array) containing the magnitude values of the spectrogram. Must be of type np.floating.
- srint, optional
The sampling rate of the original audio signal. Default is 44100 Hz.
- hop_lengthint, optional
The number of samples between successive frames in the STFT. Default is 512.
- yaxisstr, optional
The scale of the y-axis. Options are: - “linear” (default) - “log” - “mel”
- timebool, optional
If True, the x-axis will be labeled with time in seconds. Default is True.
- fminfloat, optional
The minimum frequency to display on the y-axis. Default is 20 Hz.
- fmaxfloat, optional
The maximum frequency to display on the y-axis. Default is sr/2.
- axmatplotlib.axes.Axes, optional
A matplotlib Axes object to plot on. If None, a new figure and axes will be created.
Raises:
- RythmForgeTypeError
If the data type of the STFT matrix is not np.float64 or an unknown yaxis type is provided.
- RythmForgeValueError
If the STFT matrix does not have exactly 2 dimensions.
Returns:
AxesImage