M
M
Maruto2021-07-29 16:14:05
Python
Maruto, 2021-07-29 16:14:05

How can I download a lossless audio spectrogram?

Good afternoon. I get the spectrogram of an audio file like this:

import librosa
import numpy as np
# write wav file from the amplitude
import soundfile as sf


path = '/content/drive/MyDrive/originalputin/2.mp3.wav'

audio, sr = librosa.load(path)

audio_stft = librosa.stft(audio)

import matplotlib.pyplot as plt
import librosa.display

fig, ax = plt.subplots()
img = librosa.display.specshow(audio_stft, y_axis='log', x_axis='time', ax=ax)
ax.set_title('Spectrogram')
fig.colorbar(img, ax=ax, format="%+2.0f")


At the output, I get something like this picture:

6102a93162876509322320.png

How can I download this picture
1) Without any loss of quality, because shape stft = (1025, 465).
2) Without anything superfluous. Purely this square is colored.

Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question