<s> import sys <EOL> import groundstation . audio as audio <EOL> import quietnet . quietnet as quietnet <EOL> import pyaudio <EOL> import alltheFSKs . MFSKModulator as modulator <EOL> import alltheFSKs . MFSKDemodulator as demodulator <EOL> import groundstation . ue_encoder <EOL> from groundstation import logger <EOL> log = logger . getLogger ( __name__ ) <EOL> PING_PAYLOAD = "<STR_LIT>" <EOL> ENCODER = groundstation . ue_encoder . UnambiguousEncoder ( ) <EOL> DATASIZE = <NUM_LIT> <EOL> class AudioAnnouncer ( object ) : <EOL> def __init__ ( self , freq , freq_off , _audio ) : <EOL> self . audio = _audio <EOL> self . freq = freq <EOL> self . freq_off = freq_off <EOL> self . stream = audio . get_stream ( self . audio , output = True ) <EOL> self . ping_buffer = ENCODER . encode ( "<STR_LIT>" , map ( ord , PING_PAYLOAD ) ) <EOL> self . other_ping = ENCODER . encode ( "<STR_LIT>" , ( <NUM_LIT:0> , ) * <NUM_LIT:4> ) <EOL> def ping ( self ) : <EOL> self . ping_buffer , self . other_ping = self . other_ping , self . ping_buffer <EOL> log . info ( "<STR_LIT>" ) <EOL> log . info ( repr ( self . ping_buffer ) ) <EOL> mod = modulator . MFSKModulator ( ) <EOL> print repr ( self . ping_buffer ) <EOL> mod . modulate_symbol ( self . ping_buffer ) <EOL> demod = demodulator . MFSKDemodulator ( sample_rate = audio . RATE , callback = lambda i : sys . stdout . write ( "<STR_LIT>" % repr ( i ) ) ) <EOL> demod . consume ( mod . emit_all ( ) ) <EOL> mod . write_to_stream ( self . stream ) </s>
