I am reading pcm data from a file and then plotting it. Ive noticed that the plot varies between librosa.display.waveplot, plot and audacity.
Here is the code and images
%matplotlib inline
import matplotlib.pyplot as plt
import librosa.display
import numpy as np
import IPython.display as ipd
import matplotlib.pyplot as plt
import numpy, pylab
# the pcm file is 32le integer with a sampling rate of 16KHz
pcm_data = np.fromfile('someaudio.pcm', dtype=np.int32)
# the sample has the same sound as audacity
ipd.Audio(data=pcm_data, rate=16000)
# all of these give the same resulting plot
plt.figure()
plt.subplot(3, 1, 1)
#librosa.display.waveplot(pcm_data, sr=16000)
#librosa.display.waveplot(pcm_data.astype('double'), sr=16000)
librosa.display.waveplot(pcm_data.astype('float'), max_points=None, sr=16000, max_sr=16000)
# alternatively plot via matplotlib
pylab.plot(pcm_data)
pylab.show()