Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FM Network with RAW audio through UDP. #782

Closed
EU4BNC opened this issue Oct 15, 2023 · 77 comments
Closed

FM Network with RAW audio through UDP. #782

EU4BNC opened this issue Oct 15, 2023 · 77 comments

Comments

@EU4BNC
Copy link

EU4BNC commented Oct 15, 2023

Hello. Now I use mmdvm in fm mode in conjunction with SVXlink through USRP. But perhaps it is possible to use RAW data via UDP? Is it possible to do this?

@sp2ong
Copy link

sp2ong commented Oct 16, 2023

It would be nice to have this option because SVXLink allows cooperation via UDP by specifying:
Example: "udp:127.0.0.1:10000". Note however that the only supported format is raw 16 bit signed samples, two interleved channels.

With raw UDP audio, we can pass DTMF tones to svxlink so we can switch groups on svxreflector and control svxlink via DTMF via MMDVM FM Mode which is not allowed by the USRP protocol in svxlink

@EU4BNC
Copy link
Author

EU4BNC commented Oct 16, 2023

Yes, that's right, RAW could add more features. Additionally, it will be possible to use various voice notifications from SVXLINK.

@sp2ong
Copy link

sp2ong commented Oct 16, 2023

Yes you are right. Thanks to this, there will be full integration of the MMDVM FM mode with the capabilities of svxlink

@TUAPSE
Copy link

TUAPSE commented Oct 16, 2023

Really, this would be a wonderful addition. I also use a repeater based on MMDVMHOST, operating in DMR and FM mode. SVXLINK via USRP has very limited functionality. A huge request to the developer to add the ability to broadcast audio in RAW format via UDP to work with SVXLINK.

@XATTA6
Copy link

XATTA6 commented Oct 16, 2023

I also fully support fellow radio amateurs! I also use Svxlink via USRP protocol and have no way to run parrot and use group switching. I really ask you to modify mmdvmhost to allow dtmf to work and support raw format for using SvxLink without additional settings via USRP.

@g4klx
Copy link
Owner

g4klx commented Oct 17, 2023

Note that DTMF tones are not filtered by the MMDVM so should be passed correctly, only the CTCSS and high audio frequencies are removed. The USRP UDP option was originally designed to interact with external software that provided access to EchoLink and not as a general function, it was always expected that the inbuilt FM repeater would be used most of the time. However it appears that you want to do more.

In the MMDVM.ini you will see that LinkMode is documented (did you read the file at all?) and it allows almost complete access to the FM audio in and out via USRP with almost no logic operation. I think the CTCSS detector is still operational as that will allow the repeater to remain multimode correctly.

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Jonathan, thank you very much for your answer. Yes, I know that USRP from MMDVMHost does not filter DTMF and passes these tones via USRP, but we have a problem that USRP in svxlink is a simple implementation in a separate branch, not the main code, and USRP svxlink did not allow DTMF decoding and sending radio messages. USRP in the svxlink branch was added mainly as a network connection option to DV via USRP.
Using UDP RAW mode made it possible to use the connection in the official svxlink code and be able to decode commands via DTMF and transmit audio messages from svxlink to MMDVMHost in FM mode. I understand that it requires time from you to add definitions in FM Netork in the Protocol, apart from USRP, add UDP mode, after selecting it, raw audio 16 bit signed samples, two interleved channels are sent.
We could then use the DV repeater in FM mode to better use its capabilities in connection with the svxlink network

@g4klx
Copy link
Owner

g4klx commented Oct 17, 2023

Adding a raw mode would not be an issue, my only issue is that you ask for two channels, I don't understand this. There is only one audio source and I would expect one channel in and one channel out of the host. Other than that, I think I can add an implementation later today for you to test.

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Hi, I am not sure what SM0SVX autor svxlink is used in this definition. I found this info on svxlink.conf
https://github.com/sm0svx/svxlink/blob/master/src/doc/man/svxlink.conf.5#L2764

The "udp" type is not really an audio device but instead will read and write
audio from/to a UDP socket. This can be used to interface SvxLink to all
sorts of audio sources/sinks capable of streaming raw audio through UDP. One
example usage is to interface SvxLink with GNU Radio.
Example: "udp:127.0.0.1:10000". Note however that the only supported format
is raw 16 bit signed samples, two interleved channels. Sampling frequency can
be chosen using the CARD_SAMPLE_RATE config variable as usual.

@XATTA6
Copy link

XATTA6 commented Oct 17, 2023

Can I also do a change test on my dmr/fm repeater?

@g4klx
Copy link
Owner

g4klx commented Oct 17, 2023

I've added a RAW data type for the FM Network and it uses two channels of 16-bit signed integers only one of which is used, when sending data out, both channels have the same audio data in them. I hope that helps.

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Wow, many thanks, I see we need in MMDVM.ini in [FM Network] define

Protocol=RAW

it will send sound in RAW UDP and in svxlink.conf we need to define in Rx1 an Tx1

AUDIO_DEV=udp:127.0.0.1:port_number

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

Something went wrong.
After setting up SVX Link and MMDVMHost, we get the following log entry:
M: 2023-10-17 14:45:08.872 FM packet received from an invalid source
There may be something wrong in the protocol.
SVXLink does not react in any way to data from the UDP port and leaves no entries in the log.

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

From MMDVM
19:07:34.732719 IP (tos 0x0, ttl 64, id 51052, offset 0, flags [DF], proto UDP (17), length 668)
From Svx
19:09:01.634316 IP (tos 0x0, ttl 64, id 64666, offset 0, flags [DF], proto UDP (17), length 2076)

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

This package is from MMDVM

