I have a recorded audio signal that I would like to convert into spectrogram with the highest possible yield of information. The audio clips I am working with is about 30 ms long and contains frequencies between 20 Hz - 20 kHz. The sampling frequency used is 44.1 kHz.
What I have done:
In Python I have used the library
librosa to create amplitude spectrograms. Here I have used the length of the signal as number of points for the FFT, hop length (number audio of frames between STFT columns) of 1 and window length (Each frame of audio is windowed by window()) of 64.
For reference, the code used to generate and display the spectrogram is as follows:
plt.figure() librosa.display.specshow(librosa.power_to_db( np.abs(librosa.stft(signal, len(signal), 1,64)) ** 2, ref=1.0), y_axis='linear', sr=fs, cmap='coolwarm') plt.axis("off") plt.savefig(SAVEDIR_spec_cw+"spec_"+str(i)+".png") plt.close()
This seemed (visually) to give the best image result as seen below:
Is this as good as it gets?
I do have access to MATLAB as well, if someone can suggest a better method using that instead.