g4klx / MMDVMHost

The host program for the MMDVM
GNU General Public License v2.0
378 stars 274 forks source link

FM Network with RAW audio through UDP. #782

Closed EU4BNC closed 9 months ago

EU4BNC commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

sp2ong commented 1 year ago

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

TUAPSE commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

g4klx commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Hi EU4BNC

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

EU4BNC commented 1 year ago

[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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

EU4BNC commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

We need "resampler" in MMDVMHost)

g4klx commented 1 year ago

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 commented 1 year ago

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

EU4BNC commented 1 year ago

Maybe it's worth adding 2 parameters to .ini resamplerto= and stereoON= ?

sp2ong commented 1 year ago

In my opinion, we should use in svxlink .conf in [GLOBAL] CARD_SAMPLE_RATE=48000 CARD_CHANNEL=1

with link to MDVMHost in FM MODE use RAW UDP audio stream. We can add maybe short info in MMDVM.ini in comment about RAW UDP (48000 Hz, Mono)

sp2ong commented 1 year ago

Maybe it's worth adding 2 parameters to .ini resamplerto= and stereoON= ?

but options are useful but need more add code :-)

EU4BNC commented 1 year ago

Yes, I understand, but it will be easier to find the right option.

sp2ong commented 1 year ago

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.

Hi, Can you write more about LinkMode? What does "with almost no logic operation" mean?

in MMDVM.ini is LinkMode=1 to remove almost all of the logic control

I try to understand these options better. I am asking about this because we only pass stream audio via UDP and on svxlink we need setup method control SQUELCH to check that is open. When we have only stream audio via UDP we can use the SQL detect method, which uses VOX, but the method is not the best. But SVXLink has an option to detect CTCSS tone as SQUELCH is open so if we can pass CTCSS tone in RAW audio (so we can use for this LinkMode option?) we can set up quite a good method to check that SQUELCH is open and use SQL_DET=CTCSS it is a better method than VOX. SVXLink have a possibility similar in [FM Network] switch on PRE/DE-Emphasis filtering so we can pass "FLAT Audio" to svxlink and use this option instead in [FM Network] if this is necessary

g4klx commented 1 year ago

I cannot answer any questions about SVXLink. The MMDVM must be able to detect the CTCSS as that is needed so that it can handle multimode operation properly. The MMDVM will only send UDP data when a valid signal has been detected, not just white noise, so VOX will also work perfectly. It is a pity that SVXLink doesn't operate with USRP properly in the main branch as that is the best option.

I am willing to make certain changes to the MMDVM but other people are also using it in other ways and I will not make changes that affect their usage of the system, so SVXLink must do some of the work also.

sp2ong commented 1 year ago

Thank you for the explanation and I agree with what you wrote

sp2ong commented 1 year ago

In summary, minimal support for svxlink to use RAW Audio with a sampling rate of 48000 Hz, mono (one channel) sent via UDP from MDVMHost. Thanks

XATTA6 commented 1 year ago

Will there be a version of mmdvmhost with support for sample rate 16000 or 48000 over the raw protocol in the near future?

g4klx commented 1 year ago

If you look on GitHub, you can now set the sample rate in RAW mode. Give it a try and see what happens please.

Sent from Yahoo Mail for iPhone

On Wednesday, October 18, 2023, 12:16, EU2AU @.***> wrote:

Will there be a version of mmdvmhost with support for sample rate 16000 or 48000 over the raw protocol in the near future?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XATTA6 commented 1 year ago

What SampleRate range is available in the [FM Network] section, for example 16000, 8000, 48000? Or can I enter this value manually?

g4klx commented 1 year ago

Enter any value, it uses a re sampler library to do the work. I made 48000 the default as that is what SVXLink required I think.

Sent from Yahoo Mail for iPhone

On Wednesday, October 18, 2023, 15:51, EU2AU @.***> wrote:

What SampleRate range is available in the [FM Network] section, for example 16000, 8000, 48000? Or can I enter this value manually?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

XATTA6 commented 1 year ago

While compiling mmdvmhost a have errors: In file included from FMControl.h:22, from FMControl.cpp:19: FMNetwork.h:25:10: fatal error: samplerate.h: No such file or directory 25 | #include

What can i install to complete compile?

g4klx commented 1 year ago

You need to find libsamplerate on your system and install it.

Sent from Yahoo Mail for iPhone

On Wednesday, October 18, 2023, 16:11, EU2AU @.***> wrote:

