1

I am using tidal hifi for music streaming under linux (Mint 17, 64bit) with Chrome. To achieve bit perfect playback I turn off pulseaudio ($killall pulseaudio) to purely use alsa for audio processing and output to my USB DAC. However, the playback stops after every song and I need to manually select the next song to play. Surprisingly this problem does not occur if I use pulseaudio.

I'd be grateful for any hints how to fix this behaviour.

1 Answer 1

2

I realize this is an old question, but I recently ran into the same problem and found a solution.

The problem seems to stem from the pre-loading of tracks in Tidal. Since you are not using pulseaudio Google Chrome creates a new audio controller every time a track starts playing from your playlist. Tidal's player expects the same audio controller to be in place when the next song starts playing, leading to the hang-up.

The way I fixed the problem was by debugging Tidal's javascript player code by injecting my changes through a `man in the middle'-proxy (look up mitmproxy, great software). By doing so I could change the behavior of the player. By changing the following function:

function m(t) {
    t || w.pause(), g(), e.trigger("track:switched", A), I = void 0, S && x === A ? (o.player !== o.preloadPlayer && (o.player.stop(), o.setMediaPlayer(o.preloadPlayer)), u(T, S, t), x = void 0, T = void 0, S = void 0) : f(A, p, k)
}

to

function m(t) {
    t || w.pause(), g(), e.trigger("track:switched", A), I = void 0, S && x === A, f(A, p, k)
}

I got rid the of the issue. The last function will always call the `f' function, thereby creating a new player, avoiding the pre-load issue.

The steps you need to go through is:

  1. Install mitmproxy and its certificates
  2. Setup your browser to use the mitmproxy (you can find the setting under Menu->Settings->Advanced->Change Proxy Settings
  3. Run mitmproxy like this: mitmproxy -p 8888 --script tidal.py

Tidal.py's contents is below. Note that you'll have to download the .js file and make the changes, and put it in a place where it can be loaded, e.g. in the same directory as the tidal.py file. Good luck!

import cStringIO
from libmproxy.protocol.http import decoded

def response(context, flow):
    if flow.match("~u http://listen.tidal.com/v1.6.4-p-5/app.js") and flow.response.headers.("content-type", "").startswith("application/x-javascript"):
        with decoded(flow.response):
            try:
                injected_script = cStringIO.StringIO(open('./app.js', 'rb').read())
                flow.response.content = injected_script.getvalue()
            except Exception as e:
                print e
                pass
1
  • An update: The solution above is possibly outdated. I've found that with these settings in ~/.asoundrc: pcm.!default { type hw card CARDNAME } ctl.!default { type hw card CARDNAME } And then starting google chrome with the "--disable-audio-output-resampler" flag, I get bit-perfect playback of hifi tidal without any stops. This is with pulseaudio disabled (completely removed from the system) and using an external USB DAC, running Debian. CARDNAME can be found by running aplay -l from the command line.
    – Are Jensen
    Feb 28, 2017 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .