Complex to bits

Hi everyone.
Thanks for all the replies on my previous thread. I did some tests and
found out that the FFT and IFFT do not add noise to my audio signal. It
works perfectly! The noise is coming from another part of my flowgraph.
Before I introduced the FFT and IFFT, I was working with an audio signal
that was scaled and converted to int, so it could be unpacked into bits;
those bits were processed and retrieved, packed, converted to float,
descaled and turned back to audio. There was no noise then. Adding the
FFT and IFFT made me use the complex type before the unpacking, so what
I was using to make it possible to unpack the signal into bits no longer
worked properly.
I tried changing the scale constant, converting from complex to IShort
and unpacking that, but neither worked.
So, my question is: how do I unpack a complex signal into bits, and then
pack it back? Considering I’m working on a audio signal that shouldn’t
get noise added to it.
Thanks in advance.

I just realized that float to bits is also acceptable, as long as the
samples don’t lose precision.
I didn’t tacked this by scaling the samples then converting to int
because I don’t know what is the range of values for the outputs of the
FFT and IFFT blocks.

From: [email protected]
To: [email protected]
Subject: Complex to bits
Date: Sat, 19 Oct 2013 10:11:33 -0300

Hi everyone.
Thanks for all the replies on my previous thread. I did some tests and
found out that the FFT and IFFT do not add noise to my audio signal. It
works perfectly! The noise is coming from another part of my flowgraph.
Before I introduced the FFT and IFFT, I was working with an audio signal
that was scaled and converted to int, so it could be unpacked into bits;
those bits were processed and retrieved, packed, converted to float,
descaled and turned back to audio. There was no noise then. Adding the
FFT and IFFT made me use the complex type before the unpacking, so what
I was using to make it possible to unpack the signal into bits no longer
worked properly.
I tried changing the scale constant, converting from complex to IShort
and unpacking that, but neither worked.
So, my question is: how do I unpack a complex signal into bits, and then
pack it back? Considering I’m working on a audio signal that shouldn’t
get noise added to it.
Thanks in advance.

Yesterday, during the night, I tried my luck on the #gnuradio IRC
channel. One was kind enough to point me in the right
direction. Up to this point I had no idea I could connect ports of
different types. So, starting from the FFT’s output, I connected that to
a complex Vector to Stream, as one would do normally, then I connected
that to a byte Vector to Stream (1, gr.sizeof_gr_complex (which is 8)),
then I connected that to a byte Vector to Stream (gr.sizeof_gr_complex,
1), then I had a byte stream which I could safely unpack and pack and
get the bits to work with.
Thanks for all the help.

HI Gui,
why did you connect to two byte vector to stream blocks. Is it
like one for the real part and one for the imaginary part?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs