Realtime frequency/mode change via the jks-prv/kiwiclient library?

Is there some documentation on how a monitored frequency can be changed via this library?

Regards Olaf - LA3RK

Comments

  • look at the --help on kiwirecorder.py
  • --help on kiwirecorder.py only states that -f option includes frequency. I am looking for the possibility to tune the kiwi according to eg rig setting, ie an effective 2nd receiver. There must be some way of changing the frequency once a channel to a kiwi has been opened. I want to have a background program reading rig info and sending the audio out from the pc.
    There is something called catsync which apparently can do this, but does only run in windows and not on linux.
    Another option is to open a 10 kHz IQ channel and process locally, but this uses extra bandwidth and once a retune out of the 10 kHz window is done, a retune would be needed.

    73 de Olaf - LA3RK
  • did you try running catsync in wine?
  • I tried it under wine, was having issues seeing mono, admitedly I only tried over lunch but couldn't see what was failing.
    Had to do "winetricks vcrun2013" to get the right C++ version and installed wine complete etc.

    I thought I'd get it going then list steps but ran out of lunch and motivation (all remote, no rig to test if I had got it running).
  • I have the kiwiclient library running fine, but it is stuck on one frequency once started.
    The question is how can the rx be retuned/reset within through that library.
    Using catsync via wine on linux is not a good solution. Amongst other catsync relies on a rig control solution which does not run under linux and accessing serial ports or usb ports via wine complicates matter further. Wine is best suited for simpler apps screen/mouse/keyboard only. Linux apps normally use rigctld (hamlib) for rigcontrol or to read rigsettings.
  • kiwiclient.py is not library code. It is a command line program/script. By looking at how it works you can decipher the KiwiSDR web socket based API and code whatever custom solution you want.
  • Yes, understood. I am struggling to understand the code, but have come as far as seeing the underlying commands going to the kiwi. Is the KiwiSDR web socket documented somewhere? Would be easier than deciphering the debug output from kiwiclient.py.

    PS I may be using the term library incorrectly, not a programmer by trade.

    73 de Olaf - LA3RK
  • The Kiwi API is not documented. It was never intended to be used by anything other than the Kiwi browser interface. But of course that didn't stop Dmitry from writing kiwiclient which we all use now to do many useful things.

    The control commands sent to the Kiwi are very simple (e.g. set frequency, mode etc.) and you should be able to see what's being done just by inspection of the code. The real problem comes with how to deal with network and audio interfacing for the particular OS and programming language/environment you're working with. Kiwiclient is relatively straightforward because being written in Python it can just use the Python web socket library Also, it only records audio and waterfall data to files. If you want to do realtime audio output that's a whole new level of complexity and pain.
  • I am playing with something related.... kiwi_nc.py playing to live audio a lightweight simple player
  • Jim, let me know if you get kiwi_nc working. I got it running to the point of producing output but haven't tested it beyond that.

    For Mac people, I just found this work by Chris yesterday: https://www.blackcatsystems.com/software/kiwiSdr-sound-client-virtual-audio-device.html
    ChrisSmolinski
  • kiwisound.py, seems to be a rewrite of kiwirecorder.py, ref info from jks. I get sound output in realtime by using kiwisound.py on my windows 10 machine from my kiwisdr on my local net. Have so far not tried other kiwis, but would assume it would work nicely.
    But I have to find out how to retune in real time, currently rx frequency is input on commandline and can not be changed when running.
    Program was found on adress: https://www.blackcatsystems.com/software/kiwiSdr-sound-client-virtual-audio-device.html and was originally written for mac as indicated by jks.
    Since python also works nicely on linux, I would assume that I can get it kiwisound.py also to work on one of my linux computers.
    Another matter is that it seems that requested frequency on lsb is off compared to the kiwisdr web interface as I do not hear the same signal. Have not had time to track this issue further.

    73 de Olaf - LA3RK
  • John,

    kiwi_nc doesn't seem to output a wav format like kiwirecorder, what is the format?
  • Jim, kiwi_nc doesn't do any wav file formatting. You should just be seeing a stream of 16-bit integer audio samples (mono, 1 channel for all but IQ mode) at the 12 or 20.25 kHz sample rate (unless --resample is in effect). In IQ mode you get a stream of I and Q samples interleaved (essentially stereo, 2 channel).
  • For your daily dose of despair and frustration just type into Google: "python non-blocking keyboard input"
  • edited April 2019
    John, I had sort of assumed the audio format you suggested but didn't have luck with that. Got audio but not usable. kiwi_nc lacks --resample. I assume you were referring to that link you posted
  • edited April 2019
    this worked ./kiwi_nc.py -s [myip] -p [myport] -f 3330 -m am | aplay -t raw -c 1 -r 12000 -f S16_LE
  • jksjks
    edited April 2019
    Okay, so "aplay" is an ALSA/Linux thing. Glad it worked. Yes, kiwi_nc currently lacks --resample.

    I didn't quite realize that kiwisound.py is able to play to an output device in addition to VACs if the output device appears in the list returned from "python -m sounddevice". That is useful.
  • I now have a version which can change the rx frequency with the audio running. Was not to difficult once I understood the code. Will try to clean up the code and introduce some software (eg hamlib) to make it possible to tune via the radio, ie keeping the kiwisdr in sync with the radio rx frequency.

    Thanks for all help.

    73 de Olaf - LA3RK
  • I was eventually going to mention my virtual audio device client, jks, when I thought the code wasn't quite so ugly :)

    I think it should work on any platform? Although I have not tested it on anything other than my Mac. I wrote it specifically to scratch an itch, I wanted to be able to decode SSTV, fax, etc from my Kiwi without using a browser and messing around with rerouting its audio. One thing I'd like to fix is how the sound device is specified, I'd rather do it by name than index since the devices can move around. The problem is it "mostly works" this way so I am too lazy to fix it.
  • Chris, I'm not a Python person, so I didn't even know about the sounddevice library. I think the way it works is fine. Very similar to the command line syntax for Dream (i.e. using a number to choose the sound in/out device).

    I just read that sounddevice is a wrapper for PortAudio and the later claims to be portable across platforms. But I know even less about that stuff than I do about Python.
  • If you want to use kiwisound.py with a current version of kiwiclient, it needs a line added to the sourcecode to disable the S_meter support that will crash it..

    Add the following somewhere around line 33 in kiwisound.py:

    options.S_meter = False

    (with proper indention)

    It works well in Linux to port audio over directly to fldigi/JS8call/WXJT-X - just add a dummy ALSA device.
  • Thanks for letting me know about the change required, jeffreycentex. I just updated the code on my site.
  • @la3rk

    Olaf any further progress on your Kiwi API modification that allows frequency change with audio running ?

    bregards, Ben
Sign In or Register to comment.