wav2rtp


A tool to generate RTP data packets and save into pcap file. Can emulate network delays and losses.


Usage samples

It's interesting to see what useful we can do with wav2rtp utility. My first goal is to study how network perturbations affects voice quality. With this tool it's possible to examine two impacts: network losses and network delays. Currently it's possible to experiment with four codecs: G.711a, G.711u, Speex and GSM 06.10.

The tool pesqmain which implements PESQ algorithm were used to estimate the quality of the all output speech samples below. As reference speech fragment the part of Mark Shuttleworth's interview was given.

Experiment 1. How network losses affects speech quality

We use file sample.wav as reference. Then we pass this speech sample through wav2rtp with filter "independent packet losses" turned on and compare source and degraded file with pesqmain utility.

Table 1: Independent network losses influation on the output speech quality (G.729u)

Loss rate (%) 0 1 2 3 4 5 10 15 20
Output speech quality (PESQ MOS) 4.474 3.881 3.151 2.836 2.836 2.595 1.900 1.493 1.156

There is a graph below which demonstrates quality toll when network lossess grows up.

Picture 1: Independent network losses influation on the output speech quality (G.729u) Image

Some process explanation is required.

The main priciple to work with wav2rtp is to enable one or more filters, set up these parameters and obtain a result in pcap or wav format. The one strange feature of the wav2rtp is that this tool always produce pcap file. Additionally you can request file in normal wav format.

Look into /usr/local/etc/wav2rtp/output.conf to see all possible filters and its parameters. You may change these settings in the config directly and permanently or use more convenient command-line option "-o" to override.

So, we want now to enable filter "independent_losses" and set up its parameter "loss_rate" to 0.XX (from 0 to 1). Corresponding option set looks like this:

-o independent_losses:enabled=true -o independent_losses:loss_rate=0.XX

The second thing we have to do is to set up output filename:

-o wavfile_output:filename=sample_XX.wav

The third thing, we need to suppress pcap output, let's do it dirty:

-t /dev/null

Other options, I guess, are self-explained. In total we produce this large command

    wav2rtp -f sample.wav -t /dev/null -c PCMU \
    -o independent_losses:enabled=true \
    -o independent_losses:loss_rate=0.XX \
    -o wavfile_output:filename=sample_XX.wav

I wrote a small script to fill the table below:

#!/bin/bash

for i in 00 01 02 03 04 05 10 15 20; do
    wav2rtp -f sample.wav -t /dev/null -c PCMU \
        -o independent_losses:enabled=true \
        -o independent_losses:loss_rate=0.$i \
        -o wavfile_output:filename=sample_$i.wav
done

Note that you should download from here and compile the pesqmain utility independently.