Other questions such as How to convert a mel spectrogram to log-scaled mel spectrogram have asked how to get the log-scaled mel spectrogram in python. My code below produces said spectrogram
ps = librosa.feature.melspectrogram(y=y, sr=sr)
ps_db= librosa.power_to_db(ps, ref=np.max)
librosa.display.specshow(ps_db, x_axis='s', y_axis='log')
If I plot this, I get the spectrogram I am looking for.
However, if I don't use librosa's display.specshow and just perform
import matplotlib.pyplot as plt
plt.imshow(ps_db)
I get this
My question is, what transformation is display.specshow doing to produce the first plot and how can I recreate this just using ps_db and numpy such that my plt.imshow() call aligns with display.specshow?