Re: Questions about data type conversion in GRC. (ADC, encoder)

Hi Colin,

Thank you for your reply! What I am going to design is to separate the
float
output from audio source into several branches for later 8b/10 encoding
on
each branch. So before encoding, I was wondering if the data after
“stream
to streams” is already byte type (or in bits) .

As you said “The samples from an audio source as well as other GNU radio
source, have already been digitized”, is that means I could directly
apply
any bits operation (like an 8b/10b encoding) on the output samples from
audio source or from output of “stream to streams” block?

To test the result, I put a couple of file sinks after audio source and
“stream to streams” conversion block(all I/O ports are float type), but
the
data I gathered in the file are hex. Even though I got the digitized
data as
I want, I am quite confused about the reason for that. I’ll appreciate
your
explanation.

Thank you,

Milo

Hi all,
Hope you guys had a great weekend. I have a question about the data type
between gnuradio blocks.
1)I used “stream to streams” block in GRC to de-multiplex the output of
audio source which type is float and drops in the range of (-1,+1), I
was
wondering what is the type of data after “stream to
streams”(de-multiplex)?
In my flow graph, all of the I/O type of blocks in GRC are float,
however,
if I put the data streams into file sinks which input type is also
float,
the data I gathered are hex. Why? I used “Bless” hex editor software to
open
the file. Is that means the “bless” helped me with the type converting?
2) I do need the the bits(or byte) data after demultiplexing for later
digital signal processing, but there’s no ADC in GRC which could help me
with converting the float data between (-1,+1) to bits (byte). How could
I
achieve this conversion?
3) BTW, what is the difference between “stream to streams” and
“de-interleave” blocks. It seems that they have the same outputs.
Thank you very much!
Milo


Message: 20
Date: Fri, 07 Aug 2009 18:19:12 -0500
From: Colin S. [email protected]
Subject: Re: [Discuss-gnuradio] Questions about data type conversion
in GRC. (ADC, encoder)
To: [email protected]
Message-ID: [email protected]
Content-Type: text/plain; charset=UTF-8

Milo W. 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
convert it.

You