discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Wish list: file seek


From: cswiger
Subject: [Discuss-gnuradio] Wish list: file seek
Date: Mon, 31 Jan 2005 16:15:07 -0500 (EST)

Our function   gr.file_source()    does not appear to have any
seek ability - this would be a nice feature to have for recording
and playing back long time periods. AFAICT it starts at the beginning
plays a file once or repeats in a loop. Being able to seek to a
specific block sure would allow finer control over playback, as it
is you just have to wait.


For general tuning around exploring, I just added this code to
$PYTHONPATH:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892/index_txt

Call it keyrd.py and you can >>>import keyrd then use keyrd.getch()
to read individual key presses.

Then this code will, while playing a file, seek up/down freq using
j & k, and set volume louder/softer using l & s.


import keyrd

def build_graph () :

        fg = gr.flow_graph ()

# set frequency
        xlate = gr.freq_xlating_fir_filter_fcf ( stuff )

# set volume
        scale = gr.multiply_const_ff (.5)

        return fg, xlate, scale

def main ():

    freq = 3900e3  # initial settings
    scale = .5
    fg = build_graph (freq)

    fg[0].start ()
    while 1:
       key = keyio.getch()
       if key=='j':
         freq=freq-500
         fg[1].set_center_freq(3.8e6 - freq + 2.5e3)
         print "listening to", freq
       if key=='k':
         freq=freq+500
         fg[1].set_center_freq(3.8e6 - freq + 2.5e3)
         print "listening to", freq
       if key=='l':
         scale=scale+.1
         fg[2].set_k(scale)
         print "volume", scale
       if key=='s':
         scale=scale-.1
         fg[2].set_k(scale)
         print "volume", scale



Then you can tune up/down and adjust the volume while playing. Only
thing we can't do is go back and forward in time ;)

--Chuck





reply via email to

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