I am trying to make a custo wave through an OOT python module. I am very new to DSP and GNU Radio. I decided to replicate the Sine wave from Signal source block. I seem to get no output. My code is as follows:
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 sourya. # # SPDX-License-Identifier: GPL-3.0-or-later # 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, phase=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 self.phase = 0 def work(self, input_items, output_items): #out = output_items[0] t = np.arange(0, len(output_items[0]), len(output_items[0])/self.sample_rate) s = np.sin(2*np.pi*self.freq*t + self.phase) self.phase += 2 * np.pi * self.freq / self.sample_rate # <+signal processing here+> output_items[0][:] = s return len(output_items[0]) Last time I made some mistakes which I have corrected in this code. I am not sure about what the phase part will be and what value it will be updated to. Also, detailed help about this will really be appreciated since I am very new to this field and Mailing lists doesnt simply allow to get back to the solution provider in form of a reply like a forum does.