Thursday, January 10, 2013

An interesting discovery about sound cards

CheckSR result at 48kHz with internal sound card
I have several radios connected to my shack PC. For the audio interfacing I have several sound cards or sound devices since most of them are not internal cards but use USB ports. I wanted to make sure the rig I mostly use for digimodes used the best sound card I had so I thought I would do some tests.

Some people believe it's better to use a high end sound card for radio work. I don't think there is any benefit for HF use as the noise level will be much higher than even the poorest sound card. There is no advantage to using a device capable of more than 48kHz sample rate unless you are using SDR software and need the extra bandwidth.

The one factor that can really made a difference is the accuracy of the sample rate. Most digimode software uses either 11025Hz or 48000Hz. There is no theoretical advantage to using a faster than 11025Hz rate for terrestrial digimodes. A 48kHz sample rate should not give any benefit and will need more CPU cycles to transfer and process the extra samples.

Sample rate accuracy is important because it affects both the pitch of playback and the data rate. It's like playing an LP at the wrong speed. If you play a 33rpm LP at 45rpm the music is played at a higher pitch and a faster tempo. If played at a lower speed the sound is lower pitched and slower. This is analogous to what happens if the sample rate of your sound card is not exactly what your digimode software expects it to be.

I tested a number of sound devices using CheckSR.exe. This is a utility that is distributed with the MixW digimode software, but you can probably find it on its own if you Google it. To use it you simply select sound devices for input and output and set the sample rate you wish to test. You then run it until the measured sample rate settles on a stable figure.

I tested the Realtek sound cards built into my shack PC (HP) and a laptop (Dell) using both 11025Hz and 48000Hz sample rates. Both sound cards were as close to the specified sample rate as makes no difference.

CheckSR result at 11025Hz with USB device
I then tested a number of USB devices ranging from a $1 audio 'dongle' to a $10 model with surround sound and SP-DIF inputs and outputs. The drivers for these devices had names like 'USB sound device', 'Generic USB sound device' and  'USB headphone set'. These devices were also close to spot-on at 48000Hz.

But at 11025Hz every single USB device had a measured sample rate of 11100Hz - 1% faster than specified. This would make a 1kHz audio tone play at 1010Hz, whilst a 1200baud APRS packet would be transmitted at a rate of 1212baud. This error is more than enough to prevent decoding of an FSK packet signal. Other digimodes are also subject to sample rate errors. If you have ever seen a PSK or Olivia  signal that is strong and clear yet decodes as garbage, an incorrect sample rate (at one end or the other) is the reason.

I was surprised that the sample rate error at 11025Hz was consistent across all USB device samples. This suggests to me that the measured rate of 11100Hz is a factor of the drivers for these devices which may not run at the speed you select but instead resample down from a native speed of 48kHz. It would be interesting to see the results of running CheckSR on some branded USB devices or SignaLink USB interfaces that have their own drivers.

I ran some tests on USB devices at other sample rates. There was no consistency. At 8000Hz the measured rate was fast by a significant amount, but 16000Hz it was slower.

The results suggest that USB audio devices are only as good as internal sound cards if a 48000Hz sample rate is used. The use of lower sample rates with USB devices should be avoided.

Wednesday, January 09, 2013

A virtual impossibility

If you have been following my attempts to set up beacon monitoring using a software defined radio (SDR) then you may remember that I had found that Omni-Rig, the radio control software used by Faros, the beacon monitoring software, would not talk to the virtual serial port created using VSPE in order to control the SDR-Radio software. I thought there was a problem with SDR-Radio's emulation of the Kenwood control protocol. In fact, that turned out not to be the case at all.

A reader asked if I had tried DDUtil, a.k.a. VSP_Manager, a program by K5FR so I got hold of a copy. The instructions made my hair stand on end as it seemed very complicated. But I managed to set up a virtual port pair between COM8, the control port that SDR-Radio was using, and COM9 which would be used by Faros. VSP_Manager threw up a few error boxes but it still seemed to have done what I asked. I then tried setting up Omni-Rig. The first attempt failed, but I decided to try again as the help files actually showed VSP Manager being used with Omni-Rig and sure enough I had Faros changing bands and frequencies of SDR-Radio.

My joy was boundless, but not for long. I fell at the next hurdle which was using a Virtual Audio Cable (VAC) to pipe the audio from SDR-Radio into Faros. VAC also looked complicated to set up, but what I was attempting to do was the simplest application of it. I created a virtual audio port and set the SDR-Radio output to use it. As soon as I connected this to Faros' input Faros began spitting out "divide by zero" message boxes so fast that I couldn't close them quick enough to get back to the Settings window to change it back again. Another brick wall.

A separate issue was that of creating a serial port splitter to allow two applications to connect to physical port COM3 used by my Elecraft K3. VSPE could do that easily, but yesterday I discovered that WSPR would not talk to the virtual port created by VSPE. However, VSP_Manager does not seem to enable you to split a real port into a pair of virtual ones anyway, so I did not pursue this avenue any further.

If you are confused trying to follow all this you are not the only one! I have abandoned the idea of using an SDR for beacon monitoring and am breathing a sigh of relief that I never decided to go down the road of buying a Flex or other software defined transceiver. SDR will never catch on until connecting the software defined radio to logging programs or digimode software becomes as simple as plugging in a real cable.

Monday, January 07, 2013

Hamlib and virtual serial ports

Sometimes it seems as if half the posts in this blog relate to trouble with computers.

After I got back from the hospital today I thought I would try some WSPR for a change. Paul PC4T had mentioned that conditions on 80m were good. 80 is not a band I often use so I thought I'd try there. But no sooner than I had tried to change band than the software beeped rudely at me. The console window contained an error message: serial_open: Unable to open COM13 - Invalid argument.


