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 thealoop
driver per https://www.alsa-project.org/wiki/Matrix:Module-aloopaplay -l
andarecord -l
should show you now have the relevantLoopback
devicesYou may need to install
alsa-utils
if you don’t havearecord
oraplay
The devices (I think that’s the right term?) are of the format
Loopback,X,Y
where Y is the subchannel; audio from0,Y
is output to1,Y
and vice versa
gen_packets -o x.wav
(packaged withdirewolf
) will produce you some test packet data inx.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 toy.wav
In another session then
aplay -D plughw:Loopback,0,0 x.wav
to play the test dataTerminate the
arecord
onceaplay
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
- 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!