rtl-ais icon indicating copy to clipboard operation
rtl-ais copied to clipboard

Adding more channels

Open Mas313 opened this issue 5 months ago • 1 comments

I want to experiment adding one more demodulator to make it a three channel demodulator to test AIS transmitter as described here https://github.com/trendmicro/ais with real ships messages at left frequency 161.975 Mhz and right frequency 162.025 Mhz and with mine at 162.125 Mhz which comes under 1.2 Mhz range for left and right frequencies. I tried to modify code but it seems that frequency shift is hardcoded in rotate_m90() and rotate_90() methods. I also see rx->ch_ofs = ch_ofs; in init_receiver(char name, int num_ch, int ch_ofs, int add_sample_num)
In folllowing lines, Does ch_ofs value of 0 and 1 means 25 Khz and -25Khz offset what if i add rx_c= init_receiver('C', 2, 2, add_sample_num);with ch_ofs=2 to make it +75 Khz ``` rx_a = init_receiver('A', 2, 0, add_sample_num); rx_b = init_receiver('B', 2, 1, add_sample_num);

I also modified `pre_outpu() `functio as follows but not able to get third channel demodulator work:

static void pre_output(struct rtl_ais_context ctx) { int i; for (i = 0; i < ctx->stereo.bl_len; i++) { ctx->stereo.result[i3] = ctx->stereo.buf_left[i]; ctx->stereo.result[i3 + 1] = ctx->stereo.buf_mid[i]; // mas mid new third demod buffer ctx->stereo.result[i3 + 2] = ctx->stereo.buf_right[i]; } }


Can you help me on adding third de-modulator with range of left and right frequencies. 
Thanks

Mas313 avatar Aug 16 '25 14:08 Mas313

Hi

This seems to be an interesting project, but I'm afraid I have no time to spend on it. May be, some other programmer could help.

Anyway, in the code you provided, you are filling ctx->stereo.result with data for a "third channel", but run_rtlais_decoder(ctx->stereo.result,ctx->stereo.result_len) expects a stereo audio signal, so that code won't work.

One workaround, would be to create a new buffer to store another stereo signal, just fill one of the channels (i.e even indexes) and zero the other channel (odd indexes). then run again run_rtlais_decoder() with your data . Hope this helps.

Regards, David

On Sat, Aug 16, 2025 at 11:05 AM Mas313 @.***> wrote:

Mas313 created an issue (dgiardini/rtl-ais#52) https://github.com/dgiardini/rtl-ais/issues/52

I want to experiment adding one more demodulate to make it a three channel demodulator to test AIS transmitter as described here https://github.com/trendmicro/ais with real ships messages at left frequency 161.975 Mhz and right frequency 162.025 Mhz and with mine at 162.125 Mhz which comes under 1.2 Mhz range for left and right frequencies. I tried to modify code but it seems that frequency shift is hardcoded in rotate_m90() and rotate_90() methods. I also see rx->ch_ofs = ch_ofs; in init_receiver(char name, int num_ch, int ch_ofs, int add_sample_num) In folllowing lines, Does ch_ofs value of 0 and 1 means 25 Khz and -25Khz offset what if i add rx_c= init_receiver('C', 2, 2, add_sample_num);with ch_ofs=2 to make it +75 Khz

rx_a = init_receiver('A', 2, 0, add_sample_num);
rx_b = init_receiver('B', 2, 1, add_sample_num);

I also modified `pre_outpu() `functio as follows but not able to get third channel demodulator work:

static void pre_output(struct rtl_ais_context



*ctx) { int i; for (i = 0; i < ctx->stereo.bl_len; i++) {
ctx->stereo.result[i*3] = ctx->stereo.buf_left[i];
ctx->stereo.result[i
*3 + 1] = ctx->stereo.buf_mid[i]; // mas mid new third demod buffer
ctx->stereo.result[i*3 + 2] = ctx->stereo.buf_right[i];
}
}


Can you help me on adding third de-modulator with range of left and right frequencies.
Thanks

—
Reply to this email directly, view it on GitHub
<https://github.com/dgiardini/rtl-ais/issues/52>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADBJPT6RMTIW3Q7KFIMCJZ33N43BLAVCNFSM6AAAAACEBP4Q42VHI2DSMVQWIX3LMV43ASLTON2WKOZTGMZDOMZQHE3DQMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>

dgiardini avatar Aug 19 '25 16:08 dgiardini