Subversion Repositories svnkaklik

Rev

Rev 515 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 515 Rev 524
1
#!/usr/bin/env python
1
#!/usr/bin/env python
2
##################################################
2
##################################################
3
# Gnuradio Python Flow Graph
3
# Gnuradio Python Flow Graph
4
# Title: untitled
4
# Title: untitled
5
# Author: unknown
5
# Author: unknown
6
# Description: gnuradio flow graph
6
# Description: gnuradio flow graph
7
# Generated: Fri Feb 20 19:47:38 2009
7
# Generated: Sat Feb 21 13:28:44 2009
8
##################################################
8
##################################################
9
 
9
 
10
from gnuradio import audio
10
from gnuradio import audio
11
from gnuradio import gr
11
from gnuradio import gr
12
from gnuradio.wxgui import fftsink2
12
from gnuradio.wxgui import fftsink2
13
from grc_gnuradio import wxgui as grc_wxgui
13
from grc_gnuradio import wxgui as grc_wxgui
14
import wx
14
import wx
15
 
15
 
16
class frequency_response(grc_wxgui.top_block_gui):
16
class frequency_response(grc_wxgui.top_block_gui):
17
 
17
 
18
	def __init__(self):
18
	def __init__(self):
19
		grc_wxgui.top_block_gui.__init__(
19
		grc_wxgui.top_block_gui.__init__(
20
			self,
20
			self,
21
			title="GRC - Executing: untitled",
21
			title="GRC - Executing: untitled",
22
			icon="/usr/local/share/icons/hicolor/32x32/apps/gnuradio-grc.png",
22
			icon="/usr/local/share/icons/hicolor/32x32/apps/gnuradio-grc.png",
23
		)
23
		)
24
 
24
 
25
		##################################################
25
		##################################################
26
		# Variables
26
		# Variables
27
		##################################################
27
		##################################################
28
		self.samp_rate = samp_rate = 32000
28
		self.samp_rate = samp_rate = 32000
29
 
29
 
30
		##################################################
30
		##################################################
31
		# Blocks
31
		# Blocks
32
		##################################################
32
		##################################################
33
		self.audio_sink_0 = audio.sink(48000, "hw:1,0", True)
33
		self.audio_sink_0 = audio.sink(48000, "hw:1,0", True)
34
		self.audio_source_0 = audio.source(48000, "hw:1,0", True)
34
		self.audio_source_0 = audio.source(48000, "hw:1,0", True)
35
		self.gr_noise_source_x_0 = gr.noise_source_f(gr.GR_UNIFORM, 1, 100)
35
		self.gr_noise_source_x_0 = gr.noise_source_f(gr.GR_UNIFORM, 1, 100)
36
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
36
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
37
			self.GetWin(),
37
			self.GetWin(),
38
			baseband_freq=0,
38
			baseband_freq=0,
39
			y_per_div=10,
39
			y_per_div=10,
40
			y_divs=8,
40
			y_divs=8,
41
			ref_level=50,
41
			ref_level=50,
42
			sample_rate=96000,
42
			sample_rate=96000,
43
			fft_size=2048,
43
			fft_size=2048,
44
			fft_rate=25,
44
			fft_rate=25,
45
			average=True,
45
			average=True,
46
			avg_alpha=None,
46
			avg_alpha=None,
47
			title="FFT Plot",
47
			title="FFT Plot",
48
			peak_hold=False,
48
			peak_hold=False,
49
		)
49
		)
50
		self.Add(self.wxgui_fftsink2_0.win)
50
		self.Add(self.wxgui_fftsink2_0.win)
51
 
51
 
52
		##################################################
52
		##################################################
53
		# Connections
53
		# Connections
54
		##################################################
54
		##################################################
55
		self.connect((self.gr_noise_source_x_0, 0), (self.audio_sink_0, 0))
55
		self.connect((self.gr_noise_source_x_0, 0), (self.audio_sink_0, 0))
56
		self.connect((self.audio_source_0, 0), (self.wxgui_fftsink2_0, 0))
56
		self.connect((self.audio_source_0, 0), (self.wxgui_fftsink2_0, 0))
-
 
57
		self.connect((self.gr_noise_source_x_0, 0), (self.audio_sink_0, 1))
57
 
58
 
58
	def set_samp_rate(self, samp_rate):
59
	def set_samp_rate(self, samp_rate):
59
		self.samp_rate = samp_rate
60
		self.samp_rate = samp_rate
60
 
61
 
61
if __name__ == '__main__':
62
if __name__ == '__main__':
62
	if gr.enable_realtime_scheduling() != gr.RT_OK:
63
	if gr.enable_realtime_scheduling() != gr.RT_OK:
63
		print "Error: failed to enable realtime scheduling."
64
		print "Error: failed to enable realtime scheduling."
64
	tb = frequency_response()
65
	tb = frequency_response()
65
	tb.Run()
66
	tb.Run()
66
 
67