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

Unnecessary sample rate resets #94

Open
hubert3 opened this issue May 18, 2023 · 7 comments
Open

Unnecessary sample rate resets #94

hubert3 opened this issue May 18, 2023 · 7 comments

Comments

@hubert3
Copy link

hubert3 commented May 18, 2023

Running Version 1.1 Build 14

Playing this album https://music.apple.com/au/album/beats-in-space-068-marie-davidson-dj-mix/1682148235 with LosslessSwitcher active, the sample rate seems to be reset at the start of every track causing at least one ~0.5 second audio dropout on my SMSL M500 external DAC

This happens on every track change, even though all tracks are 16-bit 44.1 kHz ALAC and no switching is necessary

When I quit LosslessSwitcher these dropouts are 100% gone

Would it simply be possible to only reset the sample rate if it's different from the last track that was played?

@hubert3
Copy link
Author

hubert3 commented May 18, 2023

Looking at the code, it seems like unnecessary changes should already be avoided (?)

The following is the console output when I skip to the next track in this album

Not totally sure what's happening here, there seem to be two detections with both 16 and 24 bitDepths based on the Apple Music logs

[getAllStats] []
Current Track Acelera (Mixed), previous: ID2 (from Beats In Space 068: Marie Davidson) [Mixed], isSame: false
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 24, date: 2023-05-18 05:54:29 +0000, priority: 2)
[getAllStats] [LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 24, date: 2023-05-18 05:54:29 +0000, priority: 2), LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)]
NEAREST FORMAT [__C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 4, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0), __C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 68, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0)]
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 24, date: 2023-05-18 05:54:29 +0000, priority: 2)
[getAllStats] [LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 24, date: 2023-05-18 05:54:29 +0000, priority: 2), LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)]
NEAREST FORMAT [__C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 4, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0), __C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 68, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0)]
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 24, date: 2023-05-18 05:54:29 +0000, priority: 2)
[getAllStats] [LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 24, date: 2023-05-18 05:54:29 +0000, priority: 2), LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)]
NEAREST FORMAT [__C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 4, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0), __C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 68, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0)]
detected stat CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)
[getAllStats] [LosslessSwitcher.CMPlayerStats(sampleRate: 44100.0, bitDepth: 16, date: 2023-05-18 05:54:29 +0000, priority: 1)]
NEAREST FORMAT [__C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 4, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0), __C.AudioStreamBasicDescription(mSampleRate: 44100.0, mFormatID: 1819304813, mFormatFlags: 68, mBytesPerPacket: 8, mFramesPerPacket: 1, mBytesPerFrame: 8, mChannelsPerFrame: 2, mBitsPerChannel: 24, mReserved: 0)]
[getAllStats] []
[getAllStats] []
same track, ignore cache
[getAllStats] []
[getAllStats] []
same track, ignore cache

@hubert3 hubert3 changed the title Avoid unnecessary sample rate resets Unnecessary sample rate resets May 18, 2023
@MasterRahool
Copy link
Contributor

fwiw I tested that album and couldn't repeat the error (v1.1/b11)

@hubert3
Copy link
Author

hubert3 commented May 20, 2023

fwiw I tested that album and couldn't repeat the error (v1.1/b11)

I imagine some DACs handle sample rate resets more gracefully than others without dropouts.

It seems like LosslessSwitcher is doing something on every track change on this album on my system but I haven't worked out what exactly

@MasterRahool
Copy link
Contributor

thats the thing, no change happened, because they're all 44.1

the dac I was using actually has a noticeable dropout usually, with a physical click on changing. No changes or system confusion for me.

@MusicSounds
Copy link

I found one particular repeatable sample rate change (but not reset): when adding tracks to "play next" it switches the sample rate to that of the new track

@PivotMasterNM
Copy link
Contributor

I can confirm the excessive switching - using an M Track 2x2 and M Audio AIR 192 4, as well as my Built-in Macbook Pro M1Max DAC.

It causes more like 2-5 seconds of total dropouts for me, switching often more like 2 or 3 times between sample rates, I have bit depth switching deactivated.

I can also confirm switching fairly early (too early) to another sample rate when the upcoming song has different properties, something like 2-3 minutes of playback too early.

Lmk how I can provide some logs, if needed! :)

@JFizDaWiz
Copy link

I use a Fiio Q3 and at the start of every song it drops out for 1-3 seconds even when there isn't a switch (listening to an album rather than random songs)

Also happens whenever I drag the slider to another part of the song (forwards and backwards)

As soon as I quit the application and skip song/drag slider the issue goes away immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants