#概要
pythonでgnuradioやってみた。
FM変調を録音。
信号は、440hzのサイン波、搬送波は、16KHZ。
#サンプルコード
from gnuradio import gr, blocks, analog
from gnuradio import audio
class my_top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
self.samp_rate = samp_rate = 32000
self.blocks_wavfile_sink_0 = blocks.wavfile_sink('f5.wav', 1, samp_rate, 8)
self.blocks_vco_f_0 = blocks.vco_f(32000, 16000, 1)
self.blocks_head_0 = blocks.head(gr.sizeof_float * 1, 64000)
self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 440, 0.3, 0)
self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_const_vxx_0, 0))
self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_vco_f_0, 0))
self.connect((self.blocks_head_0, 0), (self.blocks_wavfile_sink_0, 0))
self.connect((self.blocks_vco_f_0, 0), (self.blocks_head_0, 0))
if __name__ == '__main__':
try:
my_top_block().run()
except KeyboardInterrupt:
pass
以上。