diff --git a/docs/requirements.txt b/docs/requirements.txt index c3c87ed305..1fc3d1e2f2 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ Jinja2<3.1.0 -matplotlib +matplotlib<=3.8 pyparsing<3,>=2.0.2 # C++ docs diff --git a/examples/tutorials/additive_synthesis_tutorial.py b/examples/tutorials/additive_synthesis_tutorial.py index 329611918a..b21c32df26 100644 --- a/examples/tutorials/additive_synthesis_tutorial.py +++ b/examples/tutorials/additive_synthesis_tutorial.py @@ -86,12 +86,12 @@ def plot(freq, amp, waveform, sample_rate, zoom=None, vol=0.1): - t = torch.arange(waveform.size(0)) / sample_rate + t = (torch.arange(waveform.size(0)) / sample_rate).numpy() fig, axes = plt.subplots(4, 1, sharex=True) - axes[0].plot(t, freq) + 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) + 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") diff --git a/examples/tutorials/oscillator_tutorial.py b/examples/tutorials/oscillator_tutorial.py index b47c7cff4e..9c1541fd1f 100644 --- a/examples/tutorials/oscillator_tutorial.py +++ b/examples/tutorials/oscillator_tutorial.py @@ -103,14 +103,14 @@ def show(freq, amp, waveform, sample_rate, zoom=None, vol=0.3): - t = torch.arange(waveform.size(0)) / sample_rate + t = (torch.arange(waveform.size(0)) / sample_rate).numpy() fig, axes = plt.subplots(4, 1, sharex=True) - axes[0].plot(t, freq) + 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) + 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].plot(t, waveform.numpy()) 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]) diff --git a/examples/tutorials/subtractive_synthesis_tutorial.py b/examples/tutorials/subtractive_synthesis_tutorial.py index 6af24a0dc9..44dee93e74 100644 --- a/examples/tutorials/subtractive_synthesis_tutorial.py +++ b/examples/tutorials/subtractive_synthesis_tutorial.py @@ -227,7 +227,7 @@ def plot_waveform(magnitudes, filtered, sample_rate): _, ax = plt.subplots(1, 1, sharex=True) ax.vlines(offsets, 0, nyquist, color="gray", linestyle="--", linewidth=0.8) - ax.plot(mag_x.T, mag_y.T, color="gray", linewidth=0.8) + ax.plot(mag_x.T.numpy(), mag_y.T.numpy(), color="gray", linewidth=0.8) ax.specgram(filtered, Fs=sample_rate) return Audio(filtered, rate=sample_rate)