Sound recording from multiple opened browse windows for diversity reception?

2»

Comments

  • Hi, John. I've had some problems with your patch (jks-v0.1): For some SDR devices, I get this run time error: "IndexError, tuple index out of range " at "kiwiclient.py", line 238. That line is "samples = [ complex(data[i+0], data[i+1]) for i in xrange(0, count, 2) ]
    ".

    The particular SDR that gave this response is (but not limited to this one): "szsdr.ddns.net:8073". Can you take a look in your spare time? Thanks!
  • jksjks
    edited November 2017
    Sorry about that. My kiwiclient jks-v0.1 only works with Kiwis that have been updated to v1.151 that has the new GPS timestamps in the IQ stream. I just tried it with the Shenzhen Kiwi and it worked (he's running v1.151 now)

  • edited November 2017
    John,
    Since the 151 update, the older version of Kiwirecorder.py fails with the below listed run.

    ron@linux-4cdz:~> python ~/kiwiclient-jks-v0.1/kiwirecorder.py -s southwest.ddns.net -p 8073 -f 3955.00 -m iq -L -5000 -H 5000
    client_public_ip: 67.215.36.150
    rx_chans: 4
    chan_no_pwd: 0
    badp: 0
    version_maj: 1
    version_min: 151
    load_cfg: %7b%22inactivity_timeout_mins%22%3a60,%22status_msg%22%3a%22%253Cp%2520style%253D%2522color%253Aorange%253B%2522%253E%253Cb%253EPrivate%2520SDR%253C%252Fb%253E%253C%252Fp%253E%22,%22index_html_params%22%3a%7b%22HTML_HEAD%22%3a%22%22,%22RX_PHOTO_LEFT_MARGIN%22%3atrue,%22PAGE_TITLE%22%3a%22KiwiSDR%22,%22RX_PHOTO_FILE%22%3a%22kiwi.config%252Fphoto.upload%22,%22RX_PHOTO_HEIGHT%22%3a%22350%22,%22RX_PHOTO_TITLE%22%3a%22%22,%22RX_PHOTO_DESC%22%3a%22SDR%25202%22,%22RX_TITLE%22%3a%22KiwiSDR%25202%2520G8JNJ%2520-snip..
    snip..
    32606392019998,%22DC_offset_Q%22%3a-0.019903617561579996,%22clk_adj%22%3a0,%22sdr_hu_dom_sel%22%3a0,%22sdr_hu_dom_name%22%3a%22southwest.ddns.net%22,%22sdr_hu_dom_ip%22%3a%22%22,%22freq_offset%22%3a0,%22sdr_hu_lo_kHz%22%3a0,%22sdr_hu_hi_kHz%22%3a30000,%22ip_limit_mins%22%3a0,%22tlimit_exempt_pwd%22%3a%22%22%7d
    center_freq: 15000000
    bandwidth: 30000000
    adc_clk_nom: 66666600
    audio_init: 0
    audio_rate: 12000
    sample_rate: 12001.110
    Traceback (most recent call last):
      File "/home/ron/kiwiclient-jks-v0.1/kiwirecorder.py", line 174, in main
        recorder.run()
      File "/home/ron/kiwiclient-jks-v0.1/kiwiclient.py", line 266, in run
        self._process_ws_message(received)
      File "/home/ron/kiwiclient-jks-v0.1/kiwiclient.py", line 146, in _process_ws_message
        self._process_message(tag, body)
      File "/home/ron/kiwiclient-jks-v0.1/kiwiclient.py", line 219, in _process_message
        self._process_aud(body)
      File "/home/ron/kiwiclient-jks-v0.1/kiwiclient.py", line 238, in _process_aud
        samples = [ complex(data[i+0], data[i+1]) for i in xrange(0, count, 2) ]
    IndexError: tuple index out of range
    ron@linux-4cdz:~>

    The new version found at https://github.com/jks-prv/kiwiclient produces an audio wav file but it produces a continuous stream in the terminal of this type of line:
    Block: 00000396, RSSI: -67 
    _write_samples ({'last_gps_solution': 2, 'dummy': 0, 'gpsnsec': 801642646, 'gpssec': 589495},)

    This probably doesn't do anything but print, but could it print to null output or something? 
    I know you are working toward something better...
    Ron
    KA7U
  • jksjks
    edited November 2017
    You can't run the old kiwirecorder with v1.151 Use the current one. And you can't use the latest one from my branch on Kiwis running earlier than v1.151 See the comments above. I haven't tested the latest one with the GPS timestamp support with DRM -- and there are no DRM transmissions on right now..

    KA7U
  • 3965 came back on and I tested the latest kiwirecorder using southwest.ddns.net:8073 which is running v1.151 Dream worked fine for me using data played back from the recorded file.

  • John,
    I think it will record DRM. It records AM OK and I did get a partial on a weak DRM signal to record. 

    I am very curious to see what comes of the GPS time stamp.
    Ron
    KA7U
  • Make sure your fork is updated. Things are changing quickly. I just took out those extra prints that had been left in.

    KA7U
  • John,
    I updated from that fix but it still makes a busy terminal. This fixes it though.
    python ~/kiwiclient/kiwirecorder.py -s fenu-radio.ddns.net -p 8073 -f 3965.00 -m iq -L -5000 -H 5000 >null &

    It dumps the print and places the python in the background, returning use of the terminal in the foreground. You are causing me to think about bash. Hi Hi
    Ron
    KA7U
  • Please bear with my stupidity: I try to record 2 IQ streams from 2 kiwi Servers in this fashion:
    while True:
    recorder = KiwiRecorder(options)
    options.server_host = options.server_host2 # second server
    options.server_port = options.server_port2
    recorder2 = KiwiRecorder(options)

    # Connect
    try:
    recorder.connect(options.server_host, options.server_port)
    recorder2.connect(options.server_host, options.server_port)

    except KeyboardInterrupt:
    break
    except:
    print "Failed to connect, sleeping and reconnecting"
    time.sleep(15)
    continue
    # Record
    try:
    run(recorder, recorder2)
    break
    .....

    def run(rec1, rec2):
    """Run the client."""
    try:
    rec1._set_auth('kiwi', '')
    rec2._set_auth('kiwi', '')

    print "enter run"
    # Loop forever
    while True:
    try:
    received = rec1._stream.receive_message()
    rec1._process_ws_message(received)

    received2 = rec2._stream.receive_message()
    rec2._process_ws_message(received2)

    except KeyboardInterrupt:
    break
    rec1._stream.close_connection()
    rec2._stream.close_connection()

    finally:
    rec1._socket.close()
    rec2._socket.close()

    And I DO get 2 files, but it turn out that both are the IQ data from ONLY the 2nd connection. I'm really at my wit's end, and I really don't want to use multi-threading here. Anyone can give my a clue/hint? Thanks!

    zfyoung
  • I think you are programming in Python and I'm not sure how your variables are all assigned, but this looks suspect to me.
    options.server_host = options.server_host2 # second server

    and then you do:
    recorder.connect(options.server_host, options.server_port)
    recorder2.connect(options.server_host, options.server_port)

    So it would seem that both recorders get the audio stream from the same server?

    When you get this working, it would be interesting to see what you come up with and how you use it.
    Ron
    KA7U
  • jksjks
    edited November 2017
    Okay, please try my latest jks-v0.1 branch. A lots of changes were necessary for two server recording to work. Look at the new Makefile to see an example of the command arguments I added.

  • John,
    I think I have the newest commits from jks-v0.1... and I'm getting this result.

    ron@linux-4cdz:~> python ~/kiwiclient/kiwirecorder.py -s ka7u.no-ip.org -p 8073  -f 670 -s --s2 ka7u.no-ip.org -p 8074 -m iq -L -5000 -H 5000
    Failed to connect, sleeping and reconnecting
    Failed to connect, sleeping and reconnecting
    Failed to connect, sleeping and reconnecting
    ^CTraceback (most recent call last):
      File "/home/ron/kiwiclient/kiwirecorder.py", line 217, in <module>
        main()
      File "/home/ron/kiwiclient/kiwirecorder.py", line 199, in main
        time.sleep(15)
    KeyboardInterrupt
    ron@linux-4cdz:~> python ~/kiwiclient/kiwirecorder.py -s ka7u.no-ip.org -p 8073  -f 670 -s --s2 ka7u.no-ip.org -p 8074 -m iq -L -5000 -H 5000
    Failed to connect, sleeping and reconnecting
    Failed to connect, sleeping and reconnecting
    Failed to connect, sleeping and reconnecting
    ^CTraceback (most recent call last):
      File "/home/ron/kiwiclient/kiwirecorder.py", line 217, in <module>
        main()
      File "/home/ron/kiwiclient/kiwirecorder.py", line 199, in main
        time.sleep(15)
    KeyboardInterrupt
    ron@linux-4cdz:~> 

    Ron - KA7U
  • jksjks
    edited November 2017
    Check those flags. You're using -s a second time when I think you meant to say -2 and using -p a second time instead of -p2. Use "make help" as a shortcut to see the "--help" info.

  • Updated to the latest kjs-v0.1, and get this screen output. Also ONLY one file is generated, even I intentionally use 2 distinct frequencies.

    D:\My Documents\Downloads\kiwiclient-jks-v0.1>python kiw
    irecorder.py -s hallmann.selfhost.eu -p 80 -2 --s2 222.7.151.84 --p2 8073 -f 39
    65 -f2 5965 -m iq -L -5000 -H 5000
    client_public_ip: 111.58.242.19
    client_public_ip: 111.58.242.19
    rx_chans: 4
    rx_chans: 4
    chan_no_pwd: 0
    chan_no_pwd: 0
    badp: 0
    badp: 0
    version_maj: 1
    version_min: 151
    version_maj: 1
    version_min: 151
    load_cfg: (cfg info not printed)
    load_cfg: (cfg info not printed)
    center_freq: 15000000
    bandwidth: 30000000
    adc_clk_nom: 66666600
    center_freq: 15000000
    bandwidth: 30000000
    adc_clk_nom: 66666600
    audio_init: 0
    audio_rate: 12000
    sample_rate: 12001.062
    audio_init: 0
    audio_rate: 12000
    sample_rate: 12001.123

    Started a new file: 20171128T011642Z_2000_iq.wav

    Started a new file: 20171128T011642Z_2000_iq.wav
    ^C

    zfyoung
  • My bad! I missed the "--f2" typo. This time around it seems works, Thanks. I'll let you know if something is not right.
  • You needed to say "--f2" instead of "-f2" ("-f2" is interpreted as "--f 2" by the OptionParser module I think)

    But it incorrectly uses the same filename when only a single frequency is specified. So my latest branch now appends "_serverN" (N=0,1) to the filename. Please give that a try.

  • Hi, John. When 2 servers are on the same frequency, It only generates one single file. Is this your intention? I'm a little baffled by the inconsistent behavior.
  • jksjks
    edited November 2017
    My latest push should generate two files with different names even if the frequency is the same, e.g.

    -rw-r--r--   1 jks  staff   2.1M Nov 28 14:43 20171128T014216Z_4567000_iq_server0.wav

    -rw-r--r--   1 jks  staff   2.1M Nov 28 14:43 20171128T014216Z_4567000_iq_server1.wav


  • John,
    Hey it works!  Now to figure out what to do with it and why I need it... Very cool though.
    ron@linux-4cdz:~/kiwiclient> make
    python kiwirecorder.py -2 --s1=ka7u.no-ip.org --p1 8074 --f1=580.0 --station=KIDO --s2 ka7u.no-ip.org  --p2 8073 --f2=670.0 --station2=KBOI -m iq -L -5000 -H 5000
    client_public_ip: 67.215.36.150
    client_public_ip: 67.215.36.150
    rx_chans: 4
    rx_chans: 4
    chan_no_pwd: 3
    chan_no_pwd: 3
    badp: 0
    badp: 0
    version_maj: 1
    version_min: 151
    version_maj: 1
    version_min: 151
    load_cfg: (cfg info not printed)
    load_cfg: (cfg info not printed)
    center_freq: 15000000
    bandwidth: 30000000
    adc_clk_nom: 66666600
    center_freq: 15000000
    bandwidth: 30000000
    adc_clk_nom: 66666600
    audio_init: 1
    audio_rate: 12000
    sample_rate: 12001.084
    audio_init: 1
    audio_rate: 12000
    sample_rate: 12001.108

    Started a new file: 20171128T154826Z_580000_iq_KIDO_server0.wav

    Started a new file: 20171128T154826Z_670000_iq_KBOI_server1.wav
    Makefile:35: recipe for target 'two' failed
    make: *** [two] Killed
    ron@linux-4cdz:~/kiwiclient> ls -lt *.wav
    -rw-r--r-- 1 ron users 1560620 Nov 28 08:48 20171128T154826Z_580000_iq_KIDO_server0.wav
    -rw-r--r-- 1 ron users 1560620 Nov 28 08:48 20171128T154826Z_670000_iq_KBOI_server1.wav
    ron@linux-4cdz:~/kiwiclient> make clean
    rm -f *.log *.wav *.png
    ron@linux-4cdz:~/kiwiclient> 

    Ron - KA7U
  • jksjks
    edited November 2017
    When you include the --kiwi-wav flag the GPS timestamps will also be added to the files when recording in IQ mode. This will allow post-processing the data for the very interesting projects now ongoing: Christoph's HFDF work and zfyoung's diversity reception.

    There is code in the repository (proc.m, read_kiwi_iq_wav.cc) for Octave (Matlab) to read the files and create various plots. I haven't tried this myself but see the Github GPS timestamp issue (https://github.com/jks-prv/Beagle_SDR_GPS/issues/130#issuecomment-346085747) for examples.

    KA7U
  • See the latest commits here
    https://github.com/hcab14/kiwiclient
    which allow recoding data streams from an arbitrary number of servers.

    To record 4 data stream from my local KiwiSDR at 30,80,100,200 kHz with manual AGC gains I use







    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
    span.s1 {font-variant-ligatures: no-common-ligatures}

    python kiwirecorder.py -s kiwisdr.local,kiwisdr.local,kiwisdr.local,kiwisdr.local -f 30,80,100,200 -m iq -L -5900 -H 5900 -w -g 30,35,40,45 



    The number of servers determines the number of data streams. Other options (port, frequency, station name, agc setting) can be comma separated lists where a value at a given position refers to the server at the same position.


    Let me know if this is useful and I will make a pull request.



  • jksjks
    edited December 2017
    I like this much better than the hack I did for a second server. Yes, please make a pull request or I can merge your changes into my branch.

  • Done. Thanks.

Sign In or Register to comment.