This commit is contained in:
Correl Roush 2021-02-19 22:33:05 -05:00
parent 38f10e1e90
commit 3fc0df2ddb

View file

@ -1 +1,24 @@
#+title: Digital Audio Processing
* Sine Wave
#+name: sine-wave
#+begin_src python :exports code :results silent
import numpy as np
samplerate = 44100
frequency = 440
samples = 44100
x = np.arange(samples)
return 100 * np.sin(2 * np.pi * frequency * x / samplerate)
#+end_src
#+begin_src python :exports results :results file :noweb yes
from matplotlib import pyplot as plt
def wave():
<<sine-wave>>
plt.plot(wave()[:100])
plt.savefig("dap-sinewave.png")
return "dap-sinewave.png"
#+end_src