[Sorry! I wrote this two days ago on a train in one of the famous German
cell connection dead zones - and then forgot to actually send it later.]
Hi Kieren,
The last "m" in your innermost (if ...) is unnecessary: As with the difference between "for" and
"map" in plain Scheme, the return value
Hi Lukas!
Thanks for the patient and helpful tutorial(s). :)
> The last "m" in your innermost (if ...) is unnecessary: As with the
> difference between "for" and "map" in plain Scheme, the return value of the
> lambda function in for-some-music gets discarded ("for" functions are
> supposed t
The last "m" in your innermost (if ...) is unnecessary: As with the
difference between "for" and "map" in plain Scheme, the return value of
the lambda function in for-some-music gets discarded ("for" functions
are supposed to _do_ something, not _return_ something).
No, it doesn't. It is a boole
Hi David,
If you don't want to call upon undocumented internals of LilyPond (the
(@@ (lily) ...) bit), you can just use
[with-output-to-string]
Wow, thanks! I hadn't encountered this possibility yet.
Also thanks for pointing out the possibility of in-place modification.
Lukas
Hi Kieren,
for-some-music does not return music. It works on music in-place. So
the last thing in your music function must not be for-some-music but
rather the music that you have been working on.
So…
%%% SNIPPET BEGINS
adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:pitc
Hi David,
> for-some-music does not return music. It works on music in-place. So
> the last thing in your music function must not be for-some-music but
> rather the music that you have been working on.
So…
%%% SNIPPET BEGINS
adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:p
Kieren MacMillan writes:
> I tried a few times, but got errors (about returning
> unspecified). Hints appreciated.
for-some-music does not return music. It works on music in-place. So
the last thing in your music function must not be for-some-music but
rather the music that you have been worki
Hi David,
> This will also adjust eis and eses to e. Note names are numbers and can
> be compared with = . (make-music 'NoteEvent m) is silly and creates an
> unnecessary copy. You can just use m instead.
Thanks — current version:
%%% SNIPPET BEGINS
\version "2.25.11"
adjustPitch =
#(define
Kieren MacMillan writes:
> Hi again,
>
>> There is no necessity to return a new NoteEvent; you can just change
>> pitch on the existing one.
>>
>> Music functions are allowed to modify their music arguments in place.
>
> This is what I have so far, which appears to do what I want:
>
> %%% SNIPP
Hi again,
> There is no necessity to return a new NoteEvent; you can just change
> pitch on the existing one.
>
> Music functions are allowed to modify their music arguments in place.
This is what I have so far, which appears to do what I want:
%%% SNIPPET BEGINS
\version "2.25.11"
adjustPitc
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"
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
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
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
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
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
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
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
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
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:
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
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))
\
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
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
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
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
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
27 matches
Mail list logo