While compiling mmdvmhost a have errors: In file included from FMControl.h:22, from FMControl.cpp:19: FMNetwork.h:25:10: fatal error: samplerate.h: No such file or directory 25 | #include

What can i install to complete compile?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

sp2ong commented 1 year ago

While compiling mmdvmhost a have errors: In file included from FMControl.h:22, from FMControl.cpp:19: FMNetwork.h:25:10: fatal error: samplerate.h: No such file or directory 25 | #include

What can i install to complete compile?

You must install samplerate lib:

sudo apt install libsamplerate0-dev

EU4BNC commented 1 year ago

Under what conditions does MMDVMHost make such an entry in the log? M: 2023-10-18 17:17:47.813 FM packet received from an invalid source

sp2ong commented 1 year ago

Hi, I have the same "problem" ? I don't know what this information in the log means.

I: 2023-10-18 17:47:40.360 MMDVMHost-20231017 is starting I: 2023-10-18 17:47:40.360 Built 17:19:49 Oct 18 2023 (GitID #e91f640) I: 2023-10-18 17:47:40.360 General Parameters I: 2023-10-18 17:47:40.360 Callsign: SP2ONG I: 2023-10-18 17:47:40.360 Id: 123456 I: 2023-10-18 17:47:40.361 Duplex: yes I: 2023-10-18 17:47:40.361 Timeout: 180s I: 2023-10-18 17:47:40.361 D-Star: disabled I: 2023-10-18 17:47:40.361 DMR: disabled I: 2023-10-18 17:47:40.361 YSF: disabled I: 2023-10-18 17:47:40.361 P25: disabled I: 2023-10-18 17:47:40.361 NXDN: disabled I: 2023-10-18 17:47:40.361 M17: disabled I: 2023-10-18 17:47:40.361 POCSAG: disabled I: 2023-10-18 17:47:40.361 FM: enabled I: 2023-10-18 17:47:40.361 AX.25: disabled I: 2023-10-18 17:47:40.361 Modem Parameters I: 2023-10-18 17:47:40.361 Protocol: uart I: 2023-10-18 17:47:40.361 UART Port: /dev/ttyACM0 I: 2023-10-18 17:47:40.361 UART Speed: 460800 I: 2023-10-18 17:47:40.361 RX Invert: no I: 2023-10-18 17:47:40.361 TX Invert: yes I: 2023-10-18 17:47:40.361 PTT Invert: no I: 2023-10-18 17:47:40.361 TX Delay: 100ms I: 2023-10-18 17:47:40.361 RX Offset: 0Hz I: 2023-10-18 17:47:40.361 TX Offset: 0Hz I: 2023-10-18 17:47:40.361 RX DC Offset: 0 I: 2023-10-18 17:47:40.361 TX DC Offset: 0 I: 2023-10-18 17:47:40.361 RF Level: 100.0% I: 2023-10-18 17:47:40.361 DMR Delay: 0 (0.0ms) I: 2023-10-18 17:47:40.361 RX Level: 50.0% I: 2023-10-18 17:47:40.361 CW Id TX Level: 50.0% I: 2023-10-18 17:47:40.361 D-Star TX Level: 50.0% I: 2023-10-18 17:47:40.361 DMR TX Level: 50.0% I: 2023-10-18 17:47:40.361 YSF TX Level: 50.0% I: 2023-10-18 17:47:40.361 P25 TX Level: 50.0% I: 2023-10-18 17:47:40.361 NXDN TX Level: 50.0% I: 2023-10-18 17:47:40.361 M17 TX Level: 50.0% I: 2023-10-18 17:47:40.361 POCSAG TX Level: 50.0% I: 2023-10-18 17:47:40.361 FM TX Level: 50.0% I: 2023-10-18 17:47:40.361 AX.25 TX Level: 50.0% I: 2023-10-18 17:47:40.361 TX Frequency: 435000000Hz (435000000Hz) I: 2023-10-18 17:47:40.361 Use COS as Lockout: no I: 2023-10-18 17:47:40.361 FM Parameters I: 2023-10-18 17:47:40.361 Callsign: SP2ONG I: 2023-10-18 17:47:40.362 Callsign Speed: 20WPM I: 2023-10-18 17:47:40.362 Callsign Frequency: 1000Hz I: 2023-10-18 17:47:40.362 Callsign Time: 10mins I: 2023-10-18 17:47:40.362 Callsign Holdoff: 1/0 I: 2023-10-18 17:47:40.362 Callsign High Level: 50.0% I: 2023-10-18 17:47:40.362 Callsign Low Level: 20.0% I: 2023-10-18 17:47:40.362 Callsign At Start: no I: 2023-10-18 17:47:40.362 Callsign At End: no I: 2023-10-18 17:47:40.362 Callsign At Latch: no I: 2023-10-18 17:47:40.362 RF Ack: K I: 2023-10-18 17:47:40.362 Ack Speed: 20WPM I: 2023-10-18 17:47:40.362 Ack Frequency: 1750Hz I: 2023-10-18 17:47:40.362 Ack Min Time: 4s I: 2023-10-18 17:47:40.362 Ack Delay: 1000ms I: 2023-10-18 17:47:40.362 Ack Level: 50.0% I: 2023-10-18 17:47:40.362 Timeout: 180s I: 2023-10-18 17:47:40.362 Timeout Level: 80.0% I: 2023-10-18 17:47:40.362 CTCSS Frequency: 88.5Hz I: 2023-10-18 17:47:40.362 CTCSS High Threshold: 30 I: 2023-10-18 17:47:40.362 CTCSS Low Threshold: 30 I: 2023-10-18 17:47:40.362 CTCSS Level: 20.0% I: 2023-10-18 17:47:40.362 Kerchunk Time: 30s I: 2023-10-18 17:47:40.362 Hang Time: 30s I: 2023-10-18 17:47:40.362 Access Mode: 1 I: 2023-10-18 17:47:40.362 Link Mode: no I: 2023-10-18 17:47:40.362 COS Invert: no I: 2023-10-18 17:47:40.362 Noise Squelch: no I: 2023-10-18 17:47:40.362 RF Audio Boost: x1 I: 2023-10-18 17:47:40.362 Max. Deviation Level: 90.0% I: 2023-10-18 17:47:40.362 Mode Hang: 10s I: 2023-10-18 17:47:40.362 Ext. Ack: N I: 2023-10-18 17:47:40.362 Ext. Audio Boost: x1 M: 2023-10-18 17:47:40.362 Opening the MMDVM I: 2023-10-18 17:47:42.377 MMDVM protocol version: 2, description: MMDVM 20221121 12.0000 MHz GitID #508018c I: 2023-10-18 17:47:42.377 CPU: ST-Micro ARM, UDID: 4B0025000351383032333330 I: 2023-10-18 17:47:42.377 Modes: DMR FM I: 2023-10-18 17:47:42.438 Display Parameters I: 2023-10-18 17:47:42.438 Type: None W: 2023-10-18 17:47:42.438 No valid display found, disabling I: 2023-10-18 17:47:42.438 Opening network connections I: 2023-10-18 17:47:42.438 FM Network Parameters I: 2023-10-18 17:47:42.438 Protocol: RAW I: 2023-10-18 17:47:42.438 Sample Rate: 48000 I: 2023-10-18 17:47:42.438 Gateway Address: 127.0.0.1 I: 2023-10-18 17:47:42.438 Gateway Port: 4810 I: 2023-10-18 17:47:42.438 Local Address: 127.0.0.1 I: 2023-10-18 17:47:42.438 Local Port: 3810 I: 2023-10-18 17:47:42.438 Pre-Emphasis: yes I: 2023-10-18 17:47:42.439 De-Emphasis: yes I: 2023-10-18 17:47:42.439 TX Audio Gain: 1.00 I: 2023-10-18 17:47:42.439 RX Audio Gain: 0.20 I: 2023-10-18 17:47:42.439 Mode Hang: 3s M: 2023-10-18 17:47:42.439 Opening FM network connection I: 2023-10-18 17:47:42.439 Opening UDP port on 3810 I: 2023-10-18 17:47:42.439 RSSI I: 2023-10-18 17:47:42.439 Mapping File: RSSI.dat I: 2023-10-18 17:47:42.439 Loaded 0 RSSI data mapping points from RSSI.dat I: 2023-10-18 17:47:42.439 Starting protocol handlers I: 2023-10-18 17:47:42.439 MMDVMHost-20231017 is running M: 2023-10-18 17:51:22.244 FM packet received from an invalid source M: 2023-10-18 17:51:22.265 FM packet received from an invalid source ......

EU4BNC commented 1 year ago

I feel that the developer SVXLink needs to be involved here.

sp2ong commented 1 year ago

But we also need to know what this entry in the MDVMHost log means

M: 2023-10-18 17:51:22.265 FM packet received from an invalid source

Without this information, it will be difficult to solve the problem

sp2ong commented 1 year ago

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