Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
b1tfl0w opened this issue Apr 13, 2020 · 0 comments
Open

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

b1tfl0w opened this issue Apr 13, 2020 · 0 comments

Comments

@b1tfl0w
Copy link

b1tfl0w commented Apr 13, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant