Trying the following:
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import audio
class my_top_block(gr.top_block):
def init(self):
gr.top_block.init(self)
sample_rate = 32000
ampl = 0.1
src = gr.noise_source_f(GR_GAUSSIAN,ampl)
dst = gr.null_sink(1000)
b2f = gr.chunks_to_symbols_bf
self.connect(src,b2f,dst)
if name == ‘main’:
try:
my_top_block().run()
except KeyboardInterrupt:
pass
Receiving the following error:
Traceback (most recent call last):
File “test_gnuradio.py”, line 21, in
my_top_block().run()
File “test_gnuradio.py”, line 13, in init
src = gr.noise_source_f(GR_GAUSSIAN,ampl)
NameError: global name ‘GR_GAUSSIAN’ is not defined
Not finding the gr_noise_type defined in python:
help> gnuradio.gr.noise_type
no Python documentation found for ‘gnuradio.gr.noise_type’
help> gnuradio.gr.noise_source_f
help> gnuradio.gr.noise_type
no Python documentation found for ‘gnuradio.gr.noise_type’
But the gr_noise_type.h file is installed:
root@radioman-laptop:~/Desktop# locate gr_noise_type.h
/gnuradio/gnuradio-3.2.2/gnuradio-core/src/lib/gengen/gr_noise_type.h
/usr/local/include/gnuradio/gr_noise_type.h
root@radioman-laptop:~/Desktop#
…the file does contain the enum as listed in the C++ API.
#ifndef INCLUDED_GR_NOISE_TYPE_H
#define INCLUDED_GR_NOISE_TYPE_H
typedef enum {
GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE
} gr_noise_type_t;
#endif /* INCLUDED_GR_NOISE_TYPE_H */
root@radioman-laptop:~/Desktop#