[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Questions about data type conversion in GRC. (ADC
Re: [Discuss-gnuradio] Questions about data type conversion in GRC. (ADC, encoder)
Fri, 07 Aug 2009 18:19:12 -0500
Thunderbird 188.8.131.52 (Macintosh/20090605)
Milo Wong wrote:
> So, I am going to encode the analog output of audio source(float, -1
> to +1 ??) to digital bit streams(byte) for digital signal Processing
> later on.
What exactly are you trying to accomplish? The samples you get from an
audio source, like any other GNU radio source, have already been
digitized. Are you trying to extract a modulated signal that contains
digital data (i.e. FSK, PSK) from your audio source?
> But I found there's no ADC or encoder in GRC which could properly
> convert float: -1~+1 to Byte: 00~FF. Is there any way to achieve that?
If you're just looking to convert floats to bytes, use either
gr.float_to_char (range -128 to 127) or gr.float_to_uchar (range 0 to
255). However, be aware that you will lose a lot of dynamic range—the
input is converted to a long integer first, then clipped. You will need
to scale your signal by adding 1 and dividing by 2/255 before you