aboutsummaryrefslogtreecommitdiffstats
path: root/gensine.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-01-01 17:36:38 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-01-01 17:36:38 +0100
commit00c7e7400d3e0640ba22da824aaeaab0b5e6397a (patch)
tree58c391892d33b8b5531abd629b583365787ba212 /gensine.py
parentadf283e4bfc50e49e92d369853eb3253481b8fbb (diff)
downloadfl2k_ampliphase-00c7e7400d3e0640ba22da824aaeaab0b5e6397a.tar.gz
fl2k_ampliphase-00c7e7400d3e0640ba22da824aaeaab0b5e6397a.tar.bz2
fl2k_ampliphase-00c7e7400d3e0640ba22da824aaeaab0b5e6397a.zip
Add gensine.py
Diffstat (limited to 'gensine.py')
-rwxr-xr-xgensine.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/gensine.py b/gensine.py
new file mode 100755
index 0000000..872337e
--- /dev/null
+++ b/gensine.py
@@ -0,0 +1,18 @@
+import matplotlib.pyplot as plt
+import numpy as np
+
+sample_rate = 1000 #Hz
+freq = 5 #Hz
+duration = 2# seconds
+
+num_samples = sample_rate * duration
+
+sine_table = (32767 * np.sin(2.0 * np.pi * freq * np.arange(num_samples) / sample_rate)).astype("i2")
+
+sine_table.tofile("sine.dat")
+
+plt.plot(sine_table)
+plt.show()
+
+print("Now run:")
+print("target/debug/fl2k_ampliphase -D -c 2000 -s 10000 -i 1000 -f sine.dat")