Problems with the examples

Hello all!

I’m working on OFDM synchronization for GNURadio and we need a file to
simulate the OFDM. I thought it would be a good way use the
audio_to_file.py of the examples, but it doesn´t work. I speak to the
microphone but when I run audio_play.py nothing is listened. I think the
problem might be because when I push ENTER the execution of these
examples should finish and it doesn’t, it continue running until I kill
the process (ctrl+c). It occurs with all the examples and I don’t know
what can be the problem because I’ve checked the code on the website and
it is the same… The lines which should do it are:

if name == ‘main’:
try:
my_top_block().run()
except KeyboardInterrupt:
pass

I think that it is ok and with these lines the program should stop by
pushing ENTER but it doesn’t. The microphone problem must be other one
but i`m starting to suspect that the file doesn’t record fine because of
this mistake. Can be useful for you that when I run audio_to_play.py it
finishes when the file finishes(last a little of time) although it
doesn’t sound anything, and it doesn’t stop if pushing ENTER.

I know these are very elemental doubts and problems but are stopping us
of going on with our work and we are not able to solve it.

Thank you very much

On 2/11/08, Jose Emilio Gervilla R. [email protected] wrote:

if name == ‘main’:
try:
my_top_block().run()
except KeyboardInterrupt:
pass

I think that it is ok and with these lines the program should stop by
pushing ENTER but it doesn’t.

In Python, a KeyboardInterrupt is caused by Ctrl-C, not by hitting any
key. The above code snippet is acting as it should.

If you want the flowgraph to end with an Enter key:

if name == ‘main’:
tb.start()
raw_input(“Press Enter to stop.”)
tb.stop()
tb.wait()


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com/

So, my problem must be with the microphone used in the notebook. I use
the integrated microphone and it doesn’t record anything, might be I
should use the command -I to let the program know that the source is the
microphone, but how is it called in Linux? I mean, the line to call the
program would be:

./audio_to_file.py -I (here how do I define the microphone in linux??)
test.dat

Might be also linux configuration for the microphone, can anyone tell me
what is the right one?

Thank you very much! > Date: Mon, 11 Feb 2008 10:16:47 -0800> From:
[email protected]> To: [email protected]> Subject: Re:
[Discuss-gnuradio] Problems with the examples> CC:
[email protected]> > On 2/11/08, Jose Emilio Gervilla R.
[email protected] wrote:> > > if name == ‘main’:> > try:> >
my_top_block().run()> > except KeyboardInterrupt:> > pass> >> > I think
that it is ok and with these lines the program should stop by> > pushing
ENTER but it doesn’t.> > In Python, a KeyboardInterrupt is caused by
Ctrl-C, not by hitting any> key. The above code snippet is acting as it
should.> > If you want the flowgraph to end with an Enter key:> > if
name == ‘main’:> tb.start()> raw_input(“Press Enter to stop.”)>
tb.stop()> tb.wait()> > – > Johnathan C.> Corgan Enterprises LLC>
http://corganenterprises.com/

To clarify, there was one missing line. Here is the snippet again,
with comments:

if name == ‘main’: # Execute if script invoked
as program
tb = my_top_block() # Create an instance
of a custom top block
tb.start() # Start
the flowgraph running in background thread
raw_input(“Press Enter to stop.”) # Wait for user to hit enter
in foreground thread
tb.stop() # Tell
flowgraph to gracefully exit
tb.wait() # Wait for
it to do so


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com/