Euterpes on Android
Euterpes runs on Android tablets and phones through Chaquopy, which embeds Python in a normal Android
app: native Kotlin and Jetpack Compose screens, laid out as the desktop's, drive the same Python
core the desktop uses through the Qt-free facade euterpes.mobile. Why:
ADR 7.
Status (alpha, tablets first, phones begun)
Checked on a tablet-sized emulator (1280 × 800 dp, landscape), light and dark, 23 November 2026:
- The window as the desktop's: the rail of pages (Donate and Options at its foot), the page, and the bottom bar (play, stop, tempo from 25 to 200 %, the metronome, the bar and time, sound).
- Write: the ribbon (Write, Marks, Score, Instruments and View tabs; New, Open, Save, Import, Record and Export at its right), the LilyPond text coloured as on the desktop with its slide tab, and the score engraved by Euterpes' own engraver on A4 sheets with 2 cm margins: pinch to zoom, drag to scroll, Fit, page turning, and a cursor following playback. The score is light whatever the program's theme, as on the desktop.
- Editing, arm then apply, as on the desktop (ADR 9): a symbol of the ribbon arms and stays pressed, a line under the ribbon says what is armed, and each tap on a note applies it; the same symbol again, or Stop, puts it down. A note value writes where you tap on the staff and changes the length of a note you tap. Legato, hairpins and octave signs take two taps, the first note and the last, as the repeats do for the first and last note of their bars. The Write tab includes Move, the Bar tools, note values, rests, accidentals and the Clipboard (with Delete, a key on the desktop). The desktop puts the note values, rests and accidentals on its separate Notes tab. The Marks tab has the articulations, ornaments, dynamics, words, repeats and pedal; the Score tab the clefs, keys (Another key… lists all thirty) and metres. A long press on a symbol names it. A phone shows one section of a tab at a time, named in a row under it.
- Words: Lyrics or Chord arms; a tap on a note opens a box under it, as on the desktop, and puts the tool down. For lyrics Space goes to the next note and a hyphen joins the syllable to the next; the keyboard's Done or ✓ writes and closes, ‹ and › go back and on (Shift+Tab and Tab on an attached keyboard), ✕ closes without writing. A phone hides its bars while the box is open.
- Choosing notes: with nothing armed a tap chooses a note. Press and let go to add one to the selection; press, hold and drag to draw a box (with a tool armed, the box gives it every note inside). Only Cut, Copy, Paste, Delete and Duplicate act on what is chosen, as the desktop's selection commands: they never arm.
- Move: the hand of the Write tab arms, and a finger put on a note drags it: up or down for its pitch (named as it goes), sideways for its beat in its own voice, or onto the other staff of a piano. A note of the selection carries the whole selection. Dragging elsewhere still moves the page.
- Bars: This staff or All staves arms and the bar lines show ⊕ signs: tap one to add a bar there, tap a bar to choose it (it is tinted; press and hold to reach to another), and drag a bar sideways onto another to move it. The Bar actions menu inserts, duplicates, deletes, empties or moves the bars chosen.
- The tools are the desktop's own (
euterpes/core/editing/). Undo and Redo stay at the top whatever the tab. The text panel is editable too: the score follows once typing pauses. - Instruments, the tab that took over the Composition page, as on the desktop: add a staff for one of the instruments, or give a staff another (name, sound, clef and transposition). Extract part and Transpose are shown but not yet usable.
- Three ways to show the score, as the desktop's, on the View tab: Pages (sheets of the paper chosen), Scroll (one long strip, its lines as wide as the view at the zoom you have, laid out again when you zoom) and Follow (one endless line without the titles, which slides past the cursor held still at a fifth of the way in, the clefs, key and time held at the left over the bars passing under them). Constant speed, in the bottom bar, spaces the notes by time so that the cursor moves at one speed, in any of the three. The choice is kept.
- Edit or read: Edit (beside Undo) switches between editing and reading the score: out of Edit, one finger moves the music any way and flings it on, two pinch, a double tap zooms in or back to the sheet's width, and nothing is chosen or armed. A phone shows the ribbon's tabs only in Edit.
- New and Save, as on the desktop: New starts from the desktop's short melody; a bundled piece opens as a copy, so its first Save asks for a title and keeps it as the player's own under My Scores in the library (its pictures with it), and later saves write back there. A star before the title marks unsaved changes, and New or opening a piece asks first whether to save them.
- Export, the desktop's list, each asking where with Android's file picker: PDF on the chosen
paper with page numbers and running header and footer, one tall PNG or SVG picture (the SVG
carries the music glyphs as outlines and the pictures inside it, so it needs no font), MIDI, WAV (the
desktop's additive synthesiser, carried into Kotlin in
Rendering.kt), MP3 (the same sound, at 192 kbit/s, through LAME:lameenc, which Chaquopy's package index has built for Android), MusicXML and a copy of the LilyPond text. - Library, as the desktop's: a search box (title, composer, number or folder), the folder tree, the chosen piece's details with Open this piece, and its pages (up to twelve, from its PDF, or engraved by the core without one). A long press makes, renames, moves (Move to…, in place of dragging) or removes categories and pieces; removing a piece deletes its files, since Android has no bin. Add a piece… reads a LilyPond, MusicXML, MIDI or LaTeX file and asks for its details. The library lives in the app's storage: there is no choosing its folder. A phone shows the details under the tree and the pages over the whole screen (Preview).
- Practice, as the desktop's: tick your part; Wait for me or Keep tempo; hear your part
too, sound the notes you play, any octave; loop bars, starting slower and speeding up; Start,
Stop and Restart (the bar's Play does the same); judged notes coloured on the score, the awaited
ones in the accent colour; the result, the last note and What to practice next, kept on the
device. It is played on the on-screen piano (five octaves on a tablet, two with arrows on a
phone), with the bottom bar's tempo and the Metronome's count-in. The desktop's own practice
service judges it (
euterpes/services/app_practice.py) on a silent player; the app sounds the parts to be heard from a MIDI file kept in step with it. The input is the on-screen keys, a MIDI keyboard (USB or Bluetooth, through Android's MIDI service) or the microphone, one voice; and Calibrate measures the input delay by tapping along with clicks. On the score shows the notes played as a shadow, makes the current note pulse and draws note lengths as bars; Options holds the effects of a note hit (shake, halo, glow, sparks, stars, hearts, fireworks), their palette, and the cursor's look (bar, dot, bouncing dot, emoji), as the desktop's. Record this run keeps the run on the device, with the microphone's sound when that is the input; Recordings… replays it on the score, lists its mistakes, renames, deletes and exports its sound as WAV or MP3. There is no video export. - Tools: the Tuner and the Metronome on one page of the rail. Swipe left from the Tuner to reach the Metronome, right to come back, or tap their names in the title, which marks the one shown. The pendulum's stick and the tuner's wheel take drags that start on them.
- Metronome, as on the desktop: drag the pendulum's stick to set the tempo (silent while held, beating from where it is let go), tap it to stop; 30 to 250 a minute, beats per bar, accent, tap tempo, and a count-in of up to four bars before the score. It is the one metronome of the bottom bar: while the score plays it clicks with the score's beats (wood blocks written into the MIDI file that is played), and otherwise it ticks on its own.
- Tuner, as on the desktop: the wheel of notes, turned by dragging it, tapping beside the visor
or the step buttons, with the cents needle inside and Listen in its hub; Set as goal note;
A4 from 400 to 480 Hz; the reference tone, held or struck, for each instrument's strings or any
note; and the chart and summary of the session. The YIN pitch tracker
(euterpes/dsp/pitch.py, in Kotlin in
Listening.kt) listens from 40 to 4300 Hz; the core keeps the session. Leaving the tuner stops listening and the tone. Android asks for the microphone the first time; nothing heard is kept. - The microphone's global mute in the bottom bar, as on the desktop: muted, nothing listens.
- Options, in the desktop's pages. General: note names (letters or solfège), starting on the last piece, the copy of the score kept in exported files (not in a PDF) and the warning of what a format cannot hold, Donate. Appearance: the themes, accent, text and selection colours of one's own, the score's theme, the text editor's size and line breaks. Score view: paper, orientation, margins, printed score size and spacing (a tablet's sheets and the PDF; a phone lays the music out to its width), and notes coloured to read them. Practice: the run's mode, input and switches, the slow loop, the input delay, effects and cursor. Sound: silence, the microphone's mute, count-in, the pitch of A4, and the picture's delay behind the sound (0 to 500 ms, set by ear with the metronome ticking). The desktop's language, library folder, update check, microphone choice and soundfonts are not here.
- Printed score size is a percentage of the automatic physical staff size, separate from screen zoom. A larger value may need more PDF pages; a system too tall for a sheet is reduced to fit. On phones the on-screen sheet is narrower than the paper chosen for PDF.
- Abbreviate instrument names after the first page, off initially, uses a staff's quoted
shortInstrumentNamein its\withblock or initial\set Staff.shortInstrumentNameon later physical pages of the view and PDF. All systems on the first page and staves without a short name keep the full name. - Page decorations, in Options ▸ Score view and the Write page's Score tab, apply to the
on-screen page view and PDF export. Choose page-number position or turn numbers off, whether to
number the first page, and the first number. Running header and footer templates accept
{title},{composer},{page}and{pages}; the header starts on the second page. - Orpheus' Journey, the desktop's adventure, offered once at the first start and kept under
Options ▸ General (resume, restart). The story, the order of its eleven chapters and what
solves each are the core's (
euterpes/core/quest.py), shared with the desktop; the app words each task for touch, outlines the control to use and watches for the task to be done. A phone's card folds to its task as soon as you reach past it. - Views of the beat, as on the desktop: besides the pendulum, a bar of beats, a swinging ball and a circle (Metronome, View); a tap on them starts and stops the metronome.
- The icon is adaptive, made from the desktop's drawing (
tools/lyre.svg) bytools/make_icon.py: the launcher masks it to its own shape, and themed icons tint the lyre. - Phones (portrait first; one app, which takes the phone's layout on a screen narrower than 600 dp or lower than 480 dp, and switches at once when a tablet turns or a phone unfolds): Write, Practice, Tools, Library and Options (≡) along the bottom, with shortcuts to the Tuner and the Metronome in the bar of controls; a slim top bar with the page's name (the score's title on Write, with Edit, Undo, Redo, the text and the file commands; on Tools the two names to switch between); the ribbon's tabs along the foot of Write, each opening a row of its sections (Marks: Articulations, Ornaments, Dynamics and so on) and above it the symbols of the one chosen, the score still in sight to tap notes in; the text in place of the score; and the score engraved on paper 100 mm wide, so the staff keeps a readable size and the music reflows to the screen. Play, stop, where the music is, the Tuner, the Metronome, the tempo (its menu holds the metronome's switch), the microphone and sound stay in sight. The Library sets the details under the tree; the Metronome's controls wrap, and the Tuner's cards scroll.
Not yet on Android: editing titles on the staff, extracting parts, naming, ordering and removing staves, range checks and transposing; in Practice, choosing loop bars on the score and exporting a recording as video; the desktop's soundfonts (playback uses Android's General MIDI synthesiser, and the tuner's tone is the plain one), import on the Write page and of scans and recordings, translations, and a phone on its side laid out for landscape.
Building
The Gradle project lives in android/.
- Install the Android SDK (API 36 and build-tools 36.0.0), NDK 30.0.16248370, JDK 17 or
newer, Python 3.13, Bash, and GNU make. First build the local LAME wheels from the repository
root (replace the NDK path):
python android/build_lame_wheels.py --ndk "$ANDROID_HOME/ndk/30.0.16248370". On Windows use Git Bash and GNU make, and pass their executable paths using--bash,--shelland--makeif they are not on PATH. The shell path must have a space-free short path. Then openandroid/in Android Studio or rungradlew assembleDebugthere. - The app's version is the program's, read from
euterpes/__init__.py. - Chaquopy installs
lameencand the rebuilt LAME library only fromandroid/build/lame-wheels; it cannot silently fall back to the old 4 KB-aligned library on the package index. The wheel builder verifies pinned source and upstream wheel hashes, uses the NDK to link LAME with 16 KB alignment, and removes the unused old command-line executable. These wheels are private to this app: the rebuilt library targets API 26 although its inherited wheel tag says API 21; the Gradle build enforces API 26 or higher. The builder needs network access for its pinned inputs. Chaquopy needs Python 3.13 on the computer to match the app. Where the defaultpythonis another, seteuterpes.buildPython=<path to a python>inandroid/local.properties. - LAME 3.100's library source is LGPL version 2 or later; the
lameenc1.7.0 wheel declares LGPL version 3. Their license files remain in the packaged requirements. The builder uses the unmodified LAME source archive and the Chaquopy encoder wheel, based on lameenc 1.7.0 with Chaquopy's build patch. The binding wheel includes the LGPLv3 text but not the GPLv3 text that it incorporates. Distributors must assess the applicable GPL/LGPL texts, source, notice, replacement and installation requirements; retaining the wheel's license files alone does not establish compliance. - The source, input wheel hashes, NDK revision and build flags are pinned. The rebuilt wheel's archive timestamps are fixed; identical bytes across different hosts or toolchains are not guaranteed.
- After building, run
python android/verify_16k.py android/app/build/outputs/apk/debug/app-debug.apkand the same command withandroid/app/build/outputs/bundle/release/app-release.aabafterbundleRelease. These check ELF load segments, including Chaquopy's nested archives, not ZIP alignment. Check the APK separately with SDKzipalign -c -P 16 4 <apk>. A release bundle also requires signing, Play's generated APK alignment check, and testing on a 16 KB-page Android device or emulator before publication. - The build copies the repository's
euterpespackage into the app, withoutui/, the desktop adapters and the command line, and the Bravura font and the icon as Android resources. adb install -r android/app/build/outputs/apk/debug/app-debug.apkputs it on a device or emulator. To try a tablet layout on a phone emulator:adb shell wm size 2560x1600andadb shell wm density 320(undo withwm size resetandwm density reset, which brings back the phone's layout while the app runs).
Where the code lives
| Piece | Location |
|---|---|
| The facade Kotlin calls (library, engraving, MIDI, metronome, tuner) | euterpes/mobile.py |
| The page layout shared with the desktop's page view | euterpes/core/engraving/pages.py |
Android paths (IS_ANDROID, the app's private folder) |
euterpes/paths.py |
| The window: rail, bottom bar, Options; which layout | android/app/src/main/java/io/github/dutrairs/euterpes/Shell.kt |
| A phone's window: top bar, pages along the bottom, controls | Phone.kt |
| Pages | WritePage.kt, LibraryPage.kt, ToolsPage.kt |
| Library | LibraryDialogs.kt, LibraryPreview.kt |
| Practice | PracticePage.kt, Practice.kt, Piano.kt, MidiKeys.kt; euterpes/services/app_practice.py |
| Tools | MetronomePage.kt, BeatViews.kt; TunerPage.kt, TunerDial.kt, TunerChart.kt |
| The score's drawing and the cursor | ScoreView.kt, Engraving.kt |
| State and calls to Python | AppState.kt, Python.kt |
| Sound: playback, clicks, the tone | Player.kt, Sound.kt |
| Listening: the microphone and the YIN pitch tracker | Listening.kt (tests in app/src/test/) |
| Export: PDF and PNG drawing, glyph outlines for SVG; WAV rendering | Exports.kt, Rendering.kt |
| The SVG writer (shared core) | euterpes/core/engraving/svg.py |
| The adventure: story and rules; its words for touch; its card | euterpes/core/quest.py; mobile.py; Quest.kt, QuestCard.kt |
| Colours and widgets copied from the desktop | Theme.kt, Widgets.kt |
| Facade tests | tests/test_mobile.py |