How to show the detail of a sound plot

In Figure 1, the plot can be seen more detailed than that of Figure 2, it may because the recording duration of Figure 1 is less. However, I would like to see the more detailed and more micro-viewed of Figure 1 without reducing the recording duration, kind of like Figure 3 (just an sample) which is more detailed and can be easily analyzed. Is there any approach to “zoom” the plot result and keep the detailed resolution simultaneously?

Many thanks!

(Here are Figure 1, Figure 2 and Figure 3, apologize for new user can only upload one image)

import wave
import matplotlib.pyplot as plt
import numpy as np

f ="output.wav", "rb")
params = f.getparams()
nchannels, sampwidth, framerate, nframes = params[:4]

str_data = f.readframes(nframes)

wave_data = np.frombuffer(str_data, dtype=np.short)

wave_data = wave_data*1.0/(max(abs(wave_data)))
wave_data = np.reshape(wave_data,[nframes,nchannels])
time = np.arange(0, nframes) * (10.0 / framerate)

plt.plot(time, wave_data[:,0])
plt.xlabel("time (seconds)")
plt.title("Left channel")

plt.plot(time, wave_data[:,1], c="g")
plt.xlabel("time (seconds)")
plt.title("Left channel")
plt.title("right channel")

One thing you can do is to set the figure size:
You can make x relatively large to get the detail while allowing the whole time series to be plotted.


1 Like