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: Tao Cumplido
Subject: Re: custom drumstyle-tables with custom noteheads?
Date: Mon, 09 Feb 2009 18:07:46 +0100

-------- 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 just tried it though and the result is that I don't get compilation errors 
anymore and instead of no stencil at all the standard NoteHead stencil is 
printed but not the parallelogram.

> '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?

> 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?

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.

Thanks for the help so far.

Regards,

Tao

p.s.:
I finished my function to make plain text chord symbols transposeable.
Thanks a lot for your earlier help.
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.

> HTH,
> 
> Carl
> 




reply via email to

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