def save_spectrogramm_png(path):
    # Load the mel spectrogram
    spectrogram = mel_spectrogram(path)

    # Begin the plot
    figure = plot.figure(1)
    plot.imshow(spectrogram[:, 20:160])

    # Add the color bar
    color_bar = plot.colorbar()
    n = np.linspace(0, 35, num=11)
    labels = []
    for l in n:
        labels.append(str(l) + ' dB')
    color_bar.ax.set_yticklabels(labels)

    # Add x and y labels
    plot.xlabel('Spektra (in Zeit)')
    plot.ylabel('Frequenz-Datenpunkte')

    # Save the figure to disc
    figure.savefig(
        get_result_png(
            str.join("_",
                     path.split("/")[-2:]) + "_spectrogram.png"))
    figure.clear()
def extract_mel_spectrogram(wav_path, X, y, index, curr_speaker_num):
    """
    Extracts the mel spectrogram into the X array and saves the speaker into y.

    :param wav_path: the path to the wav file
    :param X: return Array that saves the mel spectrogram
    :param y: return Array that saves the speaker numbers
    :param index: the index in X and y this is stored in
    :param curr_speaker_num: the speaker number of the current speaker
    :return: a one (1) to increase the index
    """
    Sxx = spectrogram_converter.mel_spectrogram(wav_path)
    for i in range(Sxx.shape[0]):
        for j in range(Sxx.shape[1]):
            X[index, 0, i, j] = Sxx[i, j]
    y[index] = curr_speaker_num
    return 1