The following GNU radio application adds a waterfall spectrogram to the previous CW filter program. The plot show 4 CW signals in the audio band (lower sideband) at 7023 kHz. The 700Hz signal is filtered and output to the laptop headphones by the CW bandpass filter. The frequency display is shown after the script which is as follows:
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import audio
from lpf_bpf_class import Bandpass
from gnuradio.qtgui import qtgui
from PyQt4 import QtGui
import sys, sip
class cw_filter(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
sample_rate = 44100
out_rate = 8000
kaiser = Bandpass()
cw_flr = gr.fir_filter_fff(1, kaiser.bpftaps)
decimate = int(sample_rate/out_rate)
Bandpass.cutoff1 = 3000
pre_decim = Bandpass()
dec_flr = gr.fir_filter_fff(1, pre_decim.lpftaps)
dec = gr.keep_one_in_n(gr.sizeof_float, decimate)
# Make a local QtApp
self.qapp = QtGui.QApplication(sys.argv)
fftsize = 2048
audio_mic = audio.source(sample_rate, "plughw:0,0")
amp1 = gr.multiply_const_ff(2.0)
amp2 = gr.multiply_const_ff(1.0)
dst = audio.sink (sample_rate, "")
self.connect (audio_mic, cw_flr, amp1, dst)
self.thr = gr.throttle(gr.sizeof_float, 100*fftsize)
self.snk = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0,
4000,
"CW Kaiser BPF Filter")
#True, True, False, True, False)
self.connect(audio_mic, amp2, self.thr, dec, self.snk)
self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
self.pyobj.show()
def main():
tb = cw_filter()
tb.start()
tb.qapp.exec_()
if __name__ == '__main__':
try:
main()
except [[KeyboardInterrupt]]:
pass
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import audio
from lpf_bpf_class import Bandpass
from gnuradio.qtgui import qtgui
from PyQt4 import QtGui
import sys, sip
class cw_filter(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
sample_rate = 44100
out_rate = 8000
kaiser = Bandpass()
cw_flr = gr.fir_filter_fff(1, kaiser.bpftaps)
decimate = int(sample_rate/out_rate)
Bandpass.cutoff1 = 3000
pre_decim = Bandpass()
dec_flr = gr.fir_filter_fff(1, pre_decim.lpftaps)
dec = gr.keep_one_in_n(gr.sizeof_float, decimate)
# Make a local QtApp
self.qapp = QtGui.QApplication(sys.argv)
fftsize = 2048
audio_mic = audio.source(sample_rate, "plughw:0,0")
amp1 = gr.multiply_const_ff(2.0)
amp2 = gr.multiply_const_ff(1.0)
dst = audio.sink (sample_rate, "")
self.connect (audio_mic, cw_flr, amp1, dst)
self.thr = gr.throttle(gr.sizeof_float, 100*fftsize)
self.snk = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
0,
4000,
"CW Kaiser BPF Filter")
#True, True, False, True, False)
self.connect(audio_mic, amp2, self.thr, dec, self.snk)
self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
self.pyobj.show()
def main():
tb = cw_filter()
tb.start()
tb.qapp.exec_()
if __name__ == '__main__':
try:
main()
except [[KeyboardInterrupt]]:
pass
Comments