notes
This commit is contained in:
parent
38f10e1e90
commit
3fc0df2ddb
1 changed files with 23 additions and 0 deletions
|
@ -1 +1,24 @@
|
||||||
#+title: Digital Audio Processing
|
#+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
|
||||||
|
|
Loading…
Reference in a new issue