INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Gapless tracks when sampling rate changes  (Read 2006 times)

jamescowdery

  • Recent member
  • *
  • Posts: 5
Gapless tracks when sampling rate changes
« on: April 03, 2017, 08:49:20 pm »

I have an application where I need fast gapless switching between tracks when playing out over HDMI. JRiver attracted me because there are so many options available to change the track transitional behavior. When the sampling rate is the same the transition is pretty quick, as you would expect. When the sampling rate changes (48 to 192kHz and back) there is delay of about .85s to 1s. This is in addition to any downstream device delay due to locking to the new clock which I have compensated out of the measurement. I've tried to reduce this by playing with options but without any luck. I was wondering if anyone had any ideas?

I'm playing wave files in a playlist using WASAPI.

Cheers,
James
Logged

kr4

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 741
Re: Gapless tracks when sampling rate changes
« Reply #1 on: April 03, 2017, 10:00:21 pm »

Set MC to output the same format all the time.
Logged
Kal Rubinson
"Music in the Round"
Senior Contributing Editor, Stereophile

AndrewFG

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3392
Re: Gapless tracks when sampling rate changes
« Reply #2 on: April 03, 2017, 10:02:23 pm »

Try applying a DSP resampling effect so that all source formats are re sampled to the same output sample rate..
Logged
Author of Whitebear Digital Media Renderer Analyser - http://www.whitebear.ch/dmra.htm
Author of Whitebear - http://www.whitebear.ch/mediaserver.htm

jamescowdery

  • Recent member
  • *
  • Posts: 5
Re: Gapless tracks when sampling rate changes
« Reply #3 on: April 04, 2017, 03:48:58 pm »

Thanks. Makes sense. I failed to mention that I also need bit perfect audio because I am carrying encoded audio within wav files. This means that I can't do the resampling which I think both of you are suggesting.

Any ideas that preserve the bit transparency (support for bit-perfect audio is the reason I picked jriver).
I understand output sampling rate changes are challenging and can't happen instantly but any tips on how to minimize the time would be appreciated. I changed everything I could see related to gaps to zero and reduced buffer sizes to minimum.

Thanks,
James
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Gapless tracks when sampling rate changes
« Reply #4 on: April 04, 2017, 06:04:12 pm »

Thanks. Makes sense. I failed to mention that I also need bit perfect audio because I am carrying encoded audio within wav files.

So DTS encoded CDs or something?  If you have files like this, you should convert them to FLAC.

If it's not DTS in a WAV container, what types of files are you talking about?

Brian.
Logged

jamescowdery

  • Recent member
  • *
  • Posts: 5
Re: Gapless tracks when sampling rate changes
« Reply #5 on: April 04, 2017, 10:11:53 pm »

This is for a test application driving TVs and AVRs. The audio is Dolby Digital and Dolby Digital Plus encapsulated within a wavefile. Dolby Digital uses 48kHz whereas Dolby Digital Plus uses 192kHz hence the need for sampling rate changes.
Yes I know. I'm not your typical user. ::)
James
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Gapless tracks when sampling rate changes
« Reply #6 on: April 05, 2017, 06:49:13 am »

Changing the sample rate (or channel count for that matter) requires draining all buffers first and then switching the device over. Its never going to be gapless (especially over HDMI, where even the driver can take a bit to switch rates), sorry.
You can possibly reduce the delay slightly if you reduce all buffers to the minimum where playback is still flawless.
Logged
~ nevcairiel
~ Author of LAV Filters

jamescowdery

  • Recent member
  • *
  • Posts: 5
Re: Gapless tracks when sampling rate changes
« Reply #7 on: April 05, 2017, 10:41:37 am »

Henrik,
Thanks. This all makes sense. I have a method where I can measure the delay and compensate for it by putting markers in the content. The delay seems fairly consistent which helps.
James
Logged

jamescowdery

  • Recent member
  • *
  • Posts: 5
Re: Gapless tracks when sampling rate changes
« Reply #8 on: April 28, 2017, 01:12:24 pm »

@Henrik - I got round the delay problem through compensation and got quite far with my application. I've run into another problem which is that I need to change the audio/non-audio bit in the outgoing iec stream. Most devices (TVs/AVRS etc.) are insensitive to this bit so I got quite far with it set incorrectly but I've found some products that require this bit to set correctly to non-audio when sending AC-4 etc. In Linux/ALSA setting you can set this bit with the 'iecset audio 0' command. Obviously your application is assuming linear PCM and so there is no need to provide the option to set this bit.

Can you think of anyway round this? Obviously this has to be on a file by file basis so I'd have to set something in the wavefile header that flips this bit in the output stream. I've looked at the specs and the non-audio options are for a-law and u-law etc. which are not relevant here. This is a deal breaker for me so unfortunately I'm now considering modifying a custom player which is a lot of work  :(.
Any suggestions are appreciated.
Logged
Pages: [1]   Go Up