need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hey list! Trying to work up to being a bigger and better contributor to The ’Pond. Found and copied that “transpose major to minor” scale function in the previous thread I contributed to, but (a) don’t really know if it’s the best way to do what the OP wanted, (b) thought it might be overkill f

Re: need help building a Scheme function

2024-06-21 Thread Lukas-Fabian Moser
Hi Kieren, Am 21.06.24 um 16:39 schrieb Kieren MacMillan: %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define-music-function (pitchIn pitchOut music) (ly:music? ly:music? ly:music?) (ly:message "Pitch is: ~a" (ly:pitch-notename (ly:music-property pitchIn 'pitch))) music) mel

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi L-F! >> Is map-some-music the correct next move? > Yes. Thanks! > I take it you're only asking for confirmation you're on the right track? :-) Correct. I’ll try to ask more specific questions when I need more than confirmation. > So I only suggest use the ly:pitch? predicate for pitchIn/pi

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi Lukas! All right… already back for more specific help. I struggled with map-some-music, and failed. Scanned through Jean’s [amazing] “Extending” docs — yes, yes, I need to RTM on that one, page-by-page! — and found an example with music-map, so tried that instead. Also failed. %%% SNIPPET

Re: need help building a Scheme function

2024-06-21 Thread Timothy Lanfear
On 21/06/2024 17:36, Kieren MacMillan wrote: Hi Lukas! All right… already back for more specific help. I struggled with map-some-music, and failed. Scanned through Jean’s [amazing] “Extending” docs — yes, yes, I need to RTM on that one, page-by-page! — and found an example with music-map, so

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi again, I’m a little confused that the output of %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?) (music-map (lambda (m) (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m) music)) \

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi Timothy, > Your lambda function for the mapping returns the value of ly:message, which > is #. You need to return some music. Changing the lambda > function to > (lambda (m) > (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m) > maps the music to itself without any changes. Oh

Re: need help building a Scheme function

2024-06-21 Thread David Kastrup
Kieren MacMillan writes: > Hi again, > > I’m a little confused that the output of > > %%% SNIPPET BEGINS > \version "2.25.11" > > adjustPitch = > #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? > ly:music?) >(music-map > (lambda (m) > (ly:message "Pitch is:

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi David, > If you want to only look at note events, you need to check for them > yourself. music-map is not discriminating. Ah! Lovely Socratic lesson. :) Thanks, Kieren. __ My work day may look different than your work day. Please do not feel oblig

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi all, Thank you for the rapid-iteration non-isochronous Scheme class! :) Before I do the next step, is this optimal at this point? %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?) (music-map (lambda

Re: need help building a Scheme function

2024-06-21 Thread David Kastrup
Kieren MacMillan writes: > Hi all, > > Thank you for the rapid-iteration non-isochronous Scheme class! :) > > Before I do the next step, is this optimal at this point? > > %%% SNIPPET BEGINS > \version "2.25.11" > > adjustPitch = > #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi David, > To say something is "optimal", you have to state your objective. I guess the immediate objective was to output [in the log] a list of pitches given the 'music' input. > music-map is used for changing music, and you don't appear to do any > useful changes to the music. In fact, you

Re: need help building a Scheme function

2024-06-21 Thread Lukas-Fabian Moser
Hi Kieren, I’m a little confused that the output of %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?) (music-map (lambda (m) (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m) musi

Re: need help building a Scheme function

2024-06-21 Thread Lukas-Fabian Moser
Hi Kieren, Am 21.06.24 um 20:25 schrieb Kieren MacMillan: Hi all, Thank you for the rapid-iteration non-isochronous Scheme class! :) Before I do the next step, is this optimal at this point? %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define-music-function (pitchIn pitchOut music

Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi Lukas, > Elaborating on David's explanation, it might be instructive to study the > output of: > [snip] > In short: music-map really considers every music object in a music tree. That was instructive — thanks! Kieren. __ My work day may look differ

Re: Adjust line spacing in markup column for fingerings

2024-06-21 Thread Vaughan McAlley
On Fri, 21 Jun 2024 at 11:09, Curt McDowell wrote: > baseline-skip seems to do the job: > > > > Found here: LilyPond snippets: Tweaks and overrides > > > Regards, > Curt > > On 6/20/2024 5:00 PM, Fennel wrote: > > Hi al

Re: need help building a Scheme function

2024-06-21 Thread David Kastrup
Lukas-Fabian Moser writes: > But: Whether you use music-map or map-some-music, your helper function > (your lambda) is expected to return the new music into which the given > argument m should be transformed. So in any case, your lambda function > should return music - in the trivial case, it cou

markup function accepting either markup or markup list as argument

2024-06-21 Thread Werner LEMBERG
Folks, I would like to write a markup function that can either accept a markup or a markup list as an argument. The code below works fine, reporting ``` bar: (#) baz: 1 bar: ((#) (#)) baz: 1 ``` as expected. (The `baz` argument is inserted in the demo code to avoid interference with L

Re: need help building a Scheme function

2024-06-21 Thread David Kastrup
Lukas-Fabian Moser writes: > Elaborating on David's explanation, it might be instructive to study the > output of: > > \version "2.25.9" > > mappingFunction = > #(define-music-function (music) (ly:music?) >(music-map > (lambda (m) > (ly:message "Considering music:\n~a\n-\n"

Re: markup function accepting either markup or markup list as argument

2024-06-21 Thread David Kastrup
Werner LEMBERG writes: > Folks, > > > I would like to write a markup function that can either accept a > markup or a markup list as an argument. You mean, a markup command. > The code below works fine, reporting > > ``` > bar: (#) > baz: 1 > bar: ((#) > (#)) > baz: 1 > ``` > > as expected