musisep.audio package¶
Submodules¶
musisep.audio.performance module¶
Module for calculation of the performance measures for blind source separation.
-
class
musisep.audio.performance.
MeasureAcc
(n)[source]¶ Bases:
object
Container object for the computation of performance measures.
Parameters: n (int) – Number of instruments to consider
-
musisep.audio.performance.
measures
(synth_signals, orig_signals, size=1048576)[source]¶ Compute the SDR, SIR, and SAR in all permutations of the synthesized signals.
Parameters: - synth_signals (array_like) – Array with the synthesized signals in its rows
- orig_signals (array_like) – Array with the original signals in its rows
- size (int) – Length of the signal fragments to consider at once
Returns: - perms (list of ndarray) – Permutations of the indices of the signals
- measures (list of ndarray) – Arrays with SDR, SIR, and SAR for the signals in rows
-
musisep.audio.performance.
orthogonalize
(signals)[source]¶ Orthogonalize the given signals.
Parameters: signals (array_like) – Matrix with the signals in its rows Returns: q_matrix – Matrix with the orthogonalized signals in its rows Return type: ndarray
-
musisep.audio.performance.
project
(signals, q_matrix)[source]¶ Project the given signals on the given space.
Parameters: - signals (array_like) – Matrix with the signals in its rows
- q_matrix (array_like) – Matrix with an orthonormal basis of the space in its rows
Returns: proj_signals – Matrix with the projected signals in its rows
Return type: ndarray
-
musisep.audio.performance.
select_perm
(perms, measures)[source]¶ Select the permutation with the highest SIR sum.
Parameters: - perms (list of array_like) – Permutations of the indices of the signals
- measures (list of array_like) – Arrays with SDR, SIR, and SAR for the signals in rows
Returns: - best_perm (ndarray) – Permutation of synth_signals with the lowest SIR sum
- best_measure (ndarray) – SDR, SIR, and SAR in the permutation with the lowest SIR sum
musisep.audio.specttool module¶
Back-end module for the Griffin-Lim algorithm.
-
musisep.audio.specttool.
adapt_mag
()¶
-
musisep.audio.specttool.
unstripe
()¶
musisep.audio.wav module¶
Module to handle WAV audio data.
-
musisep.audio.wav.
read
(filename)[source]¶ Read WAV audio data from a file. If the data has multiple channels, they will be averaged.
Parameters: filename (string) – Name of the WAV file. Returns: - data (ndarray) – Audio data as double array with values in [-1,1].
- samprate (int) – Sampling rate of the WAV file.
-
musisep.audio.wav.
read_stereo
(filename)[source]¶ Read WAV audio data from a file. If the data has multiple channels, they will be returned as rows of the output array.
Parameters: filename (string) – Name of the WAV file. Returns: - data (ndarray) – Audio data as double array with values in [-1,1].
- samprate (int) – Sampling rate of the WAV file.
-
musisep.audio.wav.
unify
(in_data)[source]¶ Convert the input data to a double-type array with values in [-1,1]. Input type must be double, float32, int32, int16, or uint8.
Parameters: in_data (array_like) – Data to be unified Returns: out_data – Unified data. Return type: ndarray
-
musisep.audio.wav.
write
(filename, signal, samprate)[source]¶ Normalize WAV audio data and write it to a file. The data type should be floating-point and must be supported by scipy.io.wavfile.
Parameters: - filename (string) – Name of the WAV file.
- signal (array_like) – Audio data to write.
- samprate (int) – Intended sampling rate of the WAV file.
Returns: maxval – Number by which was divided during normalization.
Return type: scalar