Re: Scheme question regarding hiding accidentals

2009-12-04 Thread Reinhold Kainhofer
Am Samstag, 5. Dezember 2009 01:42:16 schrieb Robin Bannister:
> Aaron Dalton wrote:
> > I want to be able to hide the accidental.
> 
> There is Mark Polesky's suppress-accidental
> http://lists.gnu.org/archive/html/lilypond-devel/2009-07/msg00384.html
> but that is probably overkill in your case.
> 
> You can do it by switching the style in a music function
> http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Music-functions

Alternatively, you can take a look at the 'teaching accidental style, which 
explicitly displays the accidentals implied by the key signature as warning 
accidentals.
The cooll thing about this style is that if two equal pitches succeed each 
other, the second one never gets an accidental, but if there is at least one 
note in between, the second one does. E.g. if you have 

\relative c' {
  \key es \major
  #(set-accidental-style 'teaching)
  es es g e 
  es g es e |
}

Then the in the first measure the second es will not get an accidental (since 
it immediately follows another es), while in the second measure the second es 
will get an accidental (since it follows a different pitch)...

The definition of the teaching style is in scm/music-functions.scm...
Attached is a starting point where you "only" need to take the my-madrigal-
accidental-rule and adjust it to your own use case (yeah, I know, that sounds 
so easy... To be honest, I haven't digested the code to exactly understand how 
to adjust the rul.)...

Cheers,
Reinhold
-- 
--
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org
% Your own madrigal accidental rule...
#(define-public (my-madrigal-accidental-rule context pitch barnum measurepos)
  "Here comes the description. This style is an exact copy of
  teaching-accidental-rule and needs to be adjusted.
  Original description:
  an accidental rule that typesets a cautionary accidental
  if it is included in the key signature AND does not directly follow
  a note on the same staff-line."
  (let* ((keysig (ly:context-property context 'localKeySignature))
 (entry (find-pitch-entry keysig pitch #t #t)))
(if (equal? #f entry)
(cons #f #f)
(let* ((global-entry (find-pitch-entry keysig pitch #f #f))
   (key-acc (if (equal? global-entry #f)
0
(key-entry-alteration global-entry)))
   (acc (ly:pitch-alteration pitch))
   (entrymp (key-entry-measure-position entry))
   (entrybn (key-entry-bar-number entry)))
  (cons #f (not (or (equal? acc key-acc)
(and (equal? entrybn barnum) (equal? entrymp measurepos)

\relative c' {
  \key es \major
%   #(set-accidental-style 'teaching)
  % is the same as the following.
  #(ly:export (set-accidentals-properties #f
; automatic accidental rule:
`(Staff ,(make-accidental-rule 'same-octave 0))
; cautionary accidental rule: (might want to put this to auto-acc and set cautionaries to '() ??)
`(Staff ,(make-accidental-rule 'same-octave 1)
   ,my-madrigal-accidental-rule)
   'Staff))
  es es g e 
  es g es e |
}
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Scheme question regarding hiding accidentals

2009-12-04 Thread Robin Bannister
Aaron Dalton wrote: 
I want to be able to hide the accidental. 


There is Mark Polesky's suppress-accidental 
http://lists.gnu.org/archive/html/lilypond-devel/2009-07/msg00384.html
but that is probably overkill in your case. 

You can do it by switching the style in a music function 
http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Music-functions



Cheers,
Robin
ditto =
#(define-music-function (parser location mus) (ly:music?)
  #{
#(set-accidental-style 'no-reset)
$mus 
#(set-accidental-style 'forget)
  #})

{
  #(set-accidental-style 'forget)
  cis' 
  \ditto cis' 
  cis'
  cis'
}
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Scheme question regarding hiding accidentals

2009-12-04 Thread Aaron Dalton
I'm typesetting a book of Italian madrigals and have used the 
accidental-style 'forget' for the project as it deals correctly with 99% 
of my accidentals.  The issue is when I have a chromatically inflected 
note repeated.  It quite naturally wants to reprint the accidental for 
each note.  For this case only, I want to be able to hide the accidental. 
Ideally I would just attach a character to my note entry (like bes! and 
bes?, only [perhaps] bes-).  I don't know much Scheme, but I am willing to 
learn.  Can somebody point me to documentation on how to interface with 
the Lilypond code, and perhaps what function(s) I should be looking at to 
emulate behaviour like bes! and bes?.  If there exists a quick and dirty 
"hack" to suppress the accidental (the mailing list archives suggest there 
is not), then I would like that too, so I can at least move forward with 
this part of my project.


Thank you for your time and help!
Aaron



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user