Experiments with wireless headsets and HF

The other day I commented on my recent purchase of a new headset, and my intention to use it on air. The following are some very rough notes on how to set it all up.

There a couple of things I’ve discovered… one being, if you’re not careful with muting the microphone, it’ll generate a DC offset back to the computer… which with Qtel, is mistaken for a signal, so it’ll transmit a carrier indefinitely.  I submitted a hack around that issue, which is now included in the latest SVN release of svxlink… but needless to say, it caused some embarrasment earlier this week.

The other reason why I bought it… was for use with the HF station.  This set gives me the freedom to walk around the house which simply is not possible with a HF rig as big as the TS-120S attached to a full-size G5RV.  The solution?  Use JACK to patch the audio from the onboard sound card, through to the headset, and vice versa… using the VOX function on the HF set to key it up.  Another bonus is the ability to use tools such as FreqTweak for realtime DSP filtering.

Physical wiring: You’ve got a number of options here.  Usually to interface the radio to the computer, one hooks the “Mic” port to an output port on the sound card, and the “Phones” port to the Line-In on the sound card.

In my case, I had a TAD (Telephony Answering Device) port spare — this port normally hooks to a modem.  Since all I need is a mono input/output… I decided to hook to this port instead.  I found the ferrite beads were needed on each end of the cable… without these, I got lots of RF feedback when I tried to transmit.

Audio Routing within the system… well for basic functionality, everything can be achieved using qjackctl and jackd… however, I wanted the ability to use DSP filtering in both directions.  There is a catch however.  jackd will only talk to one sound card input, and one sound card output at a time.

Now… you can muck around with ALSA’s pcm_multi and pcm_route plugins to make a virtual multi-channel sound card.  But there’s a little known option that is a lot easier.  Enable the netjack USE flag and install jack-audio-connection-kit.  This will install two utilities alongside JACK, alsa_in and alsa_out. Also install qjackctl and freqtweak if you have not done so already.

Fire up qjackctl and adjust the properties to suit your setup.  Choose one of the sound cards as your primary device… the other will be hooked up using the alsa_in/alsa_out tools.  In my case, I have the settings shown in the screenshot below.  The exact settings to use will be dependant on your hardware.  In this case, I chose to use the headset as the primary device, specifying plughw:Headset and hw:Headset as the input and output devices.

Once you have that configured… start the JACK sound server. Now open up a couple of terminal windows and type the following… each line in a different window:
$ alsa_in -D hw:YourOtherSoundInterface
$ alsa_out -D hw:YourOtherSoundInterface

In my case, they were named AudioPCI. Go back to qjackctl and bring up the connections. You should see the alsa_in and alsa_out ports as well as the system ports corresponding to your two sound cards. Fire up freqtweak, set it up for two-channel filtering… then set up your connections as shown:

If it’s not clear… the audio feeds should be:

  • alsa_in:capture -> freqtweak:in_1
  • freqtweak:out_1-> system:playback_1 + system:playback_2
  • system:capture -> freqtweak:in_2
  • freqtweak:out_2 -> alsa_out:playback_1

As for keying up the transceiver.  The Kenwood TS-120S features VOX built in, but you’ll find that as you speak, the audio sent to the transceiver gets fed back to the headset — delayed, which throws one’s speech processes.  The workaround here, is to use the mixer mute features to keep the audio going one direction at a time.

Most headsets have two volume up/down buttons… I found it was convenient to bind one of these in KDE to execute the following command:
amixer -q -D hw:AudioPCI sset 'Master Mono' toggle ; amixer -q -D hw:AudioPCI sset 'Capture' toggle

This effectively switches between transmit and receive. Press the button once, you’re transmitting, press again, you’re receiving. Simple. For transceivers that lack a VOX feature… you can also add commands for rig control software that will turn the PTT on and off for you. Alternatively, one can capture the KeyPress/KeyUp using XGrabKey, and thus it behaves like a regular PTT.

This is left as an exercise for the reader — I found the xhkeys source code a help for figuring this out… combining this with hamlib and alsa-lib should allow a decent and usable interface when away from the rig itself.