Author Topic: Random Tempo Changes Between Tracks  (Read 2632 times)

c0dybrown

  • Newbie
  • *
  • Posts: 6
Hello,

I have a strange music library that has all types of lossless files with varying sample rates (44.1kHz - 192kHz), and varying bitrates (320k - 16937k 5.1 DSD). I use an ASIO driver for my Schiit Modi DAC set to 10ms/24bit/convert DSD to PCM. I am not sure if any of this is even relevant. I run MusicBee with high priority on my CPU and load the entire music file into memory.

An issue I experience is that randomly the tempo of the songs will change when switching between albums. Sometimes this will speed up the song drastically (the playback timer will run very fast), other times it will slow it down. Restarting MusicBee fixes this problem. The original album playing sounds normal, but any song from the album it switched to when shuffling will play very fast or very slow until MusicBee is restarted.

I am not sure if this is specific to the sound driver I am using or something else about my setup specifically, but it still occurs after changing a bunch of settings around. This does not occur in Foobar, but Foobar misses a lot of nice features and settings so I cannot replicate MB settings exactly.

I have tried MB 3.1 and MB 3.2.6567

If anyone can see that I am missing something obvious or has experienced this before, would really appreciate any advice! I tried searching the forums, but could not find anything similar. Thanks!


c0dybrown

  • Newbie
  • *
  • Posts: 6
Yes, I noticed this happens with the visualizer as well a while ago. I tried updating all of the BASS libraries directly from their website (un4seen.com) and it does not change. I am pretty sure it has something to do with the sample rate. I am going to run this program in IDA to see if I can figure out what's going on.

Repro steps:

Add audio files with vastly different sample rates to MB library.
Use ASIO driver output
Play last song in high sample rate album, allow MB to move to the lower sample rate song
Appears to continue sampling the lower sample rate song as quickly as it was sampling the previous song

This could be the ASIO driver or how BASS uses the ASIO driver.


Example of change in sample rate that causes this issue:


Thanks

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34265
as an experiment could you try this version:
http://musicbee.niblseed.com/V3_2/MusicBee32_Patched.zip

you need to unzip and then replace the existing musicbee application files

c0dybrown

  • Newbie
  • *
  • Posts: 6
as an experiment could you try this version:
http://musicbee.niblseed.com/V3_2/MusicBee32_Patched.zip

you need to unzip and then replace the existing musicbee application files

Thanks for your help on this. Just tried that one, same thing occurs unfortunately.

I am trying to write a program that uses BASS_ASIO to see if it's just an interaction between their libraries and Schiit's ASIO driver somehow.

I noticed that you can use BASS_ASIO_SetRate() and BASS_ASIO_GetRate() after pulling the relevant property from the file.

I will try adding a call BASS_ASIO_GetRate() and have it log to the error log every time a song is played. If the number is correct, then there is likely an issue with its interaction with the driver and I will make a post on their site.

Does MB have a more verbose debug log? ActivityLog.dat appears to be binary, not sure what that is

c0dybrown

  • Newbie
  • *
  • Posts: 6
Steven, stupid question:

Are you actually setting the device rate and channel rate from the file information or are you using the default one provided in the BASS_CHANNELINFO struct? It seems to work OK for me when I set the two rates using:

Code
BASS_ASIO_ChannelSetRate(0, 0, 88000);
BASS_ASIO_SetRate(88000);
chan=BASS_DSD_StreamCreateFile(FALSE,"file.dsf",0,0,BASS_DSD_DOP|BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE|BASS_SAMPLE_LOOP,0);
... (play file)

BASS_ASIO_ChannelSetRate(0, 0, 41000);
BASS_ASIO_SetRate(41000);
chan=BASS_MusicLoad(FALSE, "file.wav", 0, 0, BASS_SAMPLE_LOOP | BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT | BASS_MUSIC_RAMPS | BASS_MUSIC_PRESCAN, 0)
...

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34265
its from the file info. I will draw up an outline of whats being done tomorrow night as there are several additional steps involved for various reasons

c0dybrown

  • Newbie
  • *
  • Posts: 6
I became a bit obsessed after discovering Un4seen's libraries and tried to reproduce this behavior a few ways using WPF in .NET:



It's probably the .NET wrappers making everything child-proof for me, but I can't reproduce the behavior. I tried reusing a few objects during song transitions, using/not using BassAsioHandler.Stop() and Bass_StreamFree(), and a few other things. I could see this kind of thing happening if I used C++ and reused the stream for efficiency or something similar. You must be working magic to get the sample rate from DSD files.

Really great work on this product, MB is seriously impressive. If you like Windows Forms by the way, I really recommend WPF. I bet you'd like what they've done.

tubescreamer

  • Jr. Member
  • **
  • Posts: 83
I have also issues with that and made interesting observations which I described in this thread with an updated summary in the 1st post.

https://getmusicbee.com/forum/index.php?topic=23617.0

I have a certain suspicion that there could be a relashionship with the ASIO buffersize to this problem.

If you make only small changes of sample rate, then nothing bad happens, i.e. from 44.1 to 48 kHz or from 88.2 to 96 kHz.
The mess starts when making big jumps, i.e. from 44.1 to 88.2 or higher to put only one example.

What I know is, that the ASIO driver needs to double the ASIO buffersize between 44.1/48 and 88.2/96
and further double when switching up to 176.4/192 kHz as otherwise the buffer is too small.

Could it be the case that the automatic change of ASIO buffersize by the ASIO driver is somehow related to this problem ?
That perhaps the sample rate change by MusicBee needs to "initialize" ASIO in a different way.
A little bit more delay or other parameters ... ????

okrim

  • Newbie
  • *
  • Posts: 3
I have similar problem when I use the foo_dsd_asio to convert PCM to DSD.
MusicBee play the 24bit file with slow tempo