audio for VOIP - filter and resample or viceversa?

I am a noob to signal processing, but I need to create some audio files for IVR for Asterisk VOIP.

So my lady friend with a nice voice records her message on a Windows machine and sends me a 44KHz, stereo 32bit wav file.

I currently squash it into a 8KHz, mono, 16bit signed wav file for Linux, and then convert the wav to alaw or ulaw PCM format.

One source of info for this process is this link.

I can do some magic with Audacity:

1. Stereo to mono
2. Equalize, using a "voip" or "telephone" filter: discard anything over 3KHz and under 300Hz.
3. compress volume/levels to -12 to -15 dB
4. Resample 44 -> 8KHz
5. Export as 16bit signed PCM wav
6. Move it to Linux and sox it to alaw or ulaw

The result is acceptable, but I feel it could be improved. In particular, after resampling, the voice sounds muffled.

Is this order correct?

Do you have suggestions to get better results?

Your order is fine. The biggest question I have is with,

1. Equalize, using a "voip" or "telephone" filter: discard anything over 3KHz and under 300Hz.

Since you are resampling to 8 kHz in step 4, you already have less than 4 kHz, I don't see the point in the 3 kHz limit. And knowing nothing about the 3 kHz filtering you're using, I wonder how much intelligibility you're losing in that step. This is easy enough for you to test.

I believe you'll get better quality but less dynamic range with ulaw, compared to alaw. Other than this, the compression (step 3) is probably the next most important aspect to experiment with.

The rule is you must always filter before sampling.

That rule stands whether you are filtering and then sampling an analog signal, or filtering and then resampling a digital signal.

Your filter must cut off at half the sampling rate.

Why is your content muffled? I would guess an insufficient amount of higher frequency content permitting definition to the speech.

You should not have to compress the audio signal. Check your microphone level and adjust, so that the signal does not clip at 0dB. The level meter of any modern Windows machine will show when this happens. The reason for your muffled sound is that the filter needs to be done as apart of the re-sampling process. This is because the filter is used as an interpolator that will pick which samples to keep and discard the rest. It also needs to be low-pass filter when resampling downward to prevent aliasing. Not sure if band passing beforehand will do the same. I would set the high frequency at 8 kHz to preserve the frequency range. The Nyquist theory states that sound must be sampled at over twice the highest frequency to preserve the signal. Hopefully these suggestions will improve your results. I prefer doing my resampling and other digital signal processing via source code, which I do not distribute freely.

                               Regards,

thomasjonkeratyahoodotcom

• I disagree with, "The reason for your muffled sound is that the filter needs to be done as apart of the re-sampling process." Particularly, to your comment, "It also needs to be low-pass filter when resampling downward to prevent aliasing": "resampling" includes the lowpass/interpolation filter, so this is already accounted for in his step in Audacity. – Nigel Redmon Apr 21 '20 at 23:43