-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingen.py
More file actions
34 lines (31 loc) · 816 Bytes
/
singen.py
File metadata and controls
34 lines (31 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from __future__ import division
import math, wave, array
from random import randint
import Constants as c
def createTX(expAmp = c.a):
print ("Generate amplitude : " + str(expAmp))
for m in range (0,2):
print("chirp num :" + str(m))
for j in range(c.fs):
beta = (c.fend-c.fstart) * (math.pow((c.ns/c.fs), (-1 * c.p)))
i = j / c.fs
sample = expAmp * math.cos(math.pi * 2 * c.fstart * i)
#print(str(int(sample)))
f.write(str(int(sample)))
f.write("\n")
print("chirp num : quite")
for j in range(c.fs):
beta = (c.fend-c.fstart) * (math.pow((c.ns/c.fs), (-1 * c.p)))
i = j / c.fs
sample = 0
#print(str(int(sample)))
f.write(str(int(sample)))
f.write("\n")
f = open('/tmp/tx','w')
createTX(10)
createTX(100)
createTX(1000)
createTX(10000)
createTX(20000)
createTX(30000)
f.close()