|
From: | Sourya Saha |
Subject: | Creating a wave in OOT modules |
Date: | Sat, 9 Mar 2024 10:14:53 -0500 |
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])[Prev in Thread] | Current Thread | [Next in Thread] |