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_aloopto load thealoopdriver per https://www.alsa-project.org/wiki/Matrix:Module-aloopaplay -landarecord -lshould show you now have the relevantLoopbackdevicesYou may need to install
alsa-utilsif you don’t havearecordoraplayThe devices (I think that’s the right term?) are of the format
Loopback,X,Ywhere Y is the subchannel; audio from0,Yis output to1,Yand vice versa
gen_packets -o x.wav(packaged withdirewolf) will produce you some test packet data inx.wavatest x.wavwill check the test data you just generated
Then to actually test transmission:
In one session
arecord -D plughw:Loopback,1,0 -f cd y.wavto start recording toy.wavIn another session then
aplay -D plughw:Loopback,0,0 x.wavto play the test dataTerminate the
arecordonceaplayhas 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
- Then verify received data with
DireWolf setup
A basic test setup looks like:
1 # Input 0,1 Output 1,0
2 ADEVICE plughw:Loopback,0,1 plughw:Loopback,1,0
3
4 # Explicit AGW/KISS ports to not conflict
5 AGWPORT 5000
6 KISSPORT 6000
7
8 # Send some periodic test data
9 MYCALL XXXXX-10
10 CBEACON delay=0:10 every=0:10 info=0
1 # Input 0,0 Output 1,1
2 ADEVICE plughw:Loopback,0,0 plughw:Loopback,1,1
3
4 # Explicit AGW/KISS ports to not conflict
5 AGWPORT 5001
6 KISSPORT 6001
7
8 # Send some periodic test data
9 MYCALL XXXXX-11
10 CBEACON delay=0:10 every=0:10 info=1
You can then run these with:
# 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!