discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] create lookup tables


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] create lookup tables
Date: Sun, 20 Dec 2015 23:06:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Well, first:
Signal Source can't produce 8bit signed integers by itself, so you'll have to convert whatever you configure the signal source for to char, eg. you could set it to "float" and use the "float to char" conversion. Make sure the result has amplitude 127. Properly configure your signal source for the desired sine period, e.g. sample_rate=X , frequency = X/256.

Then, use a "head" block with that period, and pipe the result to a file sink; use the char/byte type of everything. Done. Pretty straightforward, I guess :)

As a side note: that's really a bit of a corner use case; a single line of python would probably be easier:

import numpy
(numpy.sine(numpy.linspace(0,2*numpy.pi,256)) * 127).astype(numpy.int8).tofile("/tmp/sinetable.dat")

in C, that program wouldn't be much longer.

Best regards,
Marcus

On 20.12.2015 22:40, Andreas Ladanyi wrote:
Hi,
 
i want to create a file for example with a sine lookup table. I use a signal source und a file sink. I think about how it is possible to get sine array with a amount of 255 (8 bit) values with 8 bit for each entry.
 
andy


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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