lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to count the number of notes in a .ly file?


From: David Kastrup
Subject: Re: How to count the number of notes in a .ly file?
Date: Tue, 10 Dec 2013 19:52:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

"Jan Rosseel" <address@hidden> writes:

> Subject line says it about all. How can I count the number of notes
> present in a .ly file? Or the number of notes in a music expression? 

Number of notes in a music expression would be something like

#(length (extract-typed-music music 'note-event))

If you want to count rests, skips and similar stuff like notes, write
rhythmic-event above.  If a chord should only count once, write
#(length (extract-typed-music '(note-event event-chord)))
in order to stop the extraction at chord level.

> I assume somebody made some (python) script to do this, but I can't
> bring it to the surface with my googling skills... 

That really is a use case where LilyPond's Scheme interpreter makes
things easier than an external script.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]