VSLilyPond
VSLilyPond copied to clipboard
MIDI file playing in a devcontainer
I usually work inside a development container, and this extension works perfectly fine there, except for the MIDI file player: I get no error but no music is played.
I tried installing timidity
, fluid-soundfont-gm
and fluid-soundfont-gs
, but this didn't help (the container is based on Debian).
Here is the configuration I use (files inside .devcontainer
):
-
Dockerfile
:# [Choice] LilyPond version: 2.22.0, 2.23.0, etc. ARG VARIANT="2.23.0" FROM jeandeaual/lilypond:${VARIANT} ARG USERNAME=vscode ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y upgrade \ && apt-get -y --no-install-recommends install sudo git vim timidity fluid-soundfont-gm fluid-soundfont-gs \ && rm -rf /var/lib/apt/lists/* RUN groupadd --gid "${USER_GID}" "${USERNAME}" RUN useradd -s /bin/bash --uid "${USER_UID}" --gid "${USER_GID}" --groups sudo --create-home "${USERNAME}" RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers RUN printf '\nexport LANG="C"\nexport LANGUAGE="C"\nexport LC_ALL="C"\n' >> "/home/${USERNAME}/.bashrc"
-
devcontainer.json
{ "name": "LilyPond", "build": { "dockerfile": "Dockerfile", // Update 'VARIANT' to pick an LilyPond version: 2.22.0, 2.23.0, etc. "args": { "VARIANT": "devel-fonts" } }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ "lhl2617.vslilypond", "tomoki1207.pdf" ], // Connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" }
Do you have any idea how to make it work?
There is something fishy about Linux and timidity that I haven't had the time to look into -- please refer to #173 and see if that works? Happy to try running this dev container when I have time as per your other issue.
Thanks for reporting this!
Thanks for the info. Unfortunately I didn't manage to make the MIDI player nor the MIDI input feature on Linux. I'll take a look again when I have some more free time.
Meanwhile, here is the dev container I use when working on LilyPond projects.
Sorry for putting this off for so long--I'm looking into this now
Hmm -- the whole devcontainer crashed for me when I tried any MIDI action from the extension
Is this what you see as well? @jeandeaual
Opened https://github.com/microsoft/vscode/issues/123836 -- it is rather annoying to debug without any logs/trace
This problem seems to stem from the JZZ()
call failing on Docker/WSL2 envs. Will set up a repro repo and open an issue in jzz
@jeandeaual -- what is your host machine's OS?
Opened https://github.com/jazz-soft/JZZ/issues/43 for jzz
failing on WSL2
Opened jazz-soft/JZZ#43 for
jzz
failing on WSL2
Fixed via jazz-midi
1.7.5; waiting for JZZ and jzz-midi-smf deps to be updated.
Can confirm that release 1.6.4 (#255) does not crash VSCode. However, it implies it is playing/recording even without any device present. 1.6.5 (#257) will add a fix to crash when no (in|out)puts are found
The crashing behavior is fixed in #257
I doubt MIDI playback/input can actually be done reliably in a devcontainer, but at least now it does not crash when the MIDI buttons are pressed.
Relevant: https://stackoverflow.com/questions/65912601/docker-container-as-midi-io-device
Reopening until we can have MIDI IO via docker (if that's at all possible)
https://stackoverflow.com/a/41084959/9723640 -- it might be possible to forward audio out of a container--I've done this with PulseAudio with WSL2.
The container would need to mount /dev/snd--I'll come back when I have time.
@lhl2617 Sorry I didn't get back to you earlier, and thanks for investigating this issue!
@jeandeaual -- what is your host machine's OS?
I tested on Windows 10 (x64), Arch Linux (x64) and macOS Big Sur (Apple M1).
https://stackoverflow.com/a/41084959/9723640 -- it might be possible to forward audio out of a container--I've done this with PulseAudio with WSL2.
The container would need to mount /dev/snd--I'll come back when I have time.
I tried again after uncommenting this line:
- Windows 10 doesn't seem to work yet (maybe due to https://github.com/microsoft/WSL/issues/689)
- On Linux I got
No sound devices found
even though it works fine on the host - On macOS I got
[2021-06-14T15:36:27.974Z] docker: Error response from daemon: error gathering device information while adding custom device "/dev/snd": no such file or directory.
This is a minor inconvenience, but it'd be nice if all VSLilyPond features worked inside containers.
but it'd be nice if all VSLilyPond features worked inside containers.
I agree--I think overall piping audio out from a container into the host system is a challenge; however, I'll look into it deeper.
I currently only have a Ubuntu 20.04 (x64) and Win10 (x64) machine. I am able to replicate the Windows 10 behaviour--I assume on Ubuntu it would be as you observed on Arch. I will soon obtain whatever 16 inch device comes with Apple silicon to test.
Thanks so much for testing this!