Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crossfade noise on line out with FLAC files #2050

Closed
ferguson opened this issue May 20, 2024 · 5 comments
Closed

Crossfade noise on line out with FLAC files #2050

ferguson opened this issue May 20, 2024 · 5 comments
Labels
osx Mac/Apple-specific.

Comments

@ferguson
Copy link

ferguson commented May 20, 2024

Bug report

When crossfade is enabled noise can be heard on the line out output for the last 5 seconds of the song.

Describe the bug

When cross fading from a flac from to a flac file, or from a wav file to a flac file, noise is often heard on the system audio output (but not on other outputs e.g. wav via http or fifo). Not every flac file will cause it, and/or different flac files will cause it at different audible levels. When a flac file does cause the noise, the noise will sound the same each time for that specific flac file (i.e. the noise does not appear to be random).

I had noticed this issue before between flac to flac crossfades. I believe this is the same as issue #1101. In putting together an example for this bug report mpd happened to do a cross fade from playing a wav file to playing my example flac file. I heard noise during the fade from wav to flac, then a different noise when fading from flac to flac.

I have stashed a recording of this at https://otto.stream/mpdissue/system_audio_noise.aiff
The noise from the wav to flac cross fade can be heard at the 5 second mark, and then a noise from the flac to flac cross fade is at the 45 second mark.

The example flac used is at https://otto.stream/mpdissue/example.flac and it was sufficient to just queue up this same flac file multiple times to trigger the cross fade noise.

Expected Behavior

Noise free cross fades between files encoded as flac on the system line out output

Actual Behavior

Often there is noise when cross fading from flac to flac

Version

This is on macOS 12.7.4 Monterey.
MPD was built from source using Homebrew 4.2.21-dirty

MPD version:

Music Player Daemon 0.23.15 (0.23.15)
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 nfs curl

Neighbor plugins:
 upnp

