code: def plot(freq, amp, waveform, sample_rate, zoom=None, vol=0.1):
      t = (torch.arange(waveform.size(0)) / sample_rate).numpy()
  
      fig, axes = plt.subplots(4, 1, sharex=True)
      axes[0].plot(t, freq.numpy())
      axes[0].set(
          title=f"Oscillator bank (bank size: {amp.size(-1)})",
          ylabel="Frequency [Hz]",
          ylim=[-0.03, None],
      )
      axes[1].plot(t, amp.numpy())
      axes[1].set(
          ylabel="Amplitude",
          ylim=[-0.03 if torch.all(amp >= 0.0) else None, None],
      )
      axes[2].plot(t, waveform)
      axes[2].set(ylabel="Waveform")
      axes[3].specgram(waveform, Fs=sample_rate)
      axes[3].set(
          ylabel="Spectrogram",
          xlabel="Time [s]",
          xlim=[-0.01, t[-1] + 0.01],
      )
  
      for i in range(4):
          axes[i].grid(True)
      pos = axes[2].get_position()
      fig.tight_layout()
  
      if zoom is not None:
          ax = fig.add_axes(
              [
                  pos.x0 + 0.02,
                  pos.y0 + 0.03,
                  pos.width / 2.5,
                  pos.height / 2.0,
              ]
          )
          ax.plot(t, waveform)
          ax.set(xlim=zoom, xticks=[], yticks=[])
  
      waveform /= waveform.abs().max()
      return Audio(vol * waveform, rate=sample_rate, normalize=False)
  
file_path: audio/examples/tutorials/additive_synthesis_tutorial.py
imports: import torch
  import torchaudio
  import matplotlib.pyplot
  from IPython.display import Audio
label_desc: Use image node_id 1 for calling a global function with example usage: plot(freq, amp, waveform, sample_rate, zoom, vol) and returns: Audio