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

MIDI file playing in a devcontainer #175

Open
jeandeaual opened this issue Jan 30, 2021 · 15 comments · Fixed by #257
Open

MIDI file playing in a devcontainer #175

jeandeaual opened this issue Jan 30, 2021 · 15 comments · Fixed by #257
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jeandeaual
Copy link

jeandeaual commented Jan 30, 2021

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?

@lhl2617
Copy link
Owner

lhl2617 commented Jan 31, 2021

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!

@jeandeaual
Copy link
Author

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.

@lhl2617
Copy link
Owner

lhl2617 commented May 13, 2021

Sorry for putting this off for so long--I'm looking into this now

@lhl2617
Copy link
Owner

lhl2617 commented May 14, 2021

Hmm -- the whole devcontainer crashed for me when I tried any MIDI action from the extension

image

Is this what you see as well? @jeandeaual

@lhl2617 lhl2617 added bug Something isn't working help wanted Extra attention is needed labels May 14, 2021
@lhl2617
Copy link
Owner

lhl2617 commented May 14, 2021

Opened https://github.com/microsoft/vscode/issues/123836 -- it is rather annoying to debug without any logs/trace

@lhl2617
Copy link
Owner

lhl2617 commented May 14, 2021

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

@lhl2617
Copy link
Owner

lhl2617 commented May 14, 2021

@jeandeaual -- what is your host machine's OS?

@lhl2617
Copy link
Owner

lhl2617 commented May 14, 2021

Opened jazz-soft/JZZ#43 for jzz failing on WSL2

@lhl2617
Copy link
Owner

lhl2617 commented May 16, 2021

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.

@lhl2617
Copy link
Owner

lhl2617 commented May 18, 2021

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

@lhl2617 lhl2617 mentioned this issue May 18, 2021
@lhl2617
Copy link
Owner

lhl2617 commented May 18, 2021

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

@lhl2617
Copy link
Owner

lhl2617 commented May 18, 2021

Reopening until we can have MIDI IO via docker (if that's at all possible)

@lhl2617 lhl2617 reopened this May 18, 2021
@lhl2617
Copy link
Owner

lhl2617 commented May 18, 2021

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.

@jeandeaual
Copy link
Author

@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 Block devices, (i.e. /dev/sda) ? microsoft/WSL#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.

@lhl2617
Copy link
Owner

lhl2617 commented Jun 14, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants