-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathReceiver_tone_measurement.py
53 lines (44 loc) · 1016 Bytes
/
Receiver_tone_measurement.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'''
Created on Apr 6, 2014
@author: William Heimsoth
'''
#!/usr/bin/env python
# Chat Client (Test)
import sys
import soundrxtx
import thread
(p, stream) = soundrxtx.tone.init()
global state
global prev_freq
global str_buf
global bit_str_buf
global total_bit_str
global freq_found
state = 0
prev_freq = 0
str_buf = ""
bit_str_buf = ""
total_bit_str = ""
freq_found = False
def process_freq(freq):
global state
global prev_freq
global str_buf
global bit_str_buf
global total_bit_str
global freq_found
prev_freq = freq
if freq == tone:
freq_found = True
global tone
tone = 100
#tone = 1450
while tone < 10000:
(pr, streamr) = soundrxtx.recognize.init()
print "Testing tone %i!" % tone
freq_found = False
soundrxtx.recognize.recognize_live(pr, streamr, 0.5, [tone, tone-50, tone-100, tone+50, tone+100], process_freq)
if freq_found == True:
print " !! Found tone %i!" % tone
soundrxtx.recognize.end((pr, streamr))
tone += 25