Author Topic: [PLUGIN] Precache - an aid for gapless playback  (Read 1851 times)

bucaneer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
[PLUGIN] Precache - an aid for gapless playback
« on: October 19, 2015, 20:39:47 »
Made this for my own use, perhaps somebody else will also find it useful:

Precache plugin loads the next song (or its beginning) into VM cache in order to aid gapless playback.

Requires vmtouch.

With mpv (and possibly gstreamer, not entirely sure about that) gapless mode works by keeping the audio buffer (which is provided by the sound driver - PulseAudio, ALSA, etc) open between the time when mpv finishes playing one file and starts playing the next. If mpv can open and start reading the next file in the few milliseconds it takes for the sound driver to process the remaining contents of the buffer, you get a gapless transition. If your music library is on a disk that is slow or busy, opening the file might take too long and you get a gap between songs. Precache eliminates disk latency from the equation by ensuring that the next file is loaded into virtual memory (i.e. RAM) before it is time to open it.

VastOne

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Re: [PLUGIN] Precache - an aid for gapless playback
« Reply #1 on: February 04, 2016, 23:34:31 »
Just found this and built both and am testing .. nice work

The requirement for use is to switch to mpv to be sure it works? 

I am not seeing a discernable difference now that I have everything enabled, so I am not sure if it is functioning as it should be

Any sure way to test it?

VastOne

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Re: [PLUGIN] Precache - an aid for gapless playback
« Reply #2 on: February 04, 2016, 23:38:51 »
I am seeing this error from running it in terminal

Code: [Select]
vmtouch: FATAL: mlock: /media/sda5/Music/mp3new/Classic Rock/Lou Reed/Lou Reed - Take a Walk on the Wild Side.mp3 (Cannot allocate memory)

bucaneer

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: [PLUGIN] Precache - an aid for gapless playback
« Reply #3 on: February 29, 2016, 02:13:43 »
I am seeing this error from running it in terminal

Code: [Select]
vmtouch: FATAL: mlock: /media/sda5/Music/mp3new/Classic Rock/Lou Reed/Lou Reed - Take a Walk on the Wild Side.mp3 (Cannot allocate memory)

This is likely because you have a low memory lock limit set - see here for the explanation. I think the solution will be to edit /etc/security/limits.conf (as root) and set the "memlock" value to something larger (or -1 to remove the limit).