lilypond-user
[Top][All Lists]
Advanced

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

Re: Custom Format


From: Callum Cassidy-Nolan
Subject: Re: Custom Format
Date: Wed, 31 Mar 2021 19:12:17 +0000

Hi Aaron,

Thanks for reminding me about the mailing list - my email client only put in 
your email when I pressed reply - so I have to enter it manually (proton mail 
web client).

> Since LilyPond already uses numbers for durations, you might consider
> writing numeric pitches in alphabetic form, since this most clearly
> disambiguates pitches from durations.  Here is an example of defining
> custom note names in LilyPond:

Thanks, I will think about how I could incorporate that if I find the number 
syntax unwieldy.

I have used the search function on the docs: 
http://lilypond.org/doc/v2.22/Documentation/notation/index#top for the term 
`make-pitch` and in the http://lilypond.org/doc/v2.22/Documentation/extending/ 
but I wasn't able to find an explanation of what that does.

Edit) After searching - it was the fourth search result on here: 
https://www.google.com/search?btnG=Google+Search&brute_query=make-pitch&q=site%3Alilypond.org%2Fdoc%2Fv2.21+make-pitch
 here is the link: 
http://lilypond.org/doc/v2.21/Documentation/internals/scheme-functions

Here is it's definition:

Function: ly:make-pitch octave note alter

    octave is specified by an integer, zero for the octave containing middle C. 
note is a number indexing the global default scale, with 0 corresponding to 
pitch C and 6 usually corresponding to pitch B. Optional alter is a rational 
number of 200-cent whole tones for alteration.

Could you explain why 6 usually corresponds to the pitch B and not always?

Also I am new to Scheme and still trying to wrap my head around your original 
function:

#(define (: n)
   (apply
    ly:make-pitch
    (cons (1- (floor (/ n 12)))
          (list-ref `((0 0) (0 ,SHARP) (1 0) (1 ,SHARP)
                      (2 0) (3 0) (3 ,SHARP) (4 0)
                      (4 ,SHARP) (5 0) (5 ,SHARP) (6 0))
                    (modulo n 12)))))


Here is my best guess, for each element in the following list - apply the 
function make-pitch to each element.

floor (/ n 12 ): is representing how many octaves fit into this number? Why do 
you subtract this number from one?

The list-ref thing is choosing one of the elements from that list , but I don't 
fully understand what an arbitrary element from that list actually is, for 
example what does (3, SHARP) mean?

If you could help clarify any of this, it would be appreciated,
Callum

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, March 31, 2021 1:20 PM, Aaron Hill <lilypond@hillvisions.com> 
wrote:

> (For your reference, do try to remember keeping the mailing list on
> future emails. This ensures wider visibility and continuity of the
> discussion for all users. Also, those of us who participate on the list
> are sometimes busy with other work, so personal contact can often result
> in delayed or missing responses.)
>
> > Could you point me to a place in the docs where I could understand
> > what your solutions/functions are doing?
>
> While not exhaustive, I would direct you to the Extending manual [1].
> It is a good starting point; in particular, it covers how LilyPond
> intermingles its own music syntax with that of Scheme.
>
> [1]: http://lilypond.org/doc/v2.22/Documentation/extending/index.html
>
> > > This looks like exactly what I want. Thank you for your efforts.
> > > I will give each of these a shot and let you know how that goes.
>
> Since LilyPond already uses numbers for durations, you might consider
> writing numeric pitches in alphabetic form, since this most clearly
> disambiguates pitches from durations. Here is an example of defining
> custom note names in LilyPond:
>
> %%%%
> \version "2.22.0"
>
> #(define (define-custom-note-names language notes)
> (set! language-pitch-names
> (acons language notes language-pitch-names)))
>
> #(define-custom-note-names 'numeric-english
> `((zero . ,(ly:make-pitch -1 0 NATURAL)) (one . ,(ly:make-pitch -1 0 SHARP)) 
> (two . ,(ly:make-pitch -1 1 NATURAL)) (three . ,(ly:make-pitch -1 1 SHARP)) 
> (four . ,(ly:make-pitch -1 2 NATURAL)) (five . ,(ly:make-pitch -1 3 NATURAL)) 
> ; ... )) #(define-custom-note-names 'numeric-roman`((z . ,(ly:make-pitch -1 0 
> NATURAL))
> (i . ,(ly:make-pitch -1 0 SHARP))
> (ii . ,(ly:make-pitch -1 1 NATURAL))
> (iii . ,(ly:make-pitch -1 1 SHARP))
> (iv . ,(ly:make-pitch -1 2 NATURAL))
> (v . ,(ly:make-pitch -1 3 NATURAL))
> ; ...
> ))
>
> \language "numeric-english"
> { zero'4 four'8 five' two'2 }
>
> \language "numeric-roman"
> { z'4 iv'8 v' ii'2 }
> %%%%
>
> NOTE: I've abbreviated the definitions above, but you should be able to
> continue the patterns as needed.
>
> -- Aaron Hill





reply via email to

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