0
0

pythonでgnuradio その14

Posted at

概要

pythonでgnuradioやってみた。
練習問題やってみた。

練習問題

sin波を録音せよ。

サンプルコード

from gnuradio import gr
from gnuradio import blocks
from gnuradio import analog

class my_top_block(gr.top_block):
	def __init__(self):
		gr.top_block.__init__(self)
		samples = sample_rate = 48000
		ampl = 0.3
		src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl)
		head = blocks.head(gr.sizeof_float, samples)
		dst = blocks.wavfile_sink("a1.wav", 1, sample_rate, blocks.FORMAT_WAV, blocks.FORMAT_PCM_16)
		self.connect(src, head, (dst, 0))

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






以上。

0
0
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
0