• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Gapless playback problem - alsa issue?

onlyoneme

Major Contributor
Joined
Jul 5, 2022
Messages
1,117
Likes
624
Location
Poland
WiiM devices cannot transition between flac and wav files in the gapless manner for 24 bit depth content. I have been told that the reason is different bit depth of the files and that forces alsa to reset which breaks gapless playback. Bit depths are in fact the same, I've used test files as attached with the same content. I can guess that the player (mplayer probably) uses ffmpeg library to decode the flac content, and 32 bit internal sample depth is being used here.
Can someone test other streamers behavior, linux based preferably? Of course it's mandatory to avoid any transcoding before the content is sent to the streamer.
 

Attachments

  • _Test_.zip
    2.1 MB · Views: 32

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
503
Likes
328
Please can you explain the problem more? IIUC you provide two different files to your streamer (= linux computer) and want them to be played gaplessly to your DAC (external or internal in the streamer). Is that the case?
 
OP
O

onlyoneme

Major Contributor
Joined
Jul 5, 2022
Messages
1,117
Likes
624
Location
Poland
Please can you explain the problem more? IIUC you provide two different files to your streamer (= linux computer) and want them to be played gaplessly to your DAC (external or internal in the streamer). Is that the case?
Yes, but those files are not played gaplessly although the raw content is the same.
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
503
Likes
328
Typically a player closes the device at the end of the track and re-opens with the new one. It's impossible to avoid a delay in such method.

Gapless playback must be programmed directly in the player, which keeps the device open and continuously appends the new track to the samples of the previous one.
 
OP
O

onlyoneme

Major Contributor
Joined
Jul 5, 2022
Messages
1,117
Likes
624
Location
Poland
Typically a player closes the device at the end of the track and re-opens with the new one. It's impossible to avoid a delay in such method.

Gapless playback must be programmed directly in the player, which keeps the device open and continuously appends the new track to the samples of the previous one.
That's what I can see for 2 files with the same raw content and the same file type, gapless playback works. It's not working on the WiiM for files I've attached. According to the Linkplay explanation it's due to the different bit depth which is not true.
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
503
Likes
328
Well, this is all up to the code in their application, not much which can be solved here. A logical way would be using the largest bitwidth the device is capable of for any track bit width, then you can combine any bit width seamlessly. But also it requires pre-fetching the next files, to have the new decoded samples available to fill the playback buffer together with the last samples of the previous track. Not trivial to program, but it has been done before, a number of systems support the gapless playback.
 
OP
O

onlyoneme

Major Contributor
Joined
Jul 5, 2022
Messages
1,117
Likes
624
Location
Poland
That's why I was asking for help to verify it with some other streamers as I do not believe it's a real issue with alsa which cannot be handled. Unfortunately I do not own any other linux based streamer to verify it myself.
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
503
Likes
328
Alsa does not care what samples are being passed through it. It's the player task to merge the tracks seamlessly. Of course it may involve changing bit width of one of the tracks. It's no problem playing 16-bit tracks to 24/32 bit output, no information lost.
 
OP
O

onlyoneme

Major Contributor
Joined
Jul 5, 2022
Messages
1,117
Likes
624
Location
Poland
My DAC is being forced to relock and resync between the files I've attached which breaks the gapless playback. According to Linkplay it's due to the alsa reset which is inevitable here.
I guess that 24 bit output is used for 24 bit wav content but 32 bit output for 24 bit flac content, as ffmpeg uses 32 bit internal depth when decoding flac files. But it's just my assumption.

And it is 24 bit output finally as it's all about spdif out.
 
Last edited:

-dsr-

Member
Joined
Apr 24, 2023
Messages
9
Likes
16
From the FAQ for MOC (music on console):
MOC plays smoothly, regardless of system or I/O load because it uses the output buffer in a separate thread. The transition between files is gapless, because the next file to be played is precached while the current file is playing.

MOC outputs through ALSA, OSS and JACK; I have it running directly through ALSA on one system and through the ALSA emulation of Pipewire on another. Both systems are gapless.
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
503
Likes
328
Logically for gapless playback the stream to the audio device must be continuous, no opening/closing the device between the tracks. Of course the player must be programmed to do so.
 
Top Bottom