Skip to content

Samples preview on Linux while using Jack Audio Connection Kit #28

Open
@b1tfl0w

Description

@b1tfl0w

The vscode-tidalcycles extension makes use of node-wav-player, which on Linux systems uses aplay for playing sounds, aplay is good for ALSA but if you are using jack it will throw an error: Failed to play the wav file. To solve this just open the file:
~/.vscode/extensions/tidalcycles.vscode-tidalcycles-1.4.1/node_modules/node-wav-player/lib/wav-player.js
and replace aplay in the linux part where it says this._proc = mSpawn('aplay', [path]); with mpv

		if (os === 'win32') {
			this._proc = mSpawn('powershell', [
				'-c',
				'(New-Object System.Media.SoundPlayer "' + path + '").PlaySync();'
			]);
			this._proc.stdin.end();
		} else if (os === 'darwin') {
			this._proc = mSpawn('afplay', [path]);
		} else if (os === 'linux') {
			this._proc = mSpawn('mpv', [path]);
		} else {
			reject(new Error('The wav file can not be played on this platform.'));
		}

of course you will have to install mpv player:
sudo apt install mpv
mpv will play fine with jack aswell in alsa, becouse it will automatically detect the audio backend in use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions