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 07:40:38 -0700

Tao,

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

> Hi All,
> 
> some time ago Neil Puttock helped me out to create a function that returns
> different notehead-stencils depending on the duration-log.
> http://www.mail-archive.com/address@hidden/msg42720.html
> 
> Now I was wondering if this procedure could be somehow integrated in a custom
> drumstyle-table but just using the functions-name in the style-field won't
> work, e.g. (snare parallelogram #5 0).

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.

> Then I tried to figure out more about the standard settings which can be used
> here, i.e. cross, diamond, xcircle, slash, etc. but everything I found out by
> means of \displayMusic and (display)-scheme internally resulted that all those
> definitions are lists if am not mistaken ( 'cross or (quote cross) is list,
> isn't it?).

'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 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."

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

HTH,

Carl






reply via email to

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