Replies: 24 comments 8 replies
-
hello rich, There is no direct audio driver but maybe there are other options. What is the audio format from the device, is it FM decoded or raw IQ data? What is the frequency and bandwidth? Sorry, I am not familiar with the device mentioned. Ideal would be to share a very short recording with a few messages for testing. Thanks, Jasper |
Beta Was this translation helpful? Give feedback.
-
I created a test version in the 'single' branche. Clone via:
Then build this software. You can use this to decode IQ input at 16k in float 32 that is coming in on stdin:
In this example I am decoding the input in a file iq16k.raw and show the NMEA lines assuming the input is one channel with designation A ( My suggestion is to somehow dump the audio to stdout instead of reading from file... The file is btw here And if the file is in 16 bit signed int:
File can be found here |
Beta Was this translation helpful? Give feedback.
-
I followed your instructions.. and compiled the "single" branch ... However, I could not get it to decode from my radio.
None of them worked. My radio's audio output is :
In SDRangel,
Not sure what I'm missing... still scratching my head. |
Beta Was this translation helpful? Give feedback.
-
Hello, I think the SDRangel file should then be decoded with -s 48k as this is the file format. On your core audio example, you have:
Which creates output at 96k in signed integer format. I suggest you put the output in 16k (-r 16k), then the sox output looks more compatible with the AIS-catcher expected input (-s 16k). AIS-catcher needs to know the sample rate of the input, not the bandwidth. One other point is that AIS-catcher with -c X can only handle now samples rates <= 48k, so that is why I suggest to change the -r. On another point, the audio is stereo and represents IQ samples? On your radio output, which is 48k mono. Are you sure this is raw IQ output? The problem is that for IQ format I expected two channels (for I and Q). Perhaps this is FM demodulated already? |
Beta Was this translation helpful? Give feedback.
-
Feel free to share any recordings here or by my email if you want me to have a closer look. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Please find below the raw file ..... and how it was recorded. Please find above the raw file . |
Beta Was this translation helpful? Give feedback.
-
AIS_2023-07-03T22_31_47_488.wav.zip Playing with an IQ file (see attached above) saved from SDRangel, I got the following lines below decoded. but SDRangel got another set.... from the same file.... different MMSI numbers. All the vessels (from both decodes) were actually in range.... very interesting. |
Beta Was this translation helpful? Give feedback.
-
I think the AIS-catcher results were a coincidence as the file-format is not cs8 at 96k. I had a look at the wave-file header using
|
Beta Was this translation helpful? Give feedback.
-
I pushed a small change to the 'single' branche so this now works directly:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Great! If you can record you can directly pipe the data into AIS-catcher and can run it as a proper receiver with web interface. So worthwhile to see if we can make it work. There are some brilliant command line DSP utilities that allow you to shift the frequency of a signal: https://github.com/ha7ilm/csdr So a command like this works on your file:
The signal is at 48K and the shift of 0.25 shifts it by 12K which is roughly what you do in your screenshots. Now we need to think how to easily do this shifting in AIS-catcher without CSDR. Will be fairly easy to implement so will add in the coming days. Then you would be able to do something like record audio from the device and write to the stdout and at the same time read it into AIS-catcher. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, cannot find a macos version of csdr. No success compiling it either... Is there an alternative for macos ? |
Beta Was this translation helpful? Give feedback.
-
you can put below in a file rotate.cpp and then compile with:
the command becomes:
Bit slow but does the trick until it is included in AIS-catcher. Let me know if it works for you #include <iostream>
#include <cstdint>
#include <complex>
#include <vector>
int main() {
std::ios::sync_with_stdio(false);
// Use std::cin in binary mode
std::cin.unsetf(std::ios::skipws);
// The repeating sequence of multipliers 1, 1i, -1, -1i
std::vector<std::complex<float>> multipliers = {
std::complex<float>(1, 0),
std::complex<float>(0, 1),
std::complex<float>(-1, 0),
std::complex<float>(0, -1)
};
int index = 0;
// Loop until end of input
while (true) {
float re, im;
// Read two 32-bit values (real and imaginary parts) from stdin
std::cin.read(reinterpret_cast<char*>(&re), sizeof(re));
std::cin.read(reinterpret_cast<char*>(&im), sizeof(im));
// Check if reading was successful
if (!std::cin) {
break; // break out of loop if failed to read
}
// Create a complex number and multiply it by the next multiplier
std::complex<float> c(re, im);
std::complex<float> result = c * multipliers[index];
// Store the real and imaginary parts in separate variables
float result_real = result.real();
float result_imag = result.imag();
// Write the resulting complex number in binary format to stdout
std::cout.write(reinterpret_cast<const char*>(&result_real), sizeof(result_real));
std::cout.write(reinterpret_cast<const char*>(&result_imag), sizeof(result_imag));
// Move to the next multiplier in the sequence
index = (index + 1) % 4;
}
return 0;
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
what is he command you are using for creating the sox recorded files compared to getting it from the sound interface? |
Beta Was this translation helpful? Give feedback.
-
The last uploaded file was created thus.....
..... for a 40 sec recording |
Beta Was this translation helpful? Give feedback.
-
in your live example, where you stream into AIS-catcher, would it help that after the "sox" you add "-c 2 -b 16" to force stereo capturing. Somehow the capturing is in mono in the screenshot and it does not work. The -c later converts it then to stereo but the capturing from the sound card needs to be stereo. |
Beta Was this translation helpful? Give feedback.
-
as shown above, it says cant set 2 channels... using 1. |
Beta Was this translation helpful? Give feedback.
-
Nothing decoded from ais-catcher.. but SDRangel gets this.. |
Beta Was this translation helpful? Give feedback.
-
I managed to get csdr compiled.... and playing with the shift... +0.05 |
Beta Was this translation helpful? Give feedback.
-
Thank you so very much Jasper. I've been experimenting and found the best rate at -0.25 and ( +0.25 as you suggested ). I ran multiple sessions concurrently .... ( one as control -0.25 ) and the other sessions with varying "shift" magnitude and compared the decode rate/performance. .. and csdr is truly a great little tool... I've enjoyed using it. ( ...though I had to butcher it to get it to compile on macOS ). I lost my internet connection for a while nd noticed AIS-catcher does not work as normal ( wont display web pages ) offline. Is there a way to " cache " it locally so it works as normal when offline? Again.. Thank you !!!! |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks, The website does work offline in itself but it uses several packages online (graph.js, leaflet, etc) for plotting and mapping. I like that the program is just one file. That keeps it easy for people to install so need to think a little bit how to resolve this. One approach is to collapse all the dependencies in the program but that makes it larger and still does not get you the maps offline. Have you ever looked at OpenCPN that runs locally? |
Beta Was this translation helpful? Give feedback.
-
I have looked at OpenCPN but it does not suit my needs. I just wish I could somehow keep a local copy of all the "online referenced data" . I'm just not a fan on being held hostage by commercial services . :) |
Beta Was this translation helpful? Give feedback.
-
Hello ,
Thanks for the great work done with "AIS catcher". Really enjoying it's performance (on my RTL_SDR).
Is there a way to get AIS-catcher to decode from an audio device ?
( IF from USB port of Amateur Radio ) ?
My "ham radio" has a USB output that appears on my Mac as an "audio interface".
This works with other SDR software ( SDRangel via "audio Input" ) to decode AIS packets from my radio.
In other words.......
I decode AIS packets from my Amatuer Radio (Kenwood TH-D74) via SDRangel's "audio Input" .
I would prefer to use AIS-catcher ..... but cannot figure out how to get this done.
Is it possible to select an audio interface instead of a file ?
Thanks so much.
regards
Rich
Beta Was this translation helpful? Give feedback.
All reactions