[Top][All Lists]

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

Re: Predicting accidentals

From: Leo Correia de Verdier
Subject: Re: Predicting accidentals
Date: Thu, 16 May 2019 13:20:51 +0200

This looks like it’s working, but doesn’t give the expected results (the second 
c-sharp is shown as having an accidental while the following c is shown 

Can you find any misstakes in it (either writing misstakes or how its thought)?

\version "2.19.82"

printAcc = #(define-music-function (note) (ly:music?)
              (let* ((pitch (ly:music-property note 'pitch))
                     (autoacc 0)
                     (staff-context 0))
                  \context Staff \applyContext
                  #(lambda (context)
                      (set! autoacc (cadr (ly:context-property context 
                      (set! staff-context context)))
                  \context Timing  \applyContext
                  #(lambda (timing-context)
                     (let* ((barnum (ly:context-property timing-context 
                            (measurepos (ly:context-property timing-context 
                       (pretty-print (autoacc staff-context pitch barnum 

\fixed c' {
  \printAcc cis4
  \printAcc cis
  \printAcc c

> 7 maj 2019 kl. 12:13 skrev Leo Correia de Verdier <address@hidden>:
> Dear list!
> Is there a way to run the functions in autoAccidental before they would 
> normally be evaluated, to see beforehand if a note would get an accidental?
> What I would like iso do is a function that in some cases (depending on other 
> circumstances in code) forces an accidental with a tweak, but only on notes 
> that doesn’t already have one.
> Thanks a lot for your help! Your’e doing a great work!

reply via email to

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