discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] General question concerning usrp & audio


From: Alexandru Csete
Subject: Re: [Discuss-gnuradio] General question concerning usrp & audio
Date: Wed, 22 Sep 2010 01:30:26 +0200

Hi Tom,

The magnitude of a complex sine wave is constant so you can not hear
it. If you want to hear a tone you have to listen to either the real
or the imaginary part, i.e. use complex_to_real or complex_to_float.
You can easily test it by connecting a complex signal source to the
audio sink via complex_to_mag (you wont hear anything) and
complex_to_real/complex_to_imag (you will hear the tone).

In terms of radio complex_to_mag corresponds to a simple AM
demodulator but you don't have any AM modulator on the transmitter
side. If you want to hear a tone with the AM receiver, you have to
send a *real* sine wave through an AM modulator in the transmitter.
Sending a complex tone to the USRP is pretty much the same as an
unmodulated carrier.

For the transmitter, you will have to use interpolation much higher
than 32. The DAC rate is 128 Msps and the max interpolation you can
use is 512 corresponding to 250 ksps (the same exercise as for the
receiver but the other way around).

Alex

On Tue, Sep 21, 2010 at 11:36 PM, Thomas Seidel <address@hidden> wrote:
> Thanks a lot for your help!
>
> file2.py now looks like this:
>
> class soundcheck(gr.top_block):
>
>    def __init__(self):
>      gr.top_block.__init__(self)
>
>      self.decim_rate = 256
>      self.u = usrp.source_c(0, self.decim_rate)
>
>      self.rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
>      self.subdev = usrp.selected_subdev(self.u, self.rx_subdev_spec)
>      self.input_rate = self.u.adc_freq() / self.decim_rate
>
>     res = self.u.tune(0, self.subdev, 13.56e6)
>     if res:
>        print 'frequency successfully changed to 13.56Mhz'
>     else:
>       print 'tuning failed'
>      sys.exit(1)
>
>
>     interp = gru.lcm(self.input_rate, 48000) / self.input_rate
>     decim = gru.lcm(self.input_rate, 48000) / 48000
>     interp = int(interp)
>    decim = int(decim)
>
>    print 'interp = %d, decim = %d' % (interp, decim)
>    rr = blks2.rational_resampler_ccc(interp, decim)
>
>
>    self.sndsink = audio.sink(48000, 'plughw:0,0')
>    self.magblk = gr.complex_to_mag()
>    self.connect(self.u, rr, self.magblk, (self.sndsink, 0))
>
>
> As one can see I added the reational_resampler_ccc(), hoping that it does the 
> magic work needed that I can hear a nice sine wave, but still there is only 
> noise. On the transmitting side a gr.sig_source_c(48000, gr.GR_SIN_WAVE, 
> 4000, 1000) is used with the interpolation of the USRP set to a factor of 32. 
> Maybe I still lack of a proper understanding of the whole issue so that I 
> would really appreciate your help.
>
> Tom
>
> -----Ursprüngliche Nachricht-----
> Von: "Alexandru Csete" <address@hidden>
> Gesendet: Sep 21, 2010 12:32:17 PM
> An: address@hidden
> Betreff: Re: [Discuss-gnuradio] General question concerning usrp & audio
>
>>On Tue, Sep 21, 2010 at 5:09 AM, Thomas Seidel <address@hidden> wrote:
>>> hHey!
>>>
>>> I am just playing around with gnuradio and the usrp stuff and want to 
>>> achieve the following:
>>>
>>> file1.py
>>>
>>> [...]
>>> self.u = usrp.sink_c(0, 64)
>>> self.src gr.sig_source_c(48000, gr.GR_SIN_WAVE, 400, 1)
>>>
>>> self.connect(self.src, self.u)
>>> [...]
>>>
>>> file2.py
>>> [...]
>>>
>>> self.u = usrp.source_c(0, self.decim_rate)
>>>
>>> self.sndsink = audio.sink(48000, 'plughw:0,0')
>>> self.blk = gr.complex_to_mag()
>>> self.connect(self.u, self.blk, (self.sndsink, 0))
>>> [...]
>>>
>>> in words: file1.py should serve as the sender of sine signal with a 
>>> frequency of 400Hz and file2.py should receive this signal and emit it on 
>>> the soundcard. Both excerpts are implemented as a derived class from 
>>> gr.top_block().
>>>
>>> Running usrp_oscope.py, I can see that a sine is transmitted, however i can 
>>> not here anything than noise(?). Actually I would have expected something 
>>> like the output of dial_tone.py. Can somebody tell me why I am wrong and 
>>> don't receive what i expect.
>>>
>>
>>One of the problems is that you connect the USRP to the audio sink
>>without any downsampling. Even with max decimation, 256, the USRP will
>>generate 250 ksps while your audio sink expects only 48 ksps. If you
>>look at the receiver examples you'll see that all of them use a
>>channel filter (usually low pass) which also does some downsampling.
>>By the way, using a channel filter in a receiver is generally a good
>>idea ;-)
>>
>>Other problems could be receiver settings (gain, frequency, antenna
>>selection, etc.).
>>
>>Alex
>>
>>_______________________________________________
>>Discuss-gnuradio mailing list
>>address@hidden
>>http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> ___________________________________________________________
> GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
> Jetzt kostenlose Movie-FLAT freischalten! http://movieflat.web.de
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]