-
Notifications
You must be signed in to change notification settings - Fork 0
/
send.py
31 lines (29 loc) · 812 Bytes
/
send.py
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
import numpy as np
import time
import os
import struct
def send(f):
# t = time.time() + 0.25 + 0.54
# t1 = time.time()
# b = struct.pack('d', t)
# for i in range(5):
# f.write(b)
# f.close()
os.system("amodem send -i data.tx -o a.pcm")
ff = open("data.tx",'rb')
f.write(ff.read(8))
f.write(b'\n')
os.system("ffplay -f s16le -ac 1 -ar 8000 -autoexit -i a.pcm")
ff.close()
# print("==========================================================")
# print("==========================================================")
# print("send at time", t)
# for i in b:
# print(hex(i))
# print("==========================================================")
# print("==========================================================")
f = open("time_send","wb")
for i in range(10):
send(f)
time.sleep(2)
f.close()