Best decoder for low samplerate wavs?

MOC version: 

I have some wavs recorded by my asterisk PBX voicemail. They are 16bit 8Khz single channel mono. If I play them in aplay or mplayer they sound very clear and crisp (in the left channel), but in moc they sound muffled. It mixes the single channel mono into 2 channel mono too.

I have ResampleMethod set to SincBestQuality and I've tried setting the PreferredDecoder to modplug, sndfile, wavpack and ffmpeg, and tried it unset. The wavs only show in moc with sndfile and ffmpeg.

Decoder plugins: aac ffmpeg flac modplug mp3 sndfile speex vorbis

Is there another decoder I can use to play wavs other than sndfile and ffmpeg?


If I switch SoundDriver to alsa it sounds much much better. Normally I use jack, which has been great so far.

Alsa goes through jack via a Loopback.

Never used Jack, sounds like a bug in Jack output plugin in MOC.

As for decoders, only sndfile and ffmpeg can handle wavs. Wavpack is completely different format ( and modplug is for Amiga-style module files (

This would indicate the problem is not in the decoder, and I've certainly had no problems playing mono audio via ALSA.

I do not use Jack either and am therefore unable to test this, but I'll alert the original author of the MOC Jack sound driver and see if he can help (but it's been 15 years since he contributed it).

That's a long time indeed.

I'm using what was once known as jack2, but is now known as jack, which is supposed to be compatible with the old jack, aka jack-audio-connection-kit, which I would guess the jack module is written for.

Can you post a couple of these problematic files somewhere so I can try them out?

That's a bit difficult because they are rather personal.

This is what ffprobe says they are though:

Input #0, wav, from '2020-04-16.wav':
Duration: 00:01:39.48, bitrate: 128 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, 1 channels, s16, 128 kb/s

If you really need one to play with I might be able to make one without any personal info.

I've verified that this happens on my system as well, i just resampled some audio to 8k mono and listened with both pulse audio and jack, jack is muffled for sure.

Good work, "xnor". Given that "slackhead" says that other players do not have the problem, the finger is now pointing at MOC's Jack sound driver.

Are you able to investigate further?

is there a way to make the ALSA driver run at 44.1k stereo like jack would so it would have to use the resampling code?

I've looked into the code for a bit and this really feels like something in the sample rate conversion code and not the jack code.
All the jack playback driver does is scale the audio samples its given and write those to jack's output.
The difference with the ALSA driver (which I assume pulse uses) is that moc sets up ALSA to do its own resampling and channel conversion, where as the jack driver requires that moc do the resampling internally as it runs at a fixed sample rate and number of channels.

Check to see if setting the MOC option ForceSampleRate does the job.

If you want to investigate things around resampling code, I have been playing around it for some time in the past and toyed with adding support of different resampling libraries to MOC (speex, soxr and libzita). You can check it out in a branch of my personal experimental repo:

No luck with forcing the sample rate I'm afraid.

I tried all the combos I could think of - 8000, 44100, 48000, and tried them with jack running at both 44100 and 48000.

I have speex written in the comments for PreferredDecoders so I thought it already supported it.

I don't suppose theres a way to see what decoder is in use while playback is happening?

Well I guess it's not a huge problem. It just means that I quit, pkill mocp, mocp -R Alsa, then playback the recordings. Then do the same (almost) to start using jack again.

Another option is to use an alsa loopback with jack, and just use alsa all the time. (I don't use pulse by the way, only pure alsa.)

I'm still looking to try and find out where it's going wrong, but so far I've been unable to reproduce it and desk-checking the code has not spotted any problems.

Given that "xnor" is able to reproduce it, my plan is to send him a patch to capture the audio as passed to JACK to see if it's distorted. That will determine whether it's a MOC issue or a JACK one (or maybe still in the parameters MOC gives to JACK).

In the meantime, could you run MOC with the "-D" option set and e-mail the (compressed) mocp_server_log file? To keep the log of managable size, just play one audio and only until you start to hear the distortion.

Just after I asked that, I saw a post about running the server with -SF. So I did that in one term and ran the moc GUI in another. I see ffmpeg lines there, and it seems to be the only external wav decoder I have, but then xnor is saying that it's something occuring in moc so I'm not sure it signifies. It sounds the same without using ffmpeg.

Are there any other decoders I can use other then ffmpeg? I have modplug, sndfile and wavpack installed, but using them makes no difference.


ffmpeg *isn't* the only external decoder - I have the others I mentioned.

Of those decoders, only Sndfile and FFmpeg will decode wav files. But I'd be surprised if it was a decoder problem... very surprised.

There is a sndfile-resample which comes with libsamplerate. If you have it, you may wish to try resampling the 8000Hz file to a sample rate which matches what JACK expects and see if it makes any difference. That would help to absolve the libsamplerate library.