diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-01-03 12:28:08 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-01-03 12:28:08 +0100 |
commit | 38ef609475a25143640bf8d2d1df5ad6a68b7403 (patch) | |
tree | 2dcd2e4fc289aa21d74b48f70f4f93aabe13f027 /gensine.py | |
parent | 255119ae911e65ed5b579034c1d965d770851a1e (diff) | |
download | fl2k_ampliphase-38ef609475a25143640bf8d2d1df5ad6a68b7403.tar.gz fl2k_ampliphase-38ef609475a25143640bf8d2d1df5ad6a68b7403.tar.bz2 fl2k_ampliphase-38ef609475a25143640bf8d2d1df5ad6a68b7403.zip |
Simplify DDS, add plots
Diffstat (limited to 'gensine.py')
-rwxr-xr-x | gensine.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,13 +1,17 @@ +#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np +amplitude = 0.8 + +dac_rate = 10000 #Hz sample_rate = 1000 #Hz freq = 5 #Hz -duration = 2# seconds +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 = (amplitude * 32767 * np.sin(2.0 * np.pi * freq * np.arange(num_samples) / sample_rate)).astype("i2") sine_table.tofile("sine.dat") @@ -15,4 +19,6 @@ plt.plot(sine_table) plt.show() print("Now run:") -print("target/debug/fl2k_ampliphase -D -c 2000 -s 10000 -i 1000 -f sine.dat") +print(f"target/debug/fl2k_ampliphase -D -c 2000 -s {dac_rate} -i {sample_rate} -f sine.dat -w sine") +print("And then") +print("./plot.py") |