patch-gnuradio
[Top][All Lists]
Advanced

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

[Patch-gnuradio] Updated dialtone_v.py for showing vector addition


From: Johnathan Corgan
Subject: [Patch-gnuradio] Updated dialtone_v.py for showing vector addition
Date: Wed, 14 Jun 2006 21:15:34 -0700
User-agent: Thunderbird 1.5.0.2 (X11/20060522)

Goes with prior gr_add_const_vXX patch.
Index: python/audio/dialtone_v.py
===================================================================
RCS file: /sources/gnuradio/gnuradio-examples/python/audio/dialtone_v.py,v
retrieving revision 1.2
diff -u -r1.2 dialtone_v.py
--- python/audio/dialtone_v.py  13 Jun 2006 16:32:53 -0000      1.2
+++ python/audio/dialtone_v.py  15 Jun 2006 04:11:05 -0000
@@ -2,6 +2,12 @@
 
 from gnuradio import gr, audio
 
+"""
+This test script demonstrates the use of element-wise vector processing
+vs. stream processing.  The example is artificial in that the stream
+version in dial_tone.py is the easier way to do it.
+"""
+
 # For testing different buffer sizes
 size = 1024
 rate = 48000
@@ -20,12 +26,15 @@
 adder = gr.add_vff(size)
 
 # Make a 1 Hz sine envelope
-envelope = gr.sig_source_f(rate, gr.GR_SIN_WAVE, 1, 0.5, 0.5);
+envelope = gr.sig_source_f(rate, gr.GR_SIN_WAVE, 1, 0.5, 0.0);
 envelopev = gr.stream_to_vector(gr.sizeof_float, size)
 
 # Make a mixer to apply the envelope
 mixer = gr.multiply_vff(size)
 
+# Make an offset adder
+offset = gr.add_const_vff((0.5,)*size)
+
 # Turn the vector back into a stream of floats
 result = gr.vector_to_stream(gr.sizeof_float, size)
 
@@ -39,7 +48,7 @@
 fg.connect(adder, (mixer, 0))
 fg.connect(envelope, envelopev)
 fg.connect(envelopev, (mixer, 1))
-fg.connect(mixer, result)
+fg.connect(mixer, offset, result)
 fg.connect(result, sink)
 
 try:

reply via email to

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