0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pythonでgnuradio その7

Last updated at Posted at 2021-04-26

#概要

pythonでgnuradioやってみた。
AM変調を録音した、wavファイル読み込んでAM復調して、聞く。
信号は、440hzのサイン波、搬送波は、5KHZ。

#サンプルコード

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)
		samp_rate = 32000
		self.blocks_wavfile_source_0 = blocks.wavfile_source('a2.wav', True)
		self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1)
		self.blocks_add_const_vxx_0 = blocks.add_const_vff((2, ))
		self.audio_sink_0 = audio.sink(samp_rate, '', True)
		self.analog_am_demod_cf_0 = analog.am_demod_cf(channel_rate = 32000, audio_decim = 1, audio_pass = 5000, audio_stop = 5500, )
		self.connect((self.analog_am_demod_cf_0, 0), (self.audio_sink_0, 0))
		self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_magphase_to_complex_0, 0))
		self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_magphase_to_complex_0, 1))
		self.connect((self.blocks_magphase_to_complex_0, 0), (self.analog_am_demod_cf_0, 0))
		self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_add_const_vxx_0, 0))

if __name__ == '__main__':
	try:
		my_top_block().run()
	except KeyboardInterrupt:
		pass




以上。

0
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?