Hamlib and rigctl

Hamlib provides a linux command-line API for amateur radios.

Hamlib_design

Installation

On Mac OS you can install using Mac Ports:

sudo port install hamlib

Usage

Get a list of “rig numbers” for supported radios:

rigctl -l

Find available serial ports:

ls /dev/tty.*

Set the frequency to 7.2 MHz and mode to LSB on a Tentec Eagle transceiver:

rigctl -m 1608 -r /dev/tty.usbmodem14531 -s 57600 F 7200000 M LSB 0

Use a rigctl command with no commands at the end to start an interactive command shell.

Network control with TCP/IP

First start the daemon. It uses port 4532 by default, but here we are setting it explicitly:

rigctld -m 1608 -r /dev/tty.usbmodem14531 -s 57600 -t 4532 &

Then in another window, send commands to the daemon using netcat. For set example, to set the frequency to 14.247:

echo ‘F 14247000’ | nc -w 1 localhost 4532

Max/MSP

Note: [mxj tcpClient] no longer functions in Max8 (1/25/2021)

This patch uses the mxj tcpClient object from https://cycling74.com/toolbox/tcpclient/#.Vnj_fpMrKuU by Arvid Tomayko to communicate with rigctld over TCP/IP. The patch below is a modified help file that connected to the radio using rigctld as configured above.

Screen Shot 2015-12-22 at 2.47.10 AM

Notes on grig and rpc.rigd

grig is a graphical rig front end for hamlib by Alex Csete. rpc.rigd is a daemon that allows multiple clients. I was able to get both of them sort of working together (use -m 1901 from grig) but the daemon starts streaming error messages “read_string timeout without reading a character”. Also the latency with grig over the LAN is high. Its possible that there are problems with the rig CAT file. I am using the file for the Tentec Orion – as I haven’t figured out how to add new devices. At any rate, the above methods (UDP or TCP command line) are way more responsive.

References:

 

Writing Jitter external objects

Not as easy as it looks.

Screen Shot 2015-04-24 at 12.48.55 AM

Getting started

First, think of a way to get the same results without writing an external. For example, borrow other code, use javascript, gen, Processing, or MSPaint.

Apparently that didn’t work out. Well I can only get you so far.

Assuming that you have already done the following

Learn how to write non-Jitter externals:

Edit the examples

Currently the Jitter examples in the SDK are in the folders: examples/matrix and examples/gl. We’ll pretend we didn’t see GL.

Here’s a sensible approach on Mac OS.

  • Duplicate the example folder: jit.clip and rename the duplicate to something like jit.cliptz
  • Inside jit.cliptz open the Xcode project
  • Rename the Xcode project while in Xcode by single-clicking on the project name and editing it.
  • Now feel free to alter the code in any way. Look in jit.clip.c

In jit.clip.c, find the functions starting with

void jit_clip_vector_char(long n, t_jit_clip_vecdata *vecdata, t_jit_op_info *in, t_jit_op_info *out)

These are functions that processing the matrix vectors for char, long, and float matrixes respectively. We’ll work with the char function.

Change the code so that the pixel values are inverted as well as clipped by subtracting pixel values from 255.

Change two lines of code, marked here by the comment: // invert

	if ((is==1)&&(os==1)) {
		++n;--op;--ip;
		while (--n) {
			tmp =  *++ip;
			*++op = 255 - tmp>max?max:tmp<min?min:tmp; // invert
		}		
	} else {
		while (n--) {
			tmp =  *ip;
			*op = 255 - tmp>max?max:tmp<min?min:tmp; // invert
			ip+=is;op+=os;
		}
	}

 

  •  Clean and build the project.
  • The .mxo file will be under the Products folder. <Ctrl> click to show in finder
  • Copy the .mxo file into the same folder as your Max patch
  • What Max patch? This one:

Screen Shot 2015-04-24 at 12.38.14 AM

The window on the left is inverted because its getting that way in the object we just hacked.

That’s all

I didn’t really explain anything. Sometimes going through the motions is a start. If I had to do this for a living I would find the example that is most like a desired result and hack away.

Download

https://github.com/tkzic/max-projects

folder: jitter-dev

files:

  • test-object.maxpat
  • jit.cliptz.mxo (external) you will make your own version of this in Xcode

 

Soft66lc FTDI driver issues in Mac Os

Notes: Since Mavericks, the Soft66lc SDR external has not been working in Max. Although I was not able to update the external, there is a temporary workaround.

Mac OS is hijacking the FTDI USB device with its own driver. You can unload the driver from terminal:

sudo kextunload -bundle com.apple.driver.AppleUSBFTDI

To reload the driver use “kextload”.

Here is  article from Sparkfun with details about this workaround: https://learn.sparkfun.com/tutorials/how-to-install-ftdi-drivers/mac

And a more elaborate workaround that removes the Apple driver: http://www.mommosoft.com/blog/2014/10/24/ftdi-chip-and-os-x-10-10/

Notes about latency and FTDI http://openbci.com/forum/index.php?p=/discussion/199/latency-timer-os-x-new-info-plist

The real solution involves using the new Apple driver to communicate with the device: https://developer.apple.com/library/mac/technotes/tn2315/_index.html

Or spoofing the driver with a codeless kext: http://stackoverflow.com/questions/7263648/codeless-kext-loading-problem