19:18:40.398721 IP (tos 0x0, ttl 64, id 8543, offset 0, flags [DF], proto UDP (17), length 668)
localhost.3811 > localhost.4811: [bad udp cksum 0x009c -> 0x6b7c!] UDP, length 640
0x0000: 0000 0000 0000 0000 0000 0000 0800 4500 ..............E.
0x0010: 029c 215f 4000 4011 18f0 7f00 0001 7f00 ..!_@.@.........
0x0020: 0001 0ee3 12cb 0288 009c cd01 cd01 20fe ................
0x0030: 20fe d6fa d6fa c3fa c3fa def7 def7 d6f4 ................
0x0040: d6f4 25f3 25f3 a6f2 a6f2 cbf3 cbf3 8cf5 ..%.%...........
0x0050: 8cf5 46fb 46fb d401 d401 f304 f304 1606 ..F.F...........
0x0060: 1606 de06 de06 800b 800b a40c a40c 3a02 ..............:.
0x0070: 3a02 3ff9 3ff9 4ef9 4ef9 2efe 2efe 7f06 :.?.?.N.N.......
0x0080: 7f06 5b09 5b09 3a03 3a03 ac01 ac01 2305 ..[.[.:.:.....#.
0x0090: 2305 aa01 aa01 effd effd f9fe f9fe 42fa #.............B.
0x00a0: 42fa 17f5 17f5 f6f7 f6f7 ddfb ddfb 67ff B.............g.
0x00b0: 67ff 0f04 0f04 2007 2007 c809 c809 590b g.............Y.
0x00c0: 590b e909 e909 7405 7405 6afc 6afc 00f5 Y.....t.t.j.j...
0x00d0: 00f5 1df6 1df6 86fa 86fa 08fe 08fe 20fd ................
0x00e0: 20fd e7f6 e7f6 edf4 edf4 a4f7 a4f7 d9f9 ................
0x00f0: d9f9 11fd 11fd 1803 1803 e40a e40a d60a ................
0x0100: d60a 6b05 6b05 1108 1108 1709 1709 5403 ..k.k.........T.
0x0110: 5403 5e03 5e03 0e02 0e02 c2f8 c2f8 75f5 T.^.^.........u.
0x0120: 75f5 10f8 10f8 76f6 76f6 06f8 06f8 eeff u.....v.v.......
0x0130: eeff 7b02 7b02 c202 c202 d106 d106 b706 ..{.{...........
0x0140: b706 e805 e805 3f09 3f09 0808 0808 8703 ......?.?.......
0x0150: 8703 da01 da01 54ff 54ff 33fd 33fd bcfe ......T.T.3.3...
0x0160: bcfe 8b00 8b00 44ff 44ff 95fa 95fa a1f8 ......D.D.......
0x0170: a1f8 83f7 83f7 63f2 63f2 92f5 92f5 9b00 ......c.c.......
0x0180: 9b00 8b05 8b05 d307 d307 b009 b009 ce07 ................
0x0190: ce07 2305 2305 aefd aefd aff6 aff6 25fd ..#.#.........%.
0x01a0: 25fd f204 f204 5004 5004 8b03 8b03 e401 %.....P.P.......
0x01b0: e401 7cfd 7cfd 0bfc 0bfc 84ff 84ff 1a00 ..|.|...........
0x01c0: 1a00 5efa 5efa 28fa 28fa cf00 cf00 8803 ..^.^.(.(.......
0x01d0: 8803 4601 4601 bcfc bcfc 95fa 95fa dcfc ..F.F...........
0x01e0: dcfc 05ff 05ff 2503 2503 8106 8106 cb01 ......%.%.......
0x01f0: cb01 6efe 6efe 6c00 6c00 75fe 75fe 06fb ..n.n.l.l.u.u...
0x0200: 06fb 69fc 69fc 4101 4101 2104 2104 6901 ..i.i.A.A.!.!.i.
0x0210: 6901 1500 1500 8404 8404 db06 db06 6c06 i.............l.
0x0220: 6c06 560a 560a 1e0d 1e0d 2605 2605 d2fa l.V.V.....&.&...
0x0230: d2fa c0fa c0fa 5dfd 5dfd a6fa a6fa d3fa ......].].......
0x0240: d3fa 1cfe 1cfe d4fb d4fb fbf6 fbf6 9df6 ................
0x0250: 9df6 45f8 45f8 d5f9 d5f9 1400 1400 5e07 ..E.E.........^.
0x0260: 5e07 9207 9207 b505 b505 e605 e605 5904 ^.............Y.
0x0270: 5904 2300 2300 38fb 38fb a5fd a5fd d606 Y.#.#.8.8.......
0x0280: d606 b107 b107 d4fe d4fe c4f8 c4f8 bcfb ................
0x0290: bcfb 6600 6600 4a01 4a01 af03 af03 1f03 ..f.f.J.J.......
0x02a0: 1f03 d2fd d2fd d3fd d3fd ..........

And this package is from SVXLink

19:21:45.562505 IP (tos 0x0, ttl 64, id 56661, offset 0, flags [DF], proto UDP (17), length 2076)
localhost.52063 > localhost.3811: [bad udp cksum 0x061c -> 0x8487!] UDP, length 2048
0x0000: 0000 0000 0000 0000 0000 0000 0800 4500 ..............E.
0x0010: 081c dd55 4000 4011 5779 7f00 0001 7f00 ...U@.@.Wy......
0x0020: 0001 cb5f 0ee3 0808 061c 0000 bf01 0000 ..._............
0x0030: 8c00 0000 94fe 0000 f7fc 0000 4efc 0000 ............N...
0x0040: 45fc 0000 39fc 0000 1afc 0000 78fc 0000 E...9.......x...
0x0050: b8fd 0000 8bff 0000 4501 0000 9602 0000 ........E.......
0x0060: 8703 0000 f503 0000 ca03 0000 8603 0000 ................
0x0070: b903 0000 3704 0000 6c04 0000 3404 0000 ....7...l...4...
0x0080: f103 0000 c603 0000 4303 0000 3a02 0000 ........C...:...
0x0090: f700 0000 91ff 0000 ebfd 0000 43fc 0000 ............C...
0x00a0: f7fa 0000 41fa 0000 44fa 0000 e0fa 0000 ....A...D.......
0x00b0: c4fb 0000 e1fc 0000 4ffe 0000 cbff 0000 ........O.......
0x00c0: da00 0000 8801 0000 5a02 0000 5103 0000 ........Z...Q...
0x00d0: f403 0000 6a04 0000 2b05 0000 e305 0000 ....j...+.......
0x00e0: e605 0000 1105 0000 7403 0000 3701 0000 ........t...7...
0x00f0: e4fe 0000 ccfc 0000 d0fa 0000 07f9 0000 ................
0x0100: b6f7 0000 daf6 0000 59f6 0000 62f6 0000 ........Y...b...
0x0110: 46f7 0000 00f9 0000 e8fa 0000 61fc 0000 F...........a...
0x0120: c7fd 0000 baff 0000 ff01 0000 0004 0000 ................
0x0130: a805 0000 0b07 0000 fb07 0000 7608 0000 ............v...
0x0140: cc08 0000 3a09 0000 8309 0000 1a09 0000 ....:...........
0x0150: d707 0000 5706 0000 2d05 0000 0504 0000 ....W...-.......
0x0160: 4702 0000 0500 0000 bbfd 0000 eafb 0000 G...............
0x0170: f6fa 0000 b6fa 0000 a9fa 0000 a0fa 0000 ................
0x0180: 85fa 0000 4bfa 0000 71fa 0000 3dfb 0000 ....K...q...=...
0x0190: 09fc 0000 66fc 0000 a2fc 0000 e3fc 0000 ....f...........
0x01a0: 22fd 0000 94fd 0000 3afe 0000 dcfe 0000 ".......:.......
0x01b0: 5cff 0000 a8ff 0000 b8ff 0000 bbff 0000 ...............
0x01c0: 3e00 0000 fa01 0000 9f04 0000 0406 0000 >...............
0x01d0: 1904 0000 e3ff 0000 e2fc 0000 2cfd 0000 ............,...
0x01e0: 9aff 0000 ea01 0000 1803 0000 8803 0000 ................
0x01f0: 5404 0000 1c06 0000 2608 0000 4a09 0000 T.......&...J...
0x0200: cd08 0000 0506 0000 2001 0000 41fc 0000 ............A...
0x0210: 93f9 0000 cbf8 0000 24f8 0000 1af7 0000 ........$.......
0x0220: e3f6 0000 adf8 0000 29fc 0000 e5ff 0000 ........).......
0x0230: 8e02 0000 d203 0000 2104 0000 0a04 0000 ........!.......
0x0240: f003 0000 0a04 0000 1c04 0000 8f03 0000 ................
0x0250: 4902 0000 1e01 0000 0801 0000 cd01 0000 I...............
0x0260: fb01 0000 8100 0000 d3fd 0000 18fb 0000 ................
0x0270: f3f8 0000 66f7 0000 39f6 0000 4af5 0000 ....f...9...J...
0x0280: cbf4 0000 4ff5 0000 57f7 0000 ebfa 0000 ....O...W.......
0x0290: 8fff 0000 2104 0000 6607 0000 4f09 0000 ....!...f...O...
0x02a0: d60a 0000 500c 0000 140d 0000 b30c 0000 ....P...........
0x02b0: 6a0b 0000 8f09 0000 5b07 0000 3605 0000 j.......[...6...
0x02c0: 9a03 0000 7302 0000 0901 0000 d9fe 0000 ....s...........
0x02d0: 17fc 0000 48f9 0000 c2f6 0000 b8f4 0000 ....H...........
0x02e0: 6bf3 0000 e7f2 0000 bbf2 0000 d1f2 0000 k...............
0x02f0: 0df4 0000 1cf7 0000 30fb 0000 f4fe 0000 ........0.......
0x0300: f701 0000 8c04 0000 f506 0000 1509 0000 ................
0x0310: 990a 0000 320b 0000 050b 0000 8f0a 0000 ....2...........
0x0320: db09 0000 a808 0000 6807 0000 aa06 0000 ........h.......
0x0330: cd05 0000 e003 0000 1f01 0000 67fe 0000 ............g...
0x0340: 01fc 0000 d3f9 0000 e2f7 0000 3ff6 0000 ............?...
0x0350: 15f5 0000 cdf4 0000 81f5 0000 cbf6 0000 ................
0x0360: 7ff8 0000 b4fa 0000 f9fc 0000 bdfe 0000 ................
0x0370: 3100 0000 a701 0000 dd02 0000 a203 0000 1...............
0x0380: 2d04 0000 9104 0000 ba04 0000 da04 0000 -...............
0x0390: 2005 0000 4d05 0000 1205 0000 7d04 0000 ....M.......}...
0x03a0: a603 0000 7c02 0000 1601 0000 b2ff 0000 ....|...........
0x03b0: 61fe 0000 24fd 0000 37fc 0000 dbfb 0000 a...$...7.......
0x03c0: 00fc 0000 90fc 0000 8afd 0000 c0fe 0000 ................
0x03d0: fbff 0000 3301 0000 5d02 0000 4203 0000 ....3...]...B...
0x03e0: bc03 0000 db03 0000 ce03 0000 ae03 0000 ................
0x03f0: 6303 0000 ce02 0000 fe01 0000 0801 0000 c...............
0x0400: e7ff 0000 a9fe 0000 87fd 0000 8efc 0000 ................
0x0410: a3fb 0000 aefa 0000 aff9 0000 e1f8 0000 ................
0x0420: bff8 0000 77f9 0000 a9fa 0000 e0fb 0000 ....w...........
0x0430: eafc 0000 02fe 0000 99ff 0000 ab01 0000 ................
0x0440: a803 0000 0005 0000 8e05 0000 9805 0000 ................
0x0450: 8405 0000 9205 0000 d005 0000 e505 0000 ................
0x0460: 2105 0000 6c03 0000 a101 0000 8500 0000 !...l...........
0x0470: ecff 0000 26ff 0000 eefd 0000 adfc 0000 ....&...........
0x0480: defb 0000 93fb 0000 bdfb 0000 6cfc 0000 ............l...
0x0490: a5fd 0000 29ff 0000 7400 0000 4901 0000 ....)...t...I...
0x04a0: f301 0000 b902 0000 6403 0000 a603 0000 ........d.......
0x04b0: 7403 0000 0403 0000 7d02 0000 bb01 0000 t.......}.......
0x04c0: 9000 0000 22ff 0000 b3fd 0000 5dfc 0000 ....".......]...
0x04d0: 3bfb 0000 6efa 0000 ddf9 0000 78f9 0000 ;...n.......x...
0x04e0: 82f9 0000 29fa 0000 5dfb 0000 29fd 0000 ....)...]...)...
0x04f0: 69ff 0000 7901 0000 0603 0000 7004 0000 i...y.......p...
0x0500: e505 0000 f606 0000 4e07 0000 0a07 0000 ........N.......
0x0510: 4b06 0000 1305 0000 9003 0000 1f02 0000 K...............
0x0520: 0501 0000 2500 0000 fcfe 0000 55fd 0000 ....%.......U...
0x0530: c6fb 0000 f0fa 0000 c4fa 0000 f6fa 0000 ................
0x0540: 4cfb 0000 9ffb 0000 2ffc 0000 68fd 0000 L......./...h...
0x0550: 0dff 0000 8000 0000 ae01 0000 e802 0000 ................
0x0560: 1f04 0000 d604 0000 e004 0000 a104 0000 ................
0x0570: 4c04 0000 9e03 0000 8502 0000 2f01 0000 L.........../...
0x0580: a5ff 0000 05fe 0000 c0fc 0000 05fc 0000 ................
0x0590: 92fb 0000 3cfb 0000 29fb 0000 75fb 0000 ....<...)...u...
0x05a0: 18fc 0000 19fd 0000 80fe 0000 1100 0000 ................
0x05b0: 7701 0000 8a02 0000 3103 0000 5d03 0000 w.......1...]...
0x05c0: 4903 0000 4203 0000 2d03 0000 c602 0000 I...B...-.......
0x05d0: 1f02 0000 7a01 0000 0501 0000 c400 0000 ....z...........
0x05e0: 8500 0000 0300 0000 56ff 0000 c7fe 0000 ........V.......
0x05f0: 51fe 0000 d8fd 0000 a2fd 0000 1dfe 0000 Q...............
0x0600: 54ff 0000 9500 0000 d300 0000 d1ff 0000 T...............
0x0610: b7fe 0000 a4fe 0000 35ff 0000 66ff 0000 ........5...f...
0x0620: 1eff 0000 e4fe 0000 f0fe 0000 5eff 0000 ............^...
0x0630: 5d00 0000 9801 0000 6102 0000 8d02 0000 ].......a.......
0x0640: 2102 0000 e300 0000 29ff 0000 f1fd 0000 !.......).......
0x0650: 6efd 0000 cffc 0000 e8fb 0000 88fb 0000 n...............
0x0660: 11fc 0000 4afd 0000 19ff 0000 3b01 0000 ....J.......;...
0x0670: 1f03 0000 8b04 0000 9705 0000 1c06 0000 ................
0x0680: 3306 0000 7106 0000 c106 0000 4506 0000 3...q.......E...
0x0690: e104 0000 4303 0000 a101 0000 ddff 0000 ....C...........
0x06a0: 20fe 0000 6cfc 0000 bafa 0000 6df9 0000 ....l.......m...
0x06b0: d1f8 0000 9df8 0000 7af8 0000 8df8 0000 ........z.......
0x06c0: 25f9 0000 33fa 0000 8cfb 0000 5efd 0000 %...3.......^...
0x06d0: 9aff 0000 a401 0000 4703 0000 c704 0000 ........G.......
0x06e0: 0a06 0000 ae06 0000 b206 0000 4a06 0000 ............J...
0x06f0: 7705 0000 4104 0000 dc02 0000 6c01 0000 w...A.......l...
0x0700: 0100 0000 ccfe 0000 eafd 0000 38fd 0000 ............8...
0x0710: b0fc 0000 68fc 0000 28fc 0000 bdfb 0000 ....h...(.......
0x0720: 61fb 0000 5afb 0000 a3fb 0000 66fc 0000 a...Z.......f...
0x0730: dafd 0000 a0ff 0000 2e01 0000 ab02 0000 ................
0x0740: 5004 0000 b905 0000 9606 0000 0607 0000 P...............
0x0750: f806 0000 5006 0000 4e05 0000 4504 0000 ....P...N...E...
0x0760: 4c03 0000 3502 0000 ba00 0000 fbfe 0000 L...5...........
0x0770: 72fd 0000 5efc 0000 86fb 0000 bffa 0000 r...^...........
0x0780: 20fa 0000 c1f9 0000 b7f9 0000 38fa 0000 ............8...
0x0790: 95fb 0000 a5fd 0000 7dff 0000 3500 0000 ........}...5...
0x07a0: 1100 0000 f8ff 0000 2c00 0000 7600 0000 ........,...v...
0x07b0: c000 0000 e600 0000 c900 0000 b300 0000 ................
0x07c0: d500 0000 0601 0000 4701 0000 8a01 0000 ........G.......
0x07d0: 4801 0000 5700 0000 3cff 0000 5cfe 0000 H...W...<......
0x07e0: f7fd 0000 7bfe 0000 bdff 0000 a900 0000 ....{...........
0x07f0: cd00 0000 0a01 0000 1802 0000 7503 0000 ............u...
0x0800: 4a04 0000 7204 0000 a804 0000 9605 0000 J...r...........
0x0810: 2606 0000 3e04 0000 0e00 0000 88fc 0000 &...>...........
0x0820: eefb 0000 94fd 0000 34ff ........4.

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Hi EU4BNC

Can you show [FM Network] section from MMDVM.ini and definition AUDIO_DEV from [Tx1] and [Rx1] from svxlink.conf?

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

[FM Network]
Protocol=RAW
Enable=1
LocalAddress=127.0.0.1
LocalPort=3811
GatewayAddress=127.0.0.1
GatewayPort=4811
PreEmphasis=1
DeEmphasis=1
TXAudioGain=1.0
RXAudioGain=0.2
Debug=1

[Rx1]
TYPE=Local
RX_ID=R
AUDIO_DEV=udp:127.0.0.1:4811
AUDIO_CHANNEL=1
LIMITER_THRESH=-6
SQL_DET=VOX
SQL_START_DELAY=0
SQL_DELAY=0
SQL_HANGTIME=2000
VOX_FILTER_DEPTH=20
VOX_THRESH=1000
CTCSS_FQ=88.5
SERIAL_PORT=/dev/ttyUSB0
SERIAL_PIN=CTS
SIGLEV_SLOPE=1
SIGLEV_OFFSET=0
SQL_SIGLEV_OPEN_THRESH=30
SQL_SIGLEV_CLOSE_THRESH=10
DEEMPHASIS=0
PEAK_METER=1
DTMF_DEC_TYPE=INTERNAL

[Tx1]
TYPE=Local
AUDIO_DEV=udp:127.0.0.1:3811
AUDIO_CHANNEL=1
LIMITER_THRESH=-6
PTT_TYPE=NONE
PTT_PIN=gpio9
HID_PTT_PIN=GPIO3
HID_DEVICE=/dev/ttyUSB0
GPIO_PATH=/sys/class/gpio
TIMEOUT=300000
TX_DELAY=500
PREEMPHASIS=0
MASTER_GAIN=2.0

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Hm interesting it maybe js OK I am not expert but I wonder why MMDVM use 3811 port to send data on port 4811 where 3811 is used by svxlink as TX UDP in svxlink.conf.

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

4811 Is RX For SVX (For receiving from MMDVM and translating to Internet)
3811 Is TX For SVX (For receiving from internet and translating to MMDVM)

Using the tcpdump utility, I see that the packets from SVXLink are very different from the packets from MMDVMHost. Even in size.

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

If I am remember when long time ago I play with python gateway from AnalogBridge to SVXLink the USRP protocol use audio with 8 khz but SVXLink via UDP accept audio with sample rate which defined in svxlink.conf CARD_SAMPLE_RATE where is 48 000 hz in most cases so for this reason maybe is different size of packet send data from svxlink and from MMVDMHost. So for this reason is incompatible sample rate audio where MMDVMHost should be send RAW with 48 kHz sample reate
I just assume that's the case

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

If am remember other my experience with svxlink via UDP. In svxlink.conf we use CARDS CHANNELS =1 so the UDP stream has 2016 bytes, so it looks that it is mono audio with one channel.

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

I'm no expert either)
The manual for SVXLink say:
The "udp" type is not really an audio device but instead will read and write audio from/to a UDP socket. This can be used to interface SvxLink to all sorts of audio sources/sinks capable of streaming raw audio through UDP. One example usage is to interface SvxLink with GNU Radio. Example: "udp:127.0.0.1:10000". Note however that the only supported format is raw 16 bit signed samples, two interleved channels. Sampling frequency can be chosen using the CARD_SAMPLE_RATE config variable as usual.

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Yes, so if use CARD_SAMPLE_RATE in [GLOBAL] settings like 48000 so svxlink will be used for receiving and transmitting in RAW Audio with sample rate 48000 Hz. In most cases sound cards which we use in svxlink use, 48000 Hz sample rate. So if MMDVMHost use sample rate which is used in USRP 8000 Hz we have incompatible sample rate audio data. So we need to add resample audio data via RAW UDP to 48000 hz

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

Looking for info from your tcpdump information about length

From MMDVM
19:07:34.732719 IP (tos 0x0, ttl 64, id 51052, offset 0, flags [DF], proto UDP (17), length 668)
From Svx
19:09:01.634316 IP (tos 0x0, ttl 64, id 64666, offset 0, flags [DF], proto UDP (17), length 2076)

it is confirmed that RAW UDP from MMDVM is sample rate 8000 Hz and from SVXlink is 48000 hz

@XATTA6
Copy link

XATTA6 commented Oct 17, 2023

Is it possible to increase the siple rate in mmdvmhost to 16000 or 48000, since the quality of speech is very low?

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

Now I add CARD_CHANNELS=1 parameter. And....

20:41:36.843420 IP (tos 0x0, ttl 64, id 62422, offset 0, flags [DF], proto UDP (17), ### length 1052)
localhost.39605 > localhost.3811: [bad udp cksum 0x021c -> 0xed42!] UDP, length 1024
0x0000: 0000 0000 0000 0000 0000 0000 0800 4500 ..............E.
0x0010: 041c f3d6 4000 4011 44f8 7f00 0001 7f00 ....@.@.D.......
0x0020: 0001 9ab5 0ee3 0408 021c 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 0000 ffff 0000 0000 ................
0x0040: 0000 0100 0200 0000 0000 0000 0000 ffff ................
0x0050: 0000 0000 0000 ffff ffff 0000 0100 0100 ................
0x0060: 0100 0000 0000 0000 0000 0000 0100 0000 ................
0x0070: ffff feff feff feff 0000 0000 0000 0000 ................
0x0080: 0000 0100 0200 0100 0100 0000 0000 0000 ................
0x0090: 0000 0000 ffff 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 feff feff 0000 0100 ................
0x00b0: 0000 0000 0000 0000 0100 0000 0000 ffff ................
0x00c0: 0000 0000 0000 0000 0000 0000 ffff 0000 ................
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00e0: 0000 0000 0000 0100 0000 0000 0000 0000 ................
0x00f0: 0000 0100 0000 ffff 0000 0000 0000 0000 ................
0x0100: 0000 ffff 0000 0000 0000 0000 ffff 0000 ................
0x0110: 0100 ffff feff 0000 0200 0300 0300 0100 ................
0x0120: 0000 0000 0000 0000 ffff ffff 0000 0100 ................
0x0130: 0100 0000 ffff feff 0000 0000 0000 0100 ................
0x0140: 0100 0000 ffff 0000 0100 0000 0000 ffff ................
0x0150: ffff 0000 0000 0000 0000 0000 ffff 0000 ................
0x0160: 0100 0100 0000 0000 0000 0100 ffff feff ................
0x0170: 0000 0000 0200 0300 0100 0000 0100 0100 ................
0x0180: 0000 0000 0000 0000 0000 ffff ffff 0000 ................
0x0190: 0000 0000 feff feff 0000 0100 0100 0000 ................
0x01a0: ffff 0000 0100 0200 0100 0000 ffff ffff ................
0x01b0: 0000 0000 ffff 0000 0000 ffff 0000 0000 ................
0x01c0: 0100 0100 0100 0000 0000 0000 0000 0100 ................
0x01d0: 0100 0000 feff feff 0000 0000 0000 ffff ................
0x01e0: 0000 0000 0000 0000 0000 0000 0000 0100 ................
0x01f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0200: 0000 0100 0100 0000 0000 0000 0000 0000 ................
0x0210: 0000 0000 0000 0000 0000 0000 0000 0100 ................
0x0220: 0000 ffff feff ffff 0000 0100 0100 0000 ................
0x0230: 0000 0000 0200 0100 feff fdff ffff 0000 ................
0x0240: 0000 0000 0000 0000 0100 0200 0100 0100 ................
0x0250: 0100 0000 0000 0000 0000 0000 ffff feff ................
0x0260: ffff ffff ffff 0000 0000 0000 0000 0200 ................
0x0270: 0000 feff 0000 0200 0100 0000 0000 0000 ................
0x0280: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0290: 0100 0100 0000 ffff feff ffff 0000 0000 ................
0x02a0: ffff 0000 0000 0000 0000 0000 0000 0000 ................
0x02b0: 0000 feff ffff 0000 0100 0000 ffff 0000 ................
0x02c0: 0100 0100 0100 0100 0000 ffff ffff ffff ................
0x02d0: 0000 0000 0000 0100 0200 0100 0000 ffff ................
0x02e0: 0000 ffff feff feff 0000 0100 0000 0000 ................
0x02f0: 0100 0200 0000 ffff 0000 0000 ffff 0000 ................
0x0300: 0000 0000 0000 0000 0000 0000 0000 ffff ................
0x0310: 0000 0000 0000 0000 0000 ffff ffff ffff ................
0x0320: ffff 0000 0100 0200 0100 0100 0200 0100 ................
0x0330: 0000 0000 ffff 0000 0100 0000 0000 0000 ................
0x0340: 0000 0000 0100 0000 0000 0000 0000 0000 ................
0x0350: 0100 0100 0000 0000 0000 0100 0000 ffff ................
0x0360: ffff ffff ffff 0000 0000 0000 0000 0000 ................
0x0370: ffff 0000 0000 0000 0100 0100 ffff 0000 ................
0x0380: 0100 0000 0000 0000 0000 0000 0000 0000 ................
0x0390: 0100 0000 ffff 0000 0100 0000 0100 0100 ................
0x03a0: 0000 0100 0100 0000 0000 ffff 0000 0100 ................
0x03b0: 0000 ffff 0000 0000 0000 0000 ffff feff ................
0x03c0: 0000 0000 0000 0000 0000 0000 0000 ffff ................
0x03d0: ffff 0000 0000 0100 0200 0000 ffff 0000 ................
0x03e0: 0000 0000 0000 0000 0000 0000 0000 ffff ................
0x03f0: 0000 0000 0000 0000 0000 ffff 0000 0100 ................
0x0400: 0000 0100 0200 0100 0100 0000 0000 0000 ................
0x0410: 0000 0000 0100 0100 0000 0000 ffff ffff ................
0x0420: 0000 0000 0000 0000 0000 ..........

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

We need to use in MMDVMHost in RAW UDP mode, 48000 Hz sample rate. CARD_CHANNELS=1 in svxlink only reduce to mono audio with 48000 sample rate

@EU4BNC
Copy link
Author

EU4BNC commented Oct 17, 2023

We need "resampler" in MMDVMHost)

@g4klx
Copy link
Owner

g4klx commented Oct 17, 2023

The quality of the speech at 8000 Hz sample rate is the same as at 48000 Hz sample rate as the audio is limited to 3 kHz which is below the Nyquist limit. I will have to add a resampler to get up to 48000 Hz sample rate, should I also change from stereo to mono audio only?

@sp2ong
Copy link

sp2ong commented Oct 17, 2023

I assume that mono is sufficient because in most cases we use CARD_CHANNEL=1 so it is in mono mode

@sp2ong
Copy link

sp2ong commented Oct 18, 2023

I have use udp audio in svxlink with my dashbaord svxlink to listen stream from svxlink and working very well.

@sp2ong
Copy link

sp2ong commented Oct 18, 2023

SVXLink with UDP RX and TX works good with GnuRadio:
https://www.pg540.org/wiki/index.php/LimeSDR_interface_to_SVXlink_using_GNUradio
Maybe MDVMHost expects that the SOURCE port from svxlink will be the one specified in [FM Network] in LocalPort?? but svxlink uses source port random

@g4klx
Copy link
Owner

g4klx commented Oct 18, 2023 via email

@EU4BNC
Copy link
Author

EU4BNC commented Oct 18, 2023

When analyzing the traffic, it is clear that data for MMDVMHost leaves from a different port (the port is different from the one specified in Gateway).

Here is an example package from MMDVMHost in SVXLink. Port 3811(mmdvmhost) sends data to port 4811(SVX).
19:18:40.398721 IP (tos 0x0, ttl 64, id 8543, offset 0, flags [DF], proto UDP (17), length 668)
localhost.3811 > localhost.4811: [bad udp cksum 0x009c -> 0x6b7c!] UDP, length 640

Here is an example package from SVXLink at MMDVMHost.

Port !!!39605(SVX) sends data to port 3811(MMDVMHost)

20:41:36.843420 IP (tos 0x0, ttl 64, id 62422, offset 0, flags [DF], proto UDP (17), ### length 1052)
localhost.39605 > localhost.3811: [bad udp cksum 0x021c -> 0xed42!] UDP, length 1024

SVXLink port is 4811, but outgoing data comes from port 39605. Outgoing port may be different for each transmission.

@EU4BNC
Copy link
Author

EU4BNC commented Oct 18, 2023

Is it possible to make a function to disable protection?

@g4klx
Copy link
Owner

g4klx commented Oct 18, 2023 via email

@EU4BNC
Copy link
Author

EU4BNC commented Oct 18, 2023

Thank you very much, I'll try it now.

@EU4BNC
Copy link
Author

EU4BNC commented Oct 18, 2023

Great! First success! The data went from SVXLink to MMDVMHost correctly, all that remains is to figure out why SVXLink does not respond to data from MMDVMHost.

@sp2ong
Copy link

sp2ong commented Oct 18, 2023 via email

@EU4BNC
Copy link
Author

EU4BNC commented Oct 22, 2023

I would like to express my deep gratitude for the work done, the addition of the RAW protocol and Resampler.

@EU4BNC
Copy link
Author

EU4BNC commented Oct 22, 2023

We can ask you to add one more modification. SVXLink incorrectly handles SQUELCH DETECTION when traffic on the incoming port is lost. This causes SQUELCH to open when traffic appears and not close when traffic disappears. SVXLink has the ability to control SQUELCH via PTY. If "O" is received on the PTY device (e.g. PTY_PATH=/tmp/sql), SQUELCH will be opened, if "Z" is sent to the device (e.g. PTY_PATH=/tmp/sql), SQUELCH will be closed. Is it possible to add external SQUELCH control via PTY to MMDVMHost? After the traffic starts broadcasting to the Gateway port, we will send O to PTY. Before the end of broadcasting packets to PTY, we will send Z.

GATEWAY_SQL_PTY=/tmp/sql
GATEWAY_SQL_PTY_OPEN=O
GATEWAY_SQL_PTY_CLOSE=Z

@EU4BNC
Copy link
Author

EU4BNC commented Oct 22, 2023

This is an extract from the SVXLINK instructions:
The PTY squelch expects a very easy protocol over a pseudo-tty device, created by SvxLink on runtime. An ’O’ over this pty device indicate an open squelch, a ’Z’ is a closed squelch. Define the slave pty in PTY_PATH (e.g. PTY_PATH=/tmp/sql) and SvxLink will create a link to the specified path from it’s pseudotty slave device (/dev/pts/X). This can be used by a script to interface custom devices, modems or other hardware to SvxLink. Look for nhrcx.pl to see an example.

@shawnchain
Copy link
Contributor

I think this could be move to a SVXNetwork.
BTW, I would like to ask if any have any doc about the FM 'USRP' protocol ?
Currently I'm using the FMNetwork in another situation to communicate with my own implementation of FMReflector. I found the simple USRP is lacking of ping/keep-alive mechanism, nor could I find any clue about FM 'USRP' protocol.

@sp2ong
Copy link

sp2ong commented Oct 24, 2023

We discussed this problem sm0svx/svxlink#644
It looks like svxlink required incoming UDP audio with an option which is used in svxlink ASYNC_AUDIO_UDP_ZEROFILL
AudioDeviceUDP can now write zeros to the UDP connection on underflow.
That is, when the "audio device" is open but there is no audio to write zeros will be written instead. Enable this behavior by setting the environment variable ASYNC_AUDIO_UDP_ZEROFILL=1

But how to do/implement this in a UDP stream in MDVMHost, I don't know.

We want to inerconnect MMDVMHost in FM MODE with svxlink via RAW UDP because at the current branch svxlink USRP not support decoding DTMF via USRP and does not send any audio message from modules etc. RAW UDP Audio will allow full integration MMDVMHost with the possibility svxlink.
We use SVXReflector with svxlink which has a nice possibility in FM Network for example you can see on the example dashboard FM Network: https://svxportal.sm2ampr.net/ or http://www.fm-poland.pl/dashboard/

@sp2ong
Copy link

sp2ong commented Oct 24, 2023

It appears that the audio from MDVMHost is being sent as much as it has and SVXLink is expecting a full buffer? and if the incoming sound does not fill the full buffer, it waits and therefore is not able to consider that "SQL" is closed. But I am just guessing that this is what happens

@g4klx
Copy link
Owner

g4klx commented Oct 24, 2023 via email

@sp2ong
Copy link

sp2ong commented Oct 24, 2023

I don't know, but I assume that based on the behavior of receiving UDP RAW audio when the TX option ASYNC_AUDIO_UDP_ZEROFILL=1 is used and then it works. Opening and closing SQL and when I do not use the ASYNC_AUDIO_UDP_ZEROFILL option, i.e. I set it to 0, then when AUDIO comes there is information about opening SQL and after the UDP transmission is completed, there is no information about closing the SQL, which blocks further operation. Probably the author of svxlink would answer these doubts...

@g4klx
Copy link
Owner

g4klx commented Oct 25, 2023

I've added the squelch file handling. Can you give it a try and report back please?

@EU4BNC
Copy link
Author

EU4BNC commented Oct 25, 2023

I've added the squelch file handling. Can you give it a try and report back please?

I'll try it ib evening and report here. Thanks to you!

@EU4BNC
Copy link
Author

EU4BNC commented Oct 25, 2023

I've added the squelch file handling. Can you give it a try and report back please?

I'm sorry, could you please explain how this setting works and what should be in the sql file.

@sp2ong
Copy link

sp2ong commented Oct 25, 2023

You must add in MMDVM.ini SquelchFile

[FM Network]
SquelchFile=/tmp/sql
....

and in svxlink.conf in [Rx1]

SQL_DET=PTY
PTY_PATH=/tmp/sql

Note that MDVMHost and svxlink should be run by the same user due to the /tmp/sql PTY device permissions

Tell us whether the new solutions added by Jonathan work for you now.

Thanks, Jonathan, for your support

@EU4BNC
Copy link
Author

EU4BNC commented Oct 25, 2023

You must add in MMDVM.ini SquelchFile

[FM Network]

The squelch file is optional and only used in RAW mode

SquelchFile=/tmp/sql ....

and in svxlink.conf in [Rx1]

SQL_DET=PTY PTY_PATH=/tmp/sql

Note that MDVMHost and svxlink should be run by the same user due to the /tmp/sql PTY device permissions

Tell us whether the new solutions added by Jonathan work for you now.

Thanks, Jonathan, for your support
Understood. Thanks, I'll try it now. Thanks to the developer for your support!

@EU4BNC
Copy link
Author

EU4BNC commented Oct 25, 2023

I've added the squelch file handling. Can you give it a try and report back please?

Thanks a lot! It works!

@g4klx
Copy link
Owner

g4klx commented Oct 25, 2023

Wow! Let me know if you need any more changes for it.

Maybe you can make an announcement on the OpenDV group and maybe a small guide on how to configure it, and what you can use it for.

Would that be possible?

@EU4BNC
Copy link
Author

EU4BNC commented Oct 25, 2023

Wow! Let me know if you need any more changes for it.

Maybe you can make an announcement on the OpenDV group and maybe a small guide on how to configure it, and what you can use it for.

Would that be possible?

Yes, I will prepare a text to present this project a little later. Once again, thank you very much for your support and improvements.
I will also have one more question regarding oddities in the quality of transmission of the audio stream to the network. I'll describe it a little later, I think it's related to the STM firmware.

Currently, our repeater network has MMDVM equipment installed with MOTOROLLA GM and CM series radios. DMR switching is carried out via Brandmeister and XLX. Analog traffic is switched through the SVXLink server with the ability to control groups via DTMF. This is such an interesting symbiosis.

@f4hlv
Copy link
Contributor

f4hlv commented Oct 27, 2023

Hi, thank you once again for the work done.
The audio works but it's still a little cut up.
Managing squelch SQL_DET=PTY can be complicated to implement svxlink and mmdvmhost are not on the same machine.
I noticed that when I trigger analog mode with mmdvmhost after several hours, the relay sends all the svxlink ID beacons that have not been transmitted. It's like buffering.

A good alternative would be to be able to link svxreflector with the OPUS codec.

Thanks again, this is a project I've been waiting for for a long time.
Vincent

@sp2ong
Copy link

sp2ong commented Oct 27, 2023

A good alternative would be to be able to link svxreflector with the OPUS codec.

I think that such a solution is not realistic because you would have to implement the entire mechanism for handling communication with svxreflector, which is in svxlink, and you would have to constantly monitor changes in the svxlnik code to have a current implementation of such a solution, and this is not the goal of MDVMHost. MDVMHost can send the analog audio stream to software such as svxlink and it takes care of the rest of the implementation of communication with svxrelfector, group management, etc.
Rather, the author of svxlink could also show interest in solving any problems in the integration of this solution. We had a long discussion on github svxlink about this topic, but unfortunately there is no response from the author of svlink, even advice on how to approach this problem.

@XATTA6
Copy link

XATTA6 commented Oct 27, 2023

hello everyone! I have svxlibk in analog mode, after refining mmdvmhost, I want to note that I really like the sound quality coming through udp, I have the same board myself and I think that the work done is just fine, we got dtmf and alerts plus the quality standards, which are controlled through mmdvmhost and svxlibk, so those who don't like the changes I suggest not to use them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants