[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can't use NoteNames twice in score block ??
From: |
jakob lund |
Subject: |
Re: Can't use NoteNames twice in score block ?? |
Date: |
Thu, 23 Dec 2010 11:15:43 +0100 |
2010/12/23 Michael Ellis <address@hidden>:
> 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?
You have to permit more types of music, that act as containers, as
well as the actual 'NoteEvent objects:
------------
#(define (filterEvent event)
(let ((name (ly:music-property event 'name)))
(or
(eq? name 'EventChord)
(eq? name 'NoteEvent)
(eq? name 'RelativeOctaveMusic)
(eq? name 'SequentialMusic))))
onlynotes = #(define-music-function (P L M) (ly:music?)
(music-filter filterEvent M))
{ %\displayMusic
\onlynotes
\relative c'' { \key a \major cis d16 } }
---------
the \displayMusic command is only for debugging your function - if
your music disappears you uncomment it and comment out \onlynotes, so
you get a text representation of the unfiltered music. For example,
adding "\relative c''" caused the music to be wrapped in a
'RelativeOctaveMusic
Jakob.
>
>
> Cheers,
> Mike
>
>
> On Wed, Dec 22, 2010 at 2:14 PM, Michael Ellis <address@hidden>
> wrote:
>>
>> Thanks, Carl. This looks promising ...
>> Cheers,
>> Mike
>>
>>
>> On Wed, Dec 22, 2010 at 10:46 AM, Carl Sorensen <address@hidden>
>> wrote:
>>>
>>> On 12/22/10 8:08 AM, "Michael Ellis" <address@hidden> 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
- Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/21
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/21
- Re: Can't use NoteNames twice in score block ??, Carl Sorensen, 2010/12/21
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/22
- Re: Can't use NoteNames twice in score block ??, Carl Sorensen, 2010/12/22
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/22
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/22
- Re: Can't use NoteNames twice in score block ??,
jakob lund <=
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/23
- Re: Can't use NoteNames twice in score block ??, jakob lund, 2010/12/23
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/24
- Re: Can't use NoteNames twice in score block ??, Phil Hézaine, 2010/12/23
- Re: Can't use NoteNames twice in score block ??, Michael Ellis, 2010/12/23
- Re: Can't use NoteNames twice in score block ??, Phil Hézaine, 2010/12/23
- Re: Can't use \clef inside NoteNames and similar contexts, Reinhold Kainhofer, 2010/12/23