[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A twelve tone matrix engraver
From: |
David Kastrup |
Subject: |
Re: A twelve tone matrix engraver |
Date: |
Sun, 03 Jan 2016 14:31:07 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Caio Giovaneti de Barros <address@hidden> writes:
> On 02-01-2016 16:18, David Kastrup wrote:
>> It might also be worth taking a look at the facilities provided by
>> issue 4702
>> <URL:http://sourceforge.net/p/testlilyissues/issues/4702/> to see
>> how (or whether) they would have helped here.
> Do you think you could write some small example of what those
> functions do? I didn't understand how they are used. One thing that I
> really wanted is an automatic way for the software to decide what
> notes should be flat and what should be sharp, even if it's not
> perfect. Currently my code only outputs sharps and to be honest this
> is not very natural to read (pun intended).
\version "2.19.35"
#(define semi->pitch
(make-semitone->pitch (music-pitches #{ c cis d es e f fis g gis a bes b
#})))
{ #@(map (lambda (s) #{ $(semi->pitch s) 2 #})
(iota 37 (ly:pitch-semitones #{ g #}))) }
% That's usually close to C Major/A Minor, let's try something more
% befitting Fis Major/Dis Minor
#(define femi->pitch (shift-semitone->pitch #{ fis #} semi->pitch))
{ #@(map (lambda (s) #{ $(femi->pitch s) 2 #})
(iota 37 (ly:pitch-semitones #{ g #}))) }
Note that make-semitone->pitch is a comparatively expensive call so it
makes sense to store the result, here semi->pitch and reuse it.
shift-semitone->pitch is quite cheap in contrast, so storing femi->pitch
is done more to make things more readable rather than out of efficiency
reasons.
--
David Kastrup
Re: A twelve tone matrix engraver, Caio Giovaneti de Barros, 2016/01/03
Re: A twelve tone matrix engraver, Kieren MacMillan, 2016/01/02