Audiveris on docker container

A guide to containerize audiveris as GUI tool and as command line tool

Nicola Landro
2 min readDec 1, 2022

Audiveris is an open source OMR (Optical Music Recognition) that allow to obtain partiture that can be opened with a music program like muse score starting from an image or a pdf.

We just see how to install it on linux mint but now I want to show how to use it quickly in each operative system through docker.

The code to reach that results can be founded here.

Image of opened audiveris from docker

Run Audiveris command line with docker

It is possible to directly run by mounting as a volume the folder with the files to put on audiveris.

docker run --rm -v ./:/data registry.gitlab.com/nicolalandro/audiveris-docker/audiveris:5.2.5 /audiveris/Audiveris-5.3-alpha/bin/Audiveris -batch -export -option org.audiveris.omr.sheet.BookManager.useOpus=true -option org.audiveris.omr.sheet.BookManager.useCompression=false <IMAGE_PATH>

For more command line options about audiveris see here.

Run Audiveris GUI with docker

Instead to run it with a gui use:

xhost +"local:docker@"
docker run --rm -v ./:/data -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY registry.gitlab.com/nicolalandro/audiveris-docker/audiveris:5.2.5

A little watch to the code

Simply it start from gradle docker container.

FROM gradle:jdk17-alpine
# FROM gradle:jdk17

# GET AUDIVERIS CODE
# RUN apk update && apk add git
RUN apt-get update && apt-get install -y git
WORKDIR /
RUN git clone https://github.com/Audiveris/audiveris.git

# BUILD
WORKDIR /audiveris
RUN git checkout 5.2.5
# RUN apk update && apk add tesseract-ocr tesseract-ocr-data-ita
RUN apt-get update && apt-get install -y tesseract-ocr tesseract-ocr-ita
RUN gradle wrapper --stacktrace
RUN ./gradlew clean build
RUN tar -xf build/distributions/Audiveris-5.3-alpha.tar

# CHECK WORKING
ADD test_partiture.png /audiveris/data
RUN Audiveris-5.3-alpha/bin/Audiveris -batch -export -output data/ data/test_partiture.png
RUN cd data/test_partiture && unzip test_partiture.omr

# other requirements
RUN apt-get update && apt-get install -y lilypond libsndfile-dev
# No apk alternative... maybe you must install it with sh but seams do not enought
# RUN wget https://lilypond.org/download/binaries/linux-64/lilypond-2.22.2-1.linux-64.sh && sh lilypond-2.22.2-1.linux-64.sh

WORKDIR /data

ENTRYPOINT "/audiveris/Audiveris-5.3-alpha/bin/Audiveris"

Simply get audiveris code, build it and check (that is not a best practice) prepare the entrypoint at the end to use it when the container will be runned.

Conclusions

That solution can be applied to any other java progarams. It will be interesting to install with alpine to save some memories.

So contribute to opensource by dockerizing java open source applications!

--

--

Nicola Landro

Linux user and Open Source fun. Deep learning PhD. , Full stack web developer, Mobile developer, cloud engineer and Musitian.