discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Question about Double / Float values in GRC


From: Tom Hendrick
Subject: [Discuss-gnuradio] Question about Double / Float values in GRC
Date: Sun, 13 Mar 2011 23:59:16 -0700 (PDT)

Hello All

I have a basic/beginner question.

I am using mkfifo to pipe output from a C++ application to a GRC script using a named pipe.

I'm using C++ code that another student wrote and I am not too keen on making difficult changes to it.  In mode 1, it outputs a waveform in double values in the range of +1 and -1 (just like a .WAV file but with no header).  In mode 2, an auxiliary function converts from doubles to shorts in the range of -32768 to 32767.

I can get mode 2 to work with my GRC script by reading the file as short, then converting to float so that I can apply resampling and the feed it to the USRP (the resampling function won't work with shorts).  This works great and I see the  proper waveform output on the USRP, but it seems awkward to convert from double to short in C++, then short to float in GRC.

Next I tried with mode 1 with doubles.  In my GRC script I read the file in as float, and then I multiply by (2^15)-1 since the doubles range is from +1 to -1.  I get output from the USRP using this, but the waveform doesn't look right at all.

Is it even possible to read a file with double values using a GRC generated script and the gr_file_source block?  Or is there something else I am doing wrong?

Thanks...Tom



reply via email to

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