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