COM13 is a virtual serial port splitter on COM3 which I'd created using Eterlogic's Virtual Serial Port Emulator, VSPE. I've used this utility for years to create virtual serial ports so that more than one program can open my radios' computer control ports at the same time. I'd used one to try out CW Skimmer with KComm before Christmas. As I'd uninstalled Skimmer I removed the virtual serial port. WSPR, which does its rig control through hamlib, then opened COM3 up just fine.

That's a temporary solution, but I haven't given up the idea of running other ham software alongside KComm for good. I think there are other serial port splitters out there (there's com0com which was far too complicated for me to figure out) but VSPE has always worked for me until now. Don't you just love computers?

Saturday, January 05, 2013

SDR-Radio and Omni-Rig

Yesterday I thought I would set up my Cross Country Wireless SDR-4+ receiver to use for IBP beacon monitoring using Faros. The purpose of this was mainly to reduce the wear and tear on my Elecraft K3 which otherise would have to be on 24 hours a day.

I established that Simon Brown's SDR-Radio software supported external program control by emulating a Kenwood transceiver. I therefore needed to see if SDR-Radio could be controlled using Omni-Rig, the control mechanism used by Faros.

SDR-Radio supports CAT control using a virtual serial port.

I created a linked pair of virtual serial ports, COM8 and COM9, using VSPE, a virtual serial port emulator. Using the serial ports option of SDR-Radio, I assigned the control port to COM8. Then I used a serial port emulator connected to COM9 (I use RealTerm) to verify that SDR-Radio 'spoke' Kenwood. It did. In fact it emulated the Kenwood protocol well enough to fool KComm into thinking it was talking to an Elecraft K2. So far so good.

Now to see if Omni-Rig could control SDR-Radio. Omni-Rig uses "rig files" to define the command set of different radios and it includes one for generic Kenwood. Unfortunately it did not work with SDR-Radio: the receiver indicator of Faros turned red to indicate a fault.

I downloaded the rig file documentation and debug tools from Omni-Rig's site and tried hacking the Kenwood rig file to get it to work with Omni-Rig by trial and error. But no luck. Whatever I did, the program reported an error with the inscrutable message: "RIG1 Status commands already in queue".

Error messages reported by Omni-Rig
So it looks as if I've hit a brick wall. Clearly there is something in SDR-Radio's emulation of the Kenwood protocol that Omni-Rig doesn't like. If anyone else would like to have a go solving this problem, be my guest.

Wednesday, January 02, 2013

Tecsun PL-360

Tecsun PL-360
The only item of radio equipment in my Christmas stocking this year was a Tecsun PL-360 FM/MW/SW DSP receiver. These smartly-styled radios in black or silver are widely available on eBay for less than £30 including postage from China. The radio looks and feels a much better quality item than you might expect at that price.

The PL-360 covers medium wave, Band 2 FM (with stereo decoder) and 13 short wave bands from 2300 to 21950 kHz. Unlike most cheap short wave radios that have a frequency counter displaying the frequency of an analogue VFO, the Tecsun PL-360 is a true digital radio having a fully synthesized PLL VFO.

The Tecsun is also a digital radio in that it is DSP based not the usual superhet. The benefits are immediately apparent when you listen to the radio - it has that clear, open sound characteristic of DSP receivers. The internal speaker does not deliver much bass but you really hear the difference, especially listening to FM stereo, when using earphones, of which a Walkman-style pair are included.

For AM use Tecsun supplies a rotatable ferrite rod antenna that plugs in to the top of the radio. This can be used over a frequency range of 150 to 1710 kHZ, though note well that this radio does not have a long wave band. The 7-section telescopic whip antenna is 38cm (15in) long and is used on the short wave and FM bands.

Showing the rotatable MW antenna
The tuning control is a click-stopped rotary encoder which tunes the radio in 1 kHz steps on short wave and 9 or 10 kHz steps on medium wave. The radio can be tuned outside the broadcast bands but this is rather a tedious exercise due to the 1 kHz steps - there is no provision for direct frequency entry using a keypad. The  Tecsun PL-360 does not demodulate CW or SSB so there is not much point in tuning into the amateur HF bands - a pity, though that is not unexpected at this price level.

For tuning the Tecsun has a neat trick inherited from TV receivers. Called Easy Tuning Mode (ETM) the radio first tunes the entire MW, SW or FM frequency range and stores all the frequencies on which a signal was heard in memory. You can then tune from one signal to the next using the click-stopped tuning control. This makes short wave listening really easy and pleasurable. Doing an ETM scan of the short wave bands takes a few minutes. The feature is a useful tool for checking out HF propagation, though it's a pity the tuning range stops at 22 MHz.

Power is provided by 3 x AA cells which may be standard alkaline or NiMH rechargeable (not supplied.). A charging circuit is built-in and power may be applied using a mini-USB socket on the side, so you can charge the batteries from a PC (using an appropriate USB cable) or a mobile phone charger. A charger is not included, but you do get a long wire antenna that clips on to the top of the telescopic whip for improved short wave reception, and a nice faux-leather case.

As an alternative to the Easy Tuning Mode the receiver may be tuned manually and frequencies entered into memories, but as mentioned earlier this is quite tedious. There is no programming software that would enable memories to be set up using a computer. There is a built-in clock which is quite accurate and includes an alarm function. The radio also has a temperature sensor and displays both temperature and time even when switched off.

To sum up, the Tecsun PL-360 is a portable radio of surprisingly good quality and performance for the money. Its Easy Tuning Mode makes casual listening a pleasure, the audio quality is excellent and the provision for rechargeable batteries is welcome. At less than £30 it is a real bargain.