Decoders plugins:
 [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
 [wavpack] wv
 [fluidsynth] mid
 [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://
 [pcm]

Filters:
 libsamplerate soxr

Tag plugins:
 id3tag

Output plugins:
 shout null fifo pipe ao openal osx httpd snapcast recorder

Encoder plugins:
 null vorbis opus lame wave flac

Archive plugins:
 [bz2] bz2

Input plugins:
 file archive curl ffmpeg nfs

Playlist plugins:
 extm3u m3u pls xspf asx rss flac cue embcue

Protocols:
 file:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mmsh:// mmst:// nfs:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// sftp:// smb:// srtp://

Other features:
 icu ipv6 tcp un

Configuration

# auto generated (and regenerated) by otto, don't edit
# for channel main
music_directory   "/Users/jon/Library/Otto/mpd/music"
db_file           "/Users/jon/Library/Otto/mpd/01database"
log_file          "/Users/jon/Library/Otto/mpd/01log"
pid_file          "/Users/jon/Library/Otto/mpd/01pid"
state_file        "/Users/jon/Library/Otto/mpd/01state"
bind_to_address   "/Users/jon/Library/Otto/mpd/01socket"
#port              "6600"
#bind_to_address   "localhost"
#zeroconf_enabled  "yes"
#zeroconf_name     "Otto Music Player main"
volume_normalization "yes"
input {
plugin "curl"
}
audio_output {
type            "httpd"
name            "Otto HTTP MP3 Stream main"
encoder         "lame"
#bind_to_address "/Users/jon/Library/Otto/mpd/01socket_mp3"
port            "8101"
bind_to_address "localhost"
#quality         "5.0"     # do not define if bitrate is defined
bitrate         "128"     # do not define if quality is defined
format          "44100:16:2"
#max_clients     "0"
}
audio_output {
type            "httpd"
name            "Otto HTTP OGG Stream main"
encoder         "vorbis"
#bind_to_address "/Users/jon/Library/Otto/mpd/01socket_ogg"
port            "8102"
bind_to_address "localhost"
#quality         "5.0"     # do not define if bitrate is defined
bitrate         "128"     # do not define if quality is defined
format          "44100:16:2"
#max_clients     "0"
}
audio_output {
type            "httpd"
name            "Otto HTTP WAV Stream main"
encoder         "wave"
#bind_to_address "/Users/jon/Library/Otto/mpd/01socket_wav"
port            "8103"
bind_to_address "localhost"
format          "44100:16:2"
#max_clients     "0"
}
audio_output {
type            "fifo"
name            "Otto FIFO main"
path            "/Users/jon/Library/Otto/mpd/01fifo"
}
#having the null output seems to avoid a problem when no listeners are connected
audio_output {
type            "null"
name            "Otto Null Output"
mixer_type      "none"
}
audio_output {
type            "osx"
name            "Otto Line Out"
mixer_type      "software"
enabled         "yes"
}

Log

config_file: loading file /Users/jon/Library/Otto/mpd/01-mpd.conf
May 17 18:42 : libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
May 17 18:42 : vorbis: Xiph.Org libVorbis 1.3.7
May 17 18:42 : opus: libopus 1.5.2
May 17 18:42 : sndfile: libsndfile-1.2.2
May 17 18:42 : hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
May 17 18:42 : simple_db: reading DB
May 17 18:42 : curl: version 8.4.0
May 17 18:42 : curl: with (SecureTransport) LibreSSL/3.3.6
@MaxKellermann
Copy link
Member

Your log shows that you never had any playback.

@MaxKellermann MaxKellermann added the waiting Waiting for more information from reporter label May 23, 2024
@ferguson
Copy link
Author

Ah. I included the log output that was shown on the command line where I ran mpd with the --verbose flag, but then the log messages were then being diverted to a file because of the config options in the config file. I though it was odd that there wasn't much being logged there.

I ran it again just now, recreating the noise, and here is the output of the written log file with the --verbose flag:

May 28 15:40 : state_file: Loading state file /Users/jon/Library/Otto/mpd/01state
May 28 15:40 : bonjour: Registered zeroconf service with name 'Music Player @ jons-macbook-pro-3.local'
May 28 15:40 : client: [0] opened from @@@@@@@@@@@@@
May 28 15:40 : client: [0] process command "config"
May 28 15:40 : client: [0] command returned 0
May 28 15:40 : client: [0] process command list
May 28 15:40 : client: process command "add "/Users/jon/otto/mpd_crossfade_noise_bug/example.flac""
May 28 15:40 : client: command returned 0
May 28 15:40 : client: [0] process command list returned 0
May 28 15:40 : client: [0] closed
May 28 15:40 : client: [1] opened from @@@@@@@@@@@@@
May 28 15:40 : client: [1] process command "config"
May 28 15:40 : client: [1] command returned 0
May 28 15:40 : client: [1] process command list
May 28 15:40 : client: process command "add "/Users/jon/otto/mpd_crossfade_noise_bug/example.flac""
May 28 15:40 : client: command returned 0
May 28 15:40 : client: [1] process command list returned 0
May 28 15:40 : client: [1] closed
May 28 15:40 : client: [2] opened from @@@@@@@@@@@@@
May 28 15:40 : client: [2] closed
May 28 15:40 : client: [3] opened from @@@@@@@@@@@@@
May 28 15:40 : client: [3] process command "crossfade "1""
May 28 15:40 : client: [3] command returned 0
May 28 15:40 : client: [3] closed
May 28 15:41 : client: [4] opened from @@@@@@@@@@@@@
May 28 15:41 : client: [4] process command "play"
May 28 15:41 : playlist: play 0:"/Users/jon/otto/mpd_crossfade_noise_bug/example.flac"
May 28 15:41 : client: [4] command returned 0
May 28 15:41 : decoder_thread: probing plugin flac
May 28 15:41 : playlist: queue song 1:"/Users/jon/otto/mpd_crossfade_noise_bug/example.flac"
May 28 15:41 : client: [4] process command list
May 28 15:41 : client: process command "status"
May 28 15:41 : client: command returned 0
May 28 15:41 : client: process command "currentsong"
May 28 15:41 : decoder: audio_format=44100:16:2, seekable=true
May 28 15:41 : client: command returned 0
May 28 15:41 : client: [4] process command list returned 0
May 28 15:41 : client: [4] closed
May 28 15:41 : output: opened "Otto HTTP MP3 Stream main" (httpd) audio_format=44100:16:2
May 28 15:41 : output: opened "Otto HTTP OGG Stream main" (httpd) audio_format=44100:f:2
May 28 15:41 : output: converting in=44100:16:2 -> f=44100:16:2 -> out=44100:f:2
May 28 15:41 : output: opened "Otto HTTP WAV Stream main" (httpd) audio_format=44100:16:2
May 28 15:41 : output: opened "Otto FIFO main" (fifo) audio_format=44100:16:2
May 28 15:41 : output: opened "Otto Null Output" (null) audio_format=44100:16:2
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (96000Hz) rated 15
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (88200Hz) rated 15
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (48000Hz) rated 15
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (44100Hz) rated 2515
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (32000Hz) rated 515
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (22050Hz) rated 1113
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (16000Hz) rated 113
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (11025Hz) rated 1111
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 24-bit SInt LE (8000Hz) rated 110
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (96000Hz) rated 10
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (88200Hz) rated 10
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (48000Hz) rated 10
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (44100Hz) rated 2510
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (32000Hz) rated 510
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (22050Hz) rated 1108
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (16000Hz) rated 108
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (11025Hz) rated 1106
May 28 15:41 : osx_output: Format: 2 channel mixable interleaved 16-bit SInt LE (8000Hz) rated 105
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (96000Hz) rated 15
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (88200Hz) rated 15
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (48000Hz) rated 15
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (44100Hz) rated 2515
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (32000Hz) rated 515
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (22050Hz) rated 1113
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (16000Hz) rated 113
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (11025Hz) rated 1111
May 28 15:41 : osx_output: Format: 2 channel  interleaved 24-bit SInt LE (8000Hz) rated 110
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (96000Hz) rated 10
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (88200Hz) rated 10
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (48000Hz) rated 10
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (44100Hz) rated 2510
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (32000Hz) rated 510
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (22050Hz) rated 1108
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (16000Hz) rated 108
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (11025Hz) rated 1106
May 28 15:41 : osx_output: Format: 2 channel  interleaved 16-bit SInt LE (8000Hz) rated 105
May 28 15:41 : output: opened "Otto Line Out" (osx) audio_format=44100:24:2
May 28 15:41 : output: converting in=44100:16:2 -> f=44100:24:2 -> out=44100:24:2
May 28 15:41 : decoder_thread: probing plugin flac
May 28 15:41 : decoder: audio_format=44100:16:2, seekable=true
May 28 15:41 : player: played "/Users/jon/otto/mpd_crossfade_noise_bug/example.flac"
May 28 15:42 : player: played "/Users/jon/otto/mpd_crossfade_noise_bug/example.flac"
May 28 15:42 : playlist: stop
May 28 15:42 : output: closed "Otto HTTP MP3 Stream main" (httpd)
May 28 15:42 : output: closed "Otto HTTP OGG Stream main" (httpd)
May 28 15:42 : output: closed "Otto HTTP WAV Stream main" (httpd)
May 28 15:42 : output: closed "Otto FIFO main" (fifo)
May 28 15:42 : output: closed "Otto Null Output" (null)
May 28 15:42 : output: closed "Otto Line Out" (osx)
May 28 15:42 : state_file: Saving state file /Users/jon/Library/Otto/mpd/01state

The noise occurred right before the first of the two player: played "/Users/jon/otto/mpd_crossfade_noise_bug/example.flac" lines at the May 28 15:41 mark.

@boedy
Copy link
Contributor

boedy commented Jun 28, 2024

I'm experiencing similar interference (sounds like static buzz) when crossfading between mp3 files. Might have something to do with audio backend on mac. Havn't yet had the chance to test on linux (alsa).

versions:

macOS 14.4 (Sonoma)
MPD 0.23.15 (Homebrew)

logs

➜  mpd mpd ./mpd.config --stderr --no-daemon --verbose
config_file: loading file ./mpd.config
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.7
opus: libopus 1.5.2
sndfile: libsndfile-1.2.2
hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
ao_output: using ao driver "macosx" for "default"
curl: version 8.4.0
curl: with (SecureTransport) LibreSSL/3.3.6
bonjour: Registered zeroconf service with name 'Music Player @ boedy-2.local'
client: [0] opened from @@@@@@@@@@@@@
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "clear"
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "crossfade "5""
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "add "/Users/boedy/scratchpad/mpd/mp3/jungle.mp3""
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "add "/Users/boedy/scratchpad/mpd/mp3/stranger.mp3""
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "play "0""
playlist: play 0:"/Users/boedy/scratchpad/mpd/mp3/jungle.mp3"
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
playlist: queue song 1:"/Users/boedy/scratchpad/mpd/mp3/stranger.mp3"
decoder_thread: probing plugin mpg123
decoder: audio_format=44100:16:2, seekable=true
client: [0] process command "idle"
client: [0] command returned 1
output: opened "default" (ao) audio_format=44100:16:2
output: converting in=44100:16:2 -> f=44100:24:2 -> out=44100:16:2
client: [0] process command "idle"
client: [0] command returned 1
decoder_thread: probing plugin mpg123
decoder: audio_format=44100:16:2, seekable=true
player: played "/Users/boedy/scratchpad/mpd/mp3/jungle.mp3"
client: [0] process command "idle"
client: [0] command returned 1
^Cplayer: played "/Users/boedy/scratchpad/mpd/mp3/stranger.mp3"
output: closed "default" (ao)

@MaxKellermann
Copy link
Member

Hmmm, if this is specific to macOS, then unfortunately I cannot help. macOS support has been removed from MPD because there were a bunch of known bugs but no volunteer to fix them. Sorry, there's nothing I can do (until a MPD/macOS maintainer spawns).

@MaxKellermann MaxKellermann closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
@MaxKellermann MaxKellermann added osx Mac/Apple-specific. and removed waiting Waiting for more information from reporter labels Jul 12, 2024
@Oreolek
Copy link

Oreolek commented Aug 21, 2024

I'm experiencing this too on Linux, might be the format conversion?

In the log above:

converting in=44100:16:2 -> f=44100:24:2 -> out=44100:16:2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
osx Mac/Apple-specific.
Projects
None yet
Development

No branches or pull requests

4 participants