discuss-gnuradio
[Top][All Lists]
Advanced

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

Creating a wave in OOT modules


From: Sourya Saha
Subject: Creating a wave in OOT modules
Date: Sat, 9 Mar 2024 10:14:53 -0500

Hi.
I am trying to create a custom wave through an OOT module. To do that, I tried replicating the sine wave of the signal source block. I have used the following Python code:

import numpy as np

from gnuradio import gr


class sine(gr.sync_block):

"""

docstring for block sine

"""

def __init__(self, sample_rate, duration=1000, freq=0):

     gr.sync_block.__init__(self,

         name="sine",

         in_sig=None,

         out_sig=[np.float32, ])

     self.sample_rate = sample_rate

     self.duration = duration

     self.freq = 0



def work(self, input_items, output_items):

     #out = output_items[0]

     

     t = np.arange(0, self.duration, 1/self.sample_rate)

     

     s = np.sin(2*np.pi*self.freq*t)

     

     # <+signal processing here+>

     output_items[0] = s

     return 1 #len(output_items[0])





However, I do not get any output from the output line. Could you suggest what could have gone wrong?

reply via email to

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