I'm experimenting with writing GNUradio scripts in python. My eventual goal is to have a routine that periodically writes a floating point result from within a GNUradio process to the serial port. As a first step I wanted to try and interact with a simple routine by simply pausing after a short time period. I started with the the following code that plays a 1kHz tone thru the sound card:
#!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph # Title: simpleTone # Generated: Wed Jun 29 07:26:02 2016 ################################################## from gnuradio import analog from gnuradio import audio from gnuradio import blocks from gnuradio import gr import time class simpleTone(gr.top_block): def __init__(self): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## #self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate) self.audio_sink_0 = audio.sink(samp_rate, "", True) self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) ################################################## # Connections ################################################## #self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) #self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.audio_sink_0, 0)) if __name__ == '__main__': simpleTone().run() The code above works fine, however if I make the following substitution: if __name__ == '__main__': simpleTone().start() simpleTone().wait() #time.sleep(3) simpleTone().stop() The result is that the file runs, and ends after 3 seconds but no audio is produced. I'm sure I've missed something fairly basic, any help would be appreciated. Thanks. -Ed
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio