Bug#311343: poor sound quality when using a fixed sample rate
Hello, Upstream has included our patch to support libsamplerate. However, mpd does not Build-Depend on libsamplerate0-dev. Another dependency pulls this in, so libsamplerate support is enabled in 0.13.0-1, but please explicitly add libsamplerate0-dev to the Build-Depends and close this bug. -- Met vriendelijke groet / with kind regards, Guus Sliepen [EMAIL PROTECTED] signature.asc Description: Digital signature
Bug#311343: poor sound quality when using a fixed sample rate
Guus Sliepen wrote: Upstream has included our patch to support libsamplerate. However, mpd does not Build-Depend on libsamplerate0-dev. Thanks for the update. This will be made explicit in whatever is the next upload. -- things change. [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#311343: poor sound quality when using a fixed sample rate
tags 311343 + upstream tags 311343 + patch thanks Attached is a patch that shows how to add libsamplerate support to mpd. I've left it as an exercise for the reader to change configure.ac to properly detect libsamplerate presence and to add to link with it. One would probably also want to make the conversion quality configurable, because the best quality mode uses a lot of CPU power. -- Met vriendelijke groet / with kind regards, Guus Sliepen [EMAIL PROTECTED] diff -urN mpd-0.12.1/src/pcm_utils.c mpd-0.12.1.libsamplerate/src/pcm_utils.c --- mpd-0.12.1/src/pcm_utils.c 2006-10-11 01:56:58.0 +0200 +++ mpd-0.12.1.libsamplerate/src/pcm_utils.c 2007-01-13 13:16:47.286900500 +0100 @@ -26,6 +26,10 @@ #include math.h #include assert.h +#ifdef HAVE_LIBSAMPLERATE +#include samplerate.h +#endif + void pcm_volumeChange(char *buffer, int bufferSize, AudioFormat * format, int volume) { @@ -234,6 +238,43 @@ if (inFormat-sampleRate == outFormat-sampleRate) { memcpy(outBuffer, dataChannelConv, dataChannelLen); } else { +#ifdef HAVE_LIBSAMPLERATE + static SRC_STATE *state = NULL; + static SRC_DATA data; + int error; + static double ratio = 0; + double newratio; + + if(!state) { + state = src_new(SRC_SINC_BEST_QUALITY, outFormat-channels, error); + if(!state) { +ERROR(Cannot initialise libsamplerate: %s\n, src_strerror(error)); +exit(EXIT_FAILURE); + } + } + + newratio = (double)outFormat-sampleRate / (double)inFormat-sampleRate; + if(newratio != ratio) + src_set_ratio(state, ratio = newratio); + + data.src_ratio = ratio; + data.input_frames = dataChannelLen / 2 / outFormat-channels; + data.output_frames = data.input_frames * data.src_ratio; + + float conversionInBuffer[data.input_frames * outFormat-channels]; + float conversionOutBuffer[data.output_frames * outFormat-channels]; + data.data_in = conversionInBuffer; + data.data_out = conversionOutBuffer; + + src_short_to_float_array((short *)dataChannelConv, data.data_in, data.input_frames * outFormat-channels); + error = src_process(state, data); + if(error) { + ERROR(Error while converting samplerate: %s\n, src_strerror(error)); + exit(EXIT_FAILURE); + } + + src_float_to_short_array(data.data_out, (short *)outBuffer, data.output_frames * outFormat-channels); +#else /* only works if outFormat is 16-bit stereo! */ /* resampling code blatantly ripped from ESD */ mpd_uint32 rd_dat = 0; @@ -272,6 +313,7 @@ } break; } +#endif } return; signature.asc Description: Digital signature
Bug#311343: poor sound quality when using a fixed sample rate
Hello, On a related note, mpd uses libmikmod2 but with fixed quality settings. In particular, it doesn't enable interpolation of (low quality) samples. Could this either be turned on permanently or made configurable? -- Met vriendelijke groet / with kind regards, Guus Sliepen [EMAIL PROTECTED] signature.asc Description: Digital signature
Bug#311343: poor sound quality when using a fixed sample rate
Package: mpd Version: 0.11.5-3 Severity: wishlist Hi, It would be useful if mpd would use libsamplerate for sample rate conversions (the sound quality is horrible with the current resampling code). This is obviously an upstream's issue. :) Thanks, -- System Information: Debian Release: unstable/experimental APT prefers experimental APT policy: (500, 'experimental'), (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.11.10-p4 Locale: LANG=nl_NL.UTF-8, LC_CTYPE=nl_NL.UTF-8 (charmap=UTF-8) Versions of packages mpd depends on: ii adduser 3.63Add and remove users and groups ii debconf [debconf-2.0]1.4.48 Debian configuration management sy ii libao2 0.8.6-1 Cross Platform Audio Output Librar ii libasound2 1.0.8-3 ALSA library ii libaudiofile00.2.6-6 Open-source version of SGI's audio ii libc62.3.5-1 GNU C Library: Shared libraries an ii libflac6 1.1.1-5 Free Lossless Audio Codec - runtim ii libid3tag0 0.15.1b-5 ID3 tag reading library from the M ii libmad0 0.15.1b-1.1 MPEG audio decoder library ii libmikmod2 3.1.11-a-6 A portable sound library ii libogg0 1.1.2-1 Ogg Bitstream Library ii libvorbis0a 1.1.0-1 The Vorbis General Audio Compressi ii libvorbisfile3 1.1.0-1 The Vorbis General Audio Compressi ii zlib1g 1:1.2.2-4 compression library - runtime -- debconf information excluded -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]