Some of you may have heard about rtl-sdr, which is basically a software defined radio framework, for cheap USB sticks. The USB sticks can be picked up for 10-20$.
They’re not excellent. They have limited bandwith (~2MHz), they have noticeable noise, and they don’t have that good sensitivity. But for the price? It’s a extremely good offer.
AIS reception has been covered by the guys at rtl-sdr.com. I found this quite lacking, and it didn’t explain some of the stuff, like why resample the audio to 12kHz.
After fiddling around for some days, I found rtl-ais which is a modified version of rtl-sdr, with direct support for AIS decoding. It worked! Just specifying the tuner error, and it was outputting AIS messages.
However, the decoder was not that elegant, and GNUAIS had interesting features, like the ability to feed data directly to mysql.
AIS is transmitted at 161.975 and 162.025MHz, which is within the 2MHz bandwidth of the RTL-SDR sticks, so both channels can be received at once. The rtl_ais software is a modified version of rtl_fm, which can do exactly this. Feeding the output audio to a named pipe, and setting gnuais up to read from that named pipe, instead of audio card, worked just perfectly!