lilypond-user
[Top][All Lists]
Advanced

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

Re: custom drumstyle-tables with custom noteheads?


From: Carl D. Sorensen
Subject: Re: custom drumstyle-tables with custom noteheads?
Date: Mon, 9 Feb 2009 11:26:19 -0700



On 2/9/09 10:07 AM, "Tao Cumplido" <address@hidden> wrote:

> -------- Original-Nachricht --------
>> Datum: Mon, 9 Feb 2009 07:40:38 -0700
>> Von: "Carl D. Sorensen" <address@hidden>
>> An: Tao Cumplido <address@hidden>, "address@hidden"
>> <address@hidden>
>> Betreff: Re: custom drumstyle-tables with custom noteheads?
> 
> 
>> Have you tried using 'parallelogram instead of parallelogram?  When
>> parallelogram is defined as a music function, every time scheme sees
>> parallelogram it tries to execute it.  On the other hand, when it sees
>> 'parallelogram is just puts the symbol (function name) rather than
>> evaluating it.
> 
> No. I haven't considered it because the other to-use symbols don't have the
> quote either.

I'm sorry, I gave bad advice earlier.  What I proposed won't work.

>> 'cross is a scheme symbol, not a list.  And (quote cross) is just another
>> way to describe that symbol; 'cross  is the same thing as (quote cross).
> 
> I knew that 'cross and (quote cross) is the same but not that it's a scheme
> symbol. I must have accidentaly skipped the chapter about symbols.
> 
>> I hope you found that the drum style table is in the file
>> ly/drum-pitch-init.ly.  The definitions is ly/drum-pitch-init.ly are a
>> little bit confusing, because they're all quoted lists.  That means
>> there's
>> a '( at the beginning of the list, so by default, nothing in the list is
>> evaluated and you don't need to put a ' before the symbol names.  That's
>> also why the (ly:make-pitch ) calls in midiDrumPitches have a , before
>> them;
>> the , means "evaluate the following thing, even though it's in a quoted
>> list."
> 
> That's interesting. I always wondered what those commas mean.
> Does #' actually mean the same as #` or is there also a significant
> difference?

#' is quote, and nothing inside the quoted expression is evaluated.

#` is quasi-quote; things inside the quasi-quoted expression that are
introduced with , are evaluated.

guile> '(+ 1 ,(* 2 3) 4)
(+ 1 (unquote (* 2 3)) 4)
guile> `(+ 1 ,(* 2 3) 4)
(+ 1 6 4)

# just introduces a scheme construct in lilypond.

> 
>> The other thing that is going to give you a little bit of grief is that
>> the
>> drum-style tables are hashes, not alists.  In the init file, they're set
>> up
>> as alists, then converted to hashes by the map function at the end of the
>> init file, which calls alist->hash-table (defined in scm/lily-library.scm.
>> 
>> If you want to change a single entry, you'll have to do it with a call to
>> hashq-set!.  You can see how it's used in scm/lily-library.scm.  k-v means
>> key-value pair.  So if you have a list you want to store like ('snare
>> 'parallelogram #5 0), you'd do something like:
>> 
>> (hashq-set! name-of-drum-table-goes-here 'snare '(parallelogram 5 0))
>> 
>> with name-of-drum-table-goes-here replaced with the scheme name of the
>> drum
>> table you're currently using, i.e. the name you used on the right hand
>> side
>> of drumStyleTable= ###.
>> 
>> You can read more about hashes at
>> http://www.gnu.org/software/guile/manual/html_node/Hash-Tables.htm
> 
> Well, I don't understand the significant difference between hash-tables and
> alists yet but I suppose it's not that essential to be able to change values
> inside it.
> But since I am creating new drumStyleTables anyway I don't need to change a
> value from some other place anyway, do I?

As long as you're going to create a whole new drumStyleTable you don't need
to worry about it, as long as you use alist->hash-table on the alist you
define.  You'd only need to do a hashq-set! if you wanted to modify an
existing table.

Again, I gave a bad answer earlier; sorry for the noise.

> 
> I still don't know yet what symbols like 'cross or 'diamond represent
> internally to be able to produce my own symbols which do the same.
> Logically they should in some way send the information about the stencil to
> use, shouldn't they? Or maybe I haven't totally understood how a scheme symbol
> is supposed to work.

Let me just address what is going in on with drum style.  'cross, 'diamond,
etc. are 'styles for the note-head-interface of the noteHead object that
will be created by the Drum_notes_engraver.  They are interpreted by the
ly:note-head::print routine.  The ly:note-head::print routine is a C++
routine found in lily/note-head.cc.

Basically, the routine looks for a given note head style, and uses that to
print the notes.  You can see the note head styles in appendix B.7 of the
Notation Reference.

Since the drumStyleTable uses note styles to set the note heads, if you want
to create your own drumStyleTable, I think you'll need to add a new notehead
style.  And I have no idea how to do that.

Again, I'm sorry for my misleading earlier reply.  I thought I knew what was
going on, but I was wrong.  I hope this new answer helps.

Thanks,
Carl

> p.s.:
> I finished my function to make plain text chord symbols transposeable.
> Thanks a lot for your earlier help.

You're welcome!

> I already tred to post it here but I didn't get through because the mail was
> too big, probably because of the font I tried to send along.
> I'll have to try again somewhat later.

Please try to send the function separately from the font.  I think that some
users will be very interested in it.





reply via email to

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