Closed electroworlder closed 1 year ago
I have figured out this is due to poor resampling by ALSA and can be fixed with autoresample "n" option in audio_output. I still have to consider if I like resampled sound, but that is outside the scope of mpd. Thank you helping me through this problem.
Thank you Max. I did find this page and along with https://hifiduino.wordpress.com/2014/03/27/beaglebone-black-navigating-the-audio-maze/ I have my system playing 'bit perfect'. On my home made Linkwitz Orion speakers it sounds amazing.
Bug report
Describe the bug
MPD produces distorted sound. Starting at around 8kHz and very noticeable from 12kHz upward, a sine wave appears progressively amplitude modulated, as if other frequencies have been added. The problem can be heard in source music, presenting as a reduction in realism of well recorded cymbals and other percussion. The modulation frequencies can easily be heard in a 12kHz pure sine wave. No such distortion is observed when using command line “play” (part of sox) to play the files.
MPD 0.23.12 was downloaded and set up as a package from https://kaliko.me/debian/, on a Beaglebone black outputting via USB to a Navman ODAC. The operating system is Debian bullseye, but with the 4.19.94-ti-r42 buster kernel. The same behaviour was observed with mpd version 0.21.5 under buster and mpd version 0.22.6-1 and also under bullseye (as per bug report 1846).
Expected Behavior
I expect a sine wave at 1.00V RMS and with no distortion or modulation to be generated for sine wave sources from 5Hz through to just before 20kHz. This is what I get when playing the same files using the "play" command (part of the sox package) on the same system. A scope snapshot of an example correct play back is given in the attached file “hfd issue.pdf".
Actual Behavior
Please see attached file, “hfd issue.pdf" being 'scope snap shots of signal output from the USB DAC. It can be seen that the signal is attenuated to 780mV RMS, where I was expecting 1.00V RMS and that the signal has an amplitude modulation where there should be no modulation. I get this same result when playing file formats .wav, .flac, .mp3 and .ogg.
Version
Music Player Daemon 0.23.12 (0.23.12) Copyright 2003-2007 Warren Dukes warren.dukes@gmail.com Copyright 2008-2021 Max Kellermann max.kellermann@gmail.com This is free software; see the source for copying conditions. There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Database plugins: simple proxy upnp
Storage plugins: local smbclient udisks nfs curl
Neighbor plugins: smbclient upnp udisks
Decoders plugins: [mad] mp3 mp2 [mpg123] mp3 [vorbis] ogg oga [oggflac] ogg oga [flac] flac [opus] opus ogg oga [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2 [dsdiff] dff [dsf] dsf [hybrid_dsd] m4a [faad] aac [mpcdec] mpc [wavpack] wv [openmpt] mptm mod s3m xm it 669 amf ams c67 dbm digi dmf dsm dtm far imf ice j2b m15 mdl med mms mt2 mtm nst okt plm psm pt36 ptm sfx sfx2 st26 stk stm stp ult wow gdm mo3 oxm umx xpk ppm mmcmp [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm [sidplay] sid mus str prg P00 [wildmidi] mid [fluidsynth] mid [adplug] amd d00 hsc laa rad raw sa2 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps:// [gme] ay gbs gym hes kss nsf nsfe rsn sap spc vgm vgz [pcm]
Filters: libsamplerate soxr
Tag plugins: id3tag
Output plugins: shout null fifo sndio pipe alsa ao oss openal pipewire pulse jack httpd snapcast recorder
Encoder plugins: null vorbis opus lame wave flac
Archive plugins: [bz2] bz2 [zzip] zip [iso] iso
Input plugins: file io_uring archive alsa curl ffmpeg smbclient nfs mms cdio_paranoia
Playlist plugins: extm3u m3u pls xspf asx rss soundcloud flac cue embcue
Protocols: file:// alsa:// cdda:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://
Other features: avahi dbus udisks epoll icu inotify ipv6 systemd tcp un
Configuration
(comment lines removed for clarity)
music_directory "/mnt/MusicStore/Album\ Collection" playlist_directory "/mnt/sdcard/mpd/var/playlists" db_file "/mnt/sdcard/mpd/var/tag_cache" log_file "/mnt/sdcard/mpd/log/mpd.log" pid_file "/mnt/sdcard/mpd/run/pid" state_file "/mnt/sdcard/mpd/var/state" sticker_file "/mnt/sdcard/mpd/var/sticker.sql"
user "debian" group "audio" bind_to_address "localhost" log_level "verbose"
input { plugin "curl" }
decoder { plugin "hybrid_dsd" enabled "no" } decoder { plugin "wildmidi" enabled "no" }
audio_output { type "alsa" name "My ALSA Device" }
filesystem_charset "UTF-8"
Log
Jul 19 08:21 : decoder_thread: probing plugin sndfile Jul 19 08:21 : decoder: audio_format=41500:16:2, seekable=true Jul 19 08:21 : alsa_output: opened default type=PLUG Jul 19 08:21 : alsa_output: buffer: size=1770..14165 time=42650..341326 Jul 19 08:21 : alsa_output: period: size=885..886 time=21333..21334 Jul 19 08:21 : alsa_output: default period_time = buffer_time/4 = 341325/4 = 85331 Jul 19 08:21 : alsa_output: format=S16_LE (Signed 16 bit Little Endian) Jul 19 08:21 : alsa_output: buffer_size=14165 period_size=885 Jul 19 08:21 : output: opened "My ALSA Device" (alsa) audio_format=41500:16:2 Jul 19 08:21 : client: [44] opened from local Jul 19 08:21 : client: [44] process command "idle player" Jul 19 08:21 : client: [44] command returned 1 Jul 19 08:23 : state_file: Saving state file /mnt/sdcard/mpd/var/state Jul 19 08:23 : client: [45] opened from local Jul 19 08:23 : client: [45] process command "stop" Jul 19 08:23 : playlist: stop Jul 19 08:23 : player: played "_Test/sin_10_pt_decade-6dB/35_sin_12kHz.wav" Jul 19 08:23 : output: closed "My ALSA Device" (alsa) Jul 19 08:23 : client: [45] command returned 0 Jul 19 08:23 : client: [45] process command list Jul 19 08:23 : client: process command "status" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: process command "currentsong" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: [45] process command list returned 0 Jul 19 08:23 : client: [44] closed Jul 19 08:23 : client: [45] closed Jul 19 08:23 : client: [46] opened from local Jul 19 08:23 : client: [46] process command "single "0"" Jul 19 08:23 : client: [46] command returned 0 Jul 19 08:23 : client: [46] process command list Jul 19 08:23 : client: process command "status" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: process command "currentsong" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: [46] process command list returned 0 Jul 19 08:23 : client: [46] closed Jul 19 08:23 : client: [47] opened from local Jul 19 08:23 : client: [47] process command "repeat "0"" Jul 19 08:23 : client: [47] command returned 0 Jul 19 08:23 : client: [47] process command list Jul 19 08:23 : client: process command "status" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: process command "currentsong" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: [47] process command list returned 0 Jul 19 08:23 : client: [47] closed Jul 19 08:23 : client: [48] opened from local Jul 19 08:23 : client: [48] process command "stop" Jul 19 08:23 : client: [48] command returned 0 Jul 19 08:23 : client: [48] process command list Jul 19 08:23 : client: process command "status" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: process command "currentsong" Jul 19 08:23 : client: command returned 0 Jul 19 08:23 : client: [48] process command list returned 0 Jul 19 08:23 : client: [48] closed Jul 19 08:25 : state_file: Saving state file /mnt/sdcard/mpd/var/state
hfd issue.pdf