File: ChangeNoteEnharmonicUp.scm

package info (click to toggle)
denemo 2.6.49-0.2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 66,916 kB
  • sloc: ansic: 94,587; lisp: 38,713; xml: 22,675; python: 1,930; sh: 1,239; makefile: 642; yacc: 288; sed: 93
file content (18 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
;ChangeNoteEnharmonicUp
;; This script switches through enharmonic variants of the same in the direction of higher diatonic base notes
(if (Note?)
(if (not (Chord?))
	(d-ChangeEnharmonicUp)
	(let ((target (d-GetNoteAtCursor)))
	    (define old (ANS::GetChordNotes))
	    (define (proc ansNote thetarget)
		(if (eq? thetarget ansNote)
		    (cond 
		        ((= (ANS::GetHalfToneDistanceFromC ansNote) (ANS::GetHalfToneDistanceFromC (+ ansNote 40 ))) (+ ansNote 40 )) ; special rule for irregular notes
		        ((= (ANS::GetHalfToneDistanceFromC ansNote) (ANS::GetHalfToneDistanceFromC (+ ansNote 30 ))) (+ ansNote 30)) ; all other notes 
		        (else ansNote))
		    ansNote)) ; else just stay on the same note
	    ;body
	    (if target
		(set! target (ANS::Ly2Ans (string->symbol target))))
	    (ANS::ChangeChordNotes (map (lambda (x) (proc x target)) old)))))