I’m modifying fm_tx4 so that I can use wav files instead of dat files as
a
source, and output a file instead of sound.
I’m having issues with sample rate. I’ve attached the code, but here is
the
modified pipeline code, which is used to create the FM modulated signal
from
the wavfile
This code works if I set mult to <= 9 (meaning in fmtx = blks2.nbfm_tx
(audio_rate, if_rate, max_dev=5e3, tau=75e-6) that the if_rate has to be
an
integer multiple of 44.1KHz less than 9*44.1KHz). This is really vexing!
If
the multiple is 10 or higher, I get the error below.
I need the sample rate to be higher that way I can have lots of
disparate
signals. It’s confusing because if audio_rate is 32KHz, then if_rate can
be
set arbitrarily large. I can’t do that, though, because the sample rate
of a
wav file is 44.1KHz.
Your help is appreciated
class pipeline(gr.hier_block2):
def init(self, filename, lo_freq, mult):
gr.hier_block2.__init__(self, "pipeline",
gr.io_signature(0, 0, 0),
Input signature
gr.io_signature(1, 1,
gr.sizeof_gr_complex))
Output signature
src = gr.wavfile_source(filename,True)
audio_rate=src.sample_rate()
if_rate = mult * audio_rate
fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3,
tau=75e-6)
# Local oscillator
lo = gr.sig_source_c (if_rate, # sample rate
gr.GR_SIN_WAVE, # waveform type
lo_freq, #frequency
1.0, # amplitude
0) # DC Offset
mixer = gr.multiply_cc ()
self.connect (src, gr.multiply_const_ff(10), fmtx, (mixer, 0))
self.connect (lo, (mixer, 1))
self.connect (mixer, self)
gr_remez: insufficient extremals – cannot continue
Traceback (most recent call last):
File “./file_fm_mod_multi.py”, line 156, in
main ()
File “./file_fm_mod_multi.py”, line 152, in main
app = stdgui2.stdapp(fm_tx_block, “Multichannel FM Tx”, nstatus=1)
File
“/usr/local/lib/python2.5/site-packages/gnuradio/wxgui/stdgui2.py”,
line 36, in init
wx.App.init (self, redirect=False)
File
“/opt/local/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py”,
line 7935, in init
self._BootstrapApp()
File
“/opt/local/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py”,
line 7509, in _BootstrapApp
return core.PyApp__BootstrapApp(*args, **kwargs)
File
“/usr/local/lib/python2.5/site-packages/gnuradio/wxgui/stdgui2.py”,
line 39, in OnInit
frame = stdframe (self.top_block_maker, self.title, self._nstatus)
File
“/usr/local/lib/python2.5/site-packages/gnuradio/wxgui/stdgui2.py”,
line 60, in init
self.panel = stdpanel (self, self, top_block_maker)
File
“/usr/local/lib/python2.5/site-packages/gnuradio/wxgui/stdgui2.py”,
line 81, in init
self.top_block = top_block_maker (frame, self, vbox, sys.argv)
File “./file_fm_mod_multi.py”, line 140, in init
options.sample_multiple)
File “./file_fm_mod_multi.py”, line 63, in init
fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6)
File
“/usr/local/lib/python2.5/site-packages/gnuradio/blks2impl/nbfm_tx.py”,
line
69, in init
40) # stopband atten dB
File “/usr/local/lib/python2.5/site-packages/gnuradio/optfir.py”, line
53,
in low_pass
taps = gr.remez (n + nextra_taps, fo, ao, w, “bandpass”)
File
“/usr/local/lib/python2.5/site-packages/gnuradio/gr/gnuradio_swig_py_general.py”,
line 352, in remez
return _gnuradio_swig_py_general.remez(*args, **kwargs)
RuntimeError: gr_remez: insufficient extremals – cannot continue