I'm clearly Scheme challenged. I've spent several hours trying different
variations of the following.
#(define (note? x)
(eq? 'EventChord (ly:music-property x 'name)))
#(define notesOnly
;; Remove anything that is not a note.
(define-music-function (parser location music) (ly:music?)
(music-filter (lambda (x) (if (note? x) x #f) ) music)))
If I run different versions \notesOnly on music containing notes plus other
things, I get either everything passing through unchanged or everything
removed. What's the right way to construct a music filter that returns
only the pitch-carrying elements?
Cheers,
Mike
On Wed, Dec 22, 2010 at 2:14 PM, Michael Ellis <[email protected]>wrote:
> Thanks, Carl. This looks promising ...
> Cheers,
> Mike
>
>
>
> On Wed, Dec 22, 2010 at 10:46 AM, Carl Sorensen <[email protected]>wrote:
>
>> On 12/22/10 8:08 AM, "Michael Ellis" <[email protected]> wrote:
>> >
>> >
>> > Putting this together with your workaround produces the code and output
>> shown
>> > below. This works quite well. So the issue I'm wrestling with now is
>> whether
>> > it's feasible to automate the editing of 400+ files to separate the clef
>> and
>> > instrument names from the notation, detect the original key, and rewrite
>> the
>> > score block to produce the desired results.
>> >
>> > Thanks again for your help and any suggestions for how proceed with the
>> > automation are more than welcome.
>>
>> You might try using music-filter to help you. Since you already have
>> blocks
>> by voice, you could filter the full block to keep only EventChords (every
>> note, whether or not it's in a chord, is in an EventChord) and used the
>> filtered music for your NoteNames context.
>>
>> Note that I haven't tried this, and won't have time to try it today.
>>
>> You can see an example of how Valentin has done this here:
>>
>> http://repo.or.cz/w/opus_libre.git/blob/HEAD:/lib/libdynamic.scm#l58
>>
>> HTH,
>>
>> Carl
>>
>>
>>
>>
>
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user