-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudio_test.py
More file actions
39 lines (33 loc) · 934 Bytes
/
audio_test.py
File metadata and controls
39 lines (33 loc) · 934 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
35
36
37
38
39
# Settings
ip_address = "localhost"
number_of_loops = 2
sleep_between_loops = 0
signal_file = 'PortoVeryShort'
##--------------------------------------##
import sys
import time
import numpy as np
import arlpy.signal as asig
import arlpy.plot as plt
from unetpy import *
# Open connection to the modem
print("-I- connecting to modem: " + ip_address)
try:
sock = UnetSocket('localhost', 1100)
modem = sock.getGateway()
except:
print("-I- cannot connect to modem")
exit(1)
# Load the signal to transmit
print("-I- loading signal from: " + signal_file)
try:
# signal = np.genfromtxt(signal_file)
signal = np.loadtxt(signal_file)
print("-I- signal loaded")
except:
print("-E- failed to load signal file")
exit(1)
# Generate a passband 100 ms 12 kHz pulse at a sampling rate of 96 kSa/s:
fs = 12000
bb = modem.agentForService(Services.BASEBAND)
bb << TxBasebandSignalReq(signal=signal, fc=0, fs=fs)