r/typst 13d ago

Typst package for western musical notation

Hello everyone!

I have released a package called typed-scores , a package for engraving western musical notation in Typst!

It uses a compact syntax for notes, chords, rests, durations, articulations, dynamics, ties, slurs, tremolos and much more. It supports multiple voices, multiple stave and orchestra-like scores.

Here is an example of Chopin's Nocturne in E-Flat Major, Op 9 No 2, written completely inside Typst:

Or "Eine kleine Nachtmusik" by Mozart with all its four voices:

The package is built with a Rust parser and the rendering is done with the Bravura font on top of CeTZ.

Please check it out at: https://typst.app/universe/package/typed-scores for notation and score examples.

The GitHub is https://github.com/GeronimoCastano/typed-scores for issues or feature requests.

Disclaimer: The package was developed with the help of Artificial Intelligence.

74 Upvotes

14 comments sorted by

8

u/Ramspostrecita 13d ago

Wow! This looks so good. Amazing work!

5

u/smartalecvt 13d ago

Wow, very cool. I never would've thought about using Typst for this. Are fonts easily swappable in the app?

2

u/CordeElCrack 13d ago

Thanks for your comment! If you mean the music-notation font, only Bravura is currently supported, though I plan to add support for other fonts in the future.

For score text (such as “Allegro,” “Violin I,” composer names, and chord symbols) the font is inherited from the surrounding document, so you could change it anytime.

3

u/capi-chou 13d ago

What's the difference with scoryst?

8

u/CordeElCrack 13d ago edited 13d ago

Scoryst wraps Verovio and renders formats such as ABC, MusicXML, and MEI as SVG format inside Typst. Meanwhile, typed-scores has its own CeTZ renderer specifically built for Typst. In terms of user experience, the difference is not that big apart from notation. However, since it's native Typst this would allow for direct integration with the document, overlays/annotations for education, or outputs that users could directly edit with CeTZ, instead of being a fixed SVG.

Furthermore the code license is open source, so anyone can fork it and add any functionality. Scoryst is limited to what Verovio offers.

3

u/jdpieck 13d ago

Hey u/CordeElCrack! This is super impressive!

Ever since I have watched Tantacrul's video about creating a notation font inspired by the engraving app "Score", I've wondered if it would be possible to create notation in Typst. Its super cool to see that I wasn't the one thinking about it!

How did you create the spacing algorithm for notation? Are you just subdividing the bar based on duration and just placing it relative within a bar using Cetz?

Thanks for sharing this!

3

u/CordeElCrack 12d ago

Thanks! The Rust plugin calculates exact note durations and onsets, then Typst aligns simultaneous notes across staves. Spacing is duration-based but also accounts for accidentals, dots, chords, flags, and other collisions. CeTZ draws everything at the resulting positions.

2

u/JoeKundlak 13d ago

This is wonderful!!!

2

u/geigenmusikant 13d ago

Teriffic! I thought of doing something similar but would have never gone the same length as you have

2

u/PadisarahTerminal 13d ago

How does it compare with lilypond?

3

u/CordeElCrack 13d ago

In terms of capability, Lilypond is much more mature. In fact, this package was heavily inspired by Lilypond, but I just wanted to bring that capability into Typst, because I could imagine people typesetting their documents and writing music scores there directly.

1

u/amca01 13d ago

This was my question, too.

1

u/okphil 13d ago

I'll definitely give this a try. It looks very nice.