lilypond, - automated music formatting, and the art of shipping · hand engraved scores (early 20th...

26
LilyPond Automated music formatting and The Art of Shipping Han-Wen Nienhuys LilyPond Software Design Jan Nieuwenhuizen 7th Frum Internacional Software Livre April 20, 2006. Porto Alegre, Brazil Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Upload: others

Post on 20-Feb-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

LilyPondAutomated music formatting

and The Art of Shipping

Han-Wen NienhuysLilyPond Software Design

Jan Nieuwenhuizen

7th Fórum Internacional Software LivreApril 20, 2006. Porto Alegre, Brazil

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 2: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

‘‘But that’s been done before, no?’’

(Finale 2003)Gold standardHand engraved scores (early 20th century)

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 3: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Beautiful music typography

A thing of beauty is a joy forever

Ease of reading

Better performance

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 4: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Automated music typography

Problem statement

Design overview

Examples of engraving

Implementation

Typography algorithmsFormatting architecture

Zen and the Art of Shipping Software

Conclusions

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 5: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Modeling notation

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 6: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Modeling notation

42�43­

zëë

��

����ë

ë�

�����è

5

����

>42� �43­

7��

Simple hierarchy does notwork for complex notation

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 7: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Divide and conquer

�� >�>�� �>>� �

{ c’4 d’8 }

typography ⇐ notation ⇐ hierarchical representation

1 Typography: where to put symbols

2 Notation: what symbols for which music

3 Music representation: how to encode music

4 Program architecture: glue together everything

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 8: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Typography

Music engraving: create pleasinglook

Visual: distance and blackness

A craft: learned in practice

No literature

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 9: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Font

Heavy look, matching line thickness

Rounded shapes

No prescribed rules, so imitate.

Henle (2001) Bärenreiter (1950) Feta (LilyPond v2.0)

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 10: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Spacing

Create illusion of evenness:Regular spacing:

tn ¼¼¼¼¼¼¼¼n tOptical correction:

tn ¼¼¼¼¼¼¼¼n t

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 11: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Algorithms for aesthetics

¨ ÆÆÆÆÆÆÆ

ÆÆÆÆÆÆÆÆÆƨ Æ

Literature: rule of thumb

Rule of thumb: cover all cases?

Case analysis: unwieldy

Must derive rules from examples

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 12: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Scoring

Define ugliness of a configuration

Try every configuration

Select least ugly one

¨ ÆÆÆÆƨ

variance=15.39 TOTAL=15.39 idx=0

Æ

¨2

ÆÆÆÆƨ

2

slope=2.00, L edge=1.71, R edge=9.37 TOTAL=13.08 idx=13

Æ

¨3

ÆÆÆÆƨ

3

slope=2.00, R edge=10.04 TOTAL=12.04 idx=4

Æ

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 13: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Score based formatting

Beam: stem lengths, slope

Ties: collisions, notehead/tie distance

Line breaking

Page breaking

Pro/Con

+ declarative programming

− expensive? how to define ugliness?

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 14: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Program architecture

Music typography is visual

Impossible to automate for all cases

Allow manual override for users

Need flexible program architecture:

‘‘Any sufficiently complicated C or Fortran program contains an adhoc informally-specified bug-ridden slow implementation of half ofCommon Lisp.’’(Phil Greenspun’s 10th rule of programming.)

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 15: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Software duct-tape

Put real LISP interpreter (GUILE Scheme) in C++.Symbols represented by ‘‘Layout objects’’, containing variables

Style: default values‘(RepeatSlash

. ((stencil .,Percent_repeat_item_interface::beat_slash)(thickness . 0.48)(slope . 1.7)))

Function value: callback

Tweak: override defaults

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 16: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Benchmarking output

LilyPond 1.4

Bärenreiter

LilyPond 2.7.29

43�� %%$

i!%%

%%!%%%� %�

i!%%

%%%%%%%%%%%!%!% !%

%%$i!%%

43�� !%

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 17: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

LilyPond today

9.5 years old; 9.5 man-years

10,000 downloads/month. 20,000 to 100,000 users?

Most frequent comments: ‘‘Thank you,’’ ‘‘Beautiful output.’’

Focus on engraving is unique.

Support through LilyPond Software Design

(March ’06) Total Linux Windows MacOS X% % %

Website 26,389 21 67 11Downloads 12,966 11 67 22Non-technical program: non-technical users

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 18: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

LilyPond today

9.5 years old; 9.5 man-years

10,000 downloads/month. 20,000 to 100,000 users?

Most frequent comments: ‘‘Thank you,’’ ‘‘Beautiful output.’’

Focus on engraving is unique.

Support through LilyPond Software Design

(March ’06) Total Linux Windows MacOS X% % %

Website 26,389 21 67 11Downloads 12,966 11 67 22Non-technical program: non-technical users

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 19: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Ship early, ship often

Why binaries?

Get rid of install/compile questions

Limit version support burden

Quality control

Expand user base

Condition for paid support

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 20: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

First attempts

Build LilyPond + dependencies (±20)Existing solutions: fink, mknetrel, autopackage, etc.

Problems

Duplication of effort

Unreliable & unpredictable

Need native machine

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 21: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Enter GUB, Grand Unified Builder

Mini package manager/distribution builder

Cross-compiling: no native machine required

Assemble into single installer

Python based: No More Shell Scripts!

Python class = package build spec

Share code for platforms via inheritance

Bugfix rollout: 25 min (6 platforms, Celeron 2GHz).

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 22: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Build your own binaries

Lessons

Long feedback cycle

Cross-building: libtool Shiatsu and autoconf Voodoo

Unix relocation: not there yet.

Windows32 sucks.

Future

automated release testing?

continuous building/testing?

use for other packages too?

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 23: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Conclusions

Music typography: subtle and difficult, but funComputer engraving

score based aestheticsflexible program architecturebenchmarking: compare with real engraving

End-user software: ship early, ship oftenhttp://lilypond.org/˜hanwen/gub/

Visit us, http://lilypond.org/

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 24: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Duplicate classical typography

Á��

�5

> >

> >bist

lieb

>f

> :> :

>>

> :du

ge

>> >>

> :

>

>Tag,

ein

>

>ner

wie

>

>Scho

sanft,

>

�♯

>>

*

>

> :> :

> >> >

> :Nacht.

Herz,

>

> :> :

cresc.

>die

te>>>

>

♮> >>>>>�

>

♯>>gend

be

� >durch

weg

**

:> :> :> :

>sie

das

>�

>ge

ich

>�>

+L

>Mit

Durft

*

>L

(L

>

>> >*

> >

*�

> :wacht.

Schmerz.

>

>

>

>er

ter

>

♯ >

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 25: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Print music databaseAutomatically convert MIDI, MusicXML, ABC→ SVG, PDF orpixmap:

(RISM 2002 database)

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)

Page 26: LilyPond, - Automated music formatting, and the Art of Shipping · Hand engraved scores (early 20th century) Han-Wen Nienhuys Automatic music formatting (FISL 7.0) Beautiful music

Collect scores on-linehttp://www.mutopiaproject.org/

Approximately 5000 pages of music.

Han-Wen Nienhuys Automatic music formatting (FISL 7.0)