DireWolf with ALSA Loopback Devices =================================== As part of poking around with Packet setups, I wanted to be able to easily test things by running two DireWolf instances communicating locally. Unfortunately while DireWolf can use a UDP socket or ``stdin`` for *input*, it will only output to a sound device. Fortunately we can fake sound devices, thanks to `ALSA's snd-aloop `_ (This is all on Debian GNU/Linux; you can probably do something similar on macOS with Loopback / BlackHole; I have no idea about Windows) Basic setup and testing ----------------------- * ``sudo modprobe snd_aloop`` to load the ``aloop`` driver per https://www.alsa-project.org/wiki/Matrix:Module-aloop * ``aplay -l`` and ``arecord -l`` should show you now have the relevant ``Loopback`` devices * You may need to install ``alsa-utils`` if you don't have ``arecord`` or ``aplay`` * The devices (I think that's the right term?) are of the format ``Loopback,X,Y`` where Y is the subchannel; audio from ``0,Y`` is output to ``1,Y`` and vice versa * ``gen_packets -o x.wav`` (packaged with ``direwolf``) will produce you some test packet data in ``x.wav`` * ``atest x.wav`` will check the test data you just generated Then to actually test transmission: * In one session ``arecord -D plughw:Loopback,1,0 -f cd y.wav`` to start recording to ``y.wav`` * In another session then ``aplay -D plughw:Loopback,0,0 x.wav`` to play the test data * Terminate the ``arecord`` once ``aplay`` has finished * Then verify received data with ``atest y.wav`` * Sometimes I lose the last packet here - haven't quite figured out why * This probably isn't entirely correct/optimal in terms of channel and quality etc. but it works Well Enough DireWolf setup -------------- A basic test setup looks like: .. code-block:: ini :linenos: :caption: direwolf0.conf # Input 0,1 Output 1,0 ADEVICE plughw:Loopback,0,1 plughw:Loopback,1,0 # Explicit AGW/KISS ports to not conflict AGWPORT 5000 KISSPORT 6000 # Send some periodic test data MYCALL XXXXX-10 CBEACON delay=0:10 every=0:10 info=0 .. code-block:: ini :linenos: :caption: direwolf1.conf # Input 0,0 Output 1,1 ADEVICE plughw:Loopback,0,0 plughw:Loopback,1,1 # Explicit AGW/KISS ports to not conflict AGWPORT 5001 KISSPORT 6001 # Send some periodic test data MYCALL XXXXX-11 CBEACON delay=0:10 every=0:10 info=1 You can then run these with: .. code-block:: shell # Session 0 # Run direwolf dumping packets, with text colours off, reporting audio stats every 30s $ direwolf -dp -t 0 -a 30 -c direwolf0.conf # Session 1 # Run direwolf dumping packets, with text colours off, reporting audio stats every 30s $ direwolf -dp -t 0 -a 30 -c direwolf1.conf And you'll have two DireWolf instances beaconing at each other through your loopback audio interfaces!