Skip to content

Releases

Swara v0.1.1

Choose a tag to compare

@github-actions github-actions released this 26 Oct 00:08

Swara v0.1.1

A release with one fix. The grammar, the language server and the plugin otherwise behave exactly as in v0.1.0.

Fixed

swara info and :checkhealth swara now name the grammar commit the program was built from. Every v0.1.0 binary reported local there instead. The build read the grammar's commit from Cargo.lock, which records a commit only for a git dependency, and every build, the release included, compiles the grammar from a checkout beside Swara's own. The build now asks git for the commit of that checkout, and still reports local for a grammar folder that is not a git checkout.

Unchanged

The grammar is still tree-sitter-lilypond v0.1.0, commit 53293e9c5ddb55c033b9068842b158ed01bb74cb, so the grammar revision in a Neovim configuration stays at v0.1.0. The five platform archives, SHA256SUMS and the checksum check before unpacking are the same as in v0.1.0, and every known limit in the v0.1.0 notes still applies.

Upgrading

The plugin downloads v0.1.1 the first time a LilyPond file opens after the plugin updates. A swara found on PATH is used instead of the download, and the plugin does not compare its version, so a copy installed from the Homebrew tap needs brew upgrade swara. The README now describes that install.

Swara v0.1.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 20:42

Swara v0.1.0

The first release of Swara, a LilyPond toolkit for Neovim made of a Tree-sitter grammar, a language server written in Rust and a Neovim plugin.

What ships

The swara program comes as an archive for each of five platforms: macOS on Apple silicon and on Intel, Linux on x86-64 and on ARM64, and Windows on x86-64. Each archive holds the program and the grammar library it loads, and SHA256SUMS lists every archive's checksum. The plugin downloads the archive for its platform the first time a LilyPond file opens, unless a swara is already on PATH, and unpacks it only once the checksum matches.

The grammar is tree-sitter-lilypond v0.1.0, commit 53293e9c5ddb55c033b9068842b158ed01bb74cb, written from scratch under the MIT licence. It reads embedded Scheme into the same tree as the music around it, and its queries give colours, folds, indent and the variables a file defines.

The language server, swara lsp, does the following.

  • Checks every edit within a few milliseconds for syntax errors, commands nothing defines, note names the file's note language lacks, and includes that name no file.
  • Runs LilyPond's own check once typing pauses, without saving the file, and never runs LilyPond on a file that was only opened.
  • Tidies a file on save and on request, also as swara format from the command line.
  • Completes LilyPond commands, shows their descriptions on hover, jumps to where a variable is defined, and lists variables and \score, \book and \bookpart blocks as an outline.
  • Builds the PDF and MIDI on each save and reports when they are in place.

The Neovim plugin adds the :Swara command and its keys, which build, open the PDF, preview the score inside the editor, play it through FluidSynth, stop it, and open it in MuseScore. It opens the PDF in Skim after the first build and has Skim reload it after each later one, and it reports everything it uses through :checkhealth swara. :Swara new writes guitar, piano and song lessons from templates. The guitar and piano lessons print each note's sargam name under the staff in Bengali, Devanagari or Latin letters. The song lesson converts lyrics typed in English letters to Bengali script and prints the converted line, the typed line or both.

Speed

Every speed target in the design was met. The PDF after save took 266 ms for a 4-bar lesson and 1,311 ms for a 100-bar song, the LilyPond check 551 ms after the last edit against a target of 600 ms, the first play's first note about 1,060 ms against about 1,500 ms, and the rest a few milliseconds or less. docs/bench/speed.md has every figure and how each was taken.

Missed targets

The grammar set out to beat the existing LilyPond grammar for Tree-sitter, nwhetsell/tree-sitter-lilypond, on three criteria fixed in advance, and it passes two of them. It parses the test corpus 1.67 times as fast, and it catches 30 of 36 deliberately broken files at the line LilyPond names, against 16. It fails the first criterion. Of the 2,774 corpus files that LilyPond accepts, 6 show an error with Swara's grammar, against 2 with the existing one.

None of the 114 published scores from the Mutopia Project in the corpus shows an error. The six are LilyPond's regression tests, documentation snippets and one of its startup files. Three of them define new syntax while LilyPond runs them, a music function named @ written before notes and a #[ form for Scheme's reader, which no grammar can know in advance. The other three use rare forms inside \with blocks and override values, which the grammar could learn and has not yet. A file that uses one of these shows a syntax error that LilyPond does not report. docs/bench/verdict.md lists each file and why.

Known limits

  • A ~ that joins two syllables under one note, written inside a word that the song lesson converts to Bengali, prints as a literal tilde.
  • The lyric converter is a general engine, but Bengali is the only script it carries a table for.
  • Swara is tested with LilyPond 2.26.0 only. Other versions should work, because the server reads LilyPond's commands from whichever LilyPond is installed.
  • The tests run on macOS and Linux. The Windows archive is built on every release but not tested.
  • The play figures run to the first note Swara sends. The further delay FluidSynth's audio buffer adds before that note sounds was not measured.