[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme coding] how to turn pitches into music
From: |
Kieren MacMillan |
Subject: |
Re: [Scheme coding] how to turn pitches into music |
Date: |
Sat, 25 Jan 2020 14:15:25 -0500 |
Hi again!
Tried taking your advice, and building the custom context from scratch. The
problem, of course, is that I don’t know all the engravers and what they do
(a.k.a. why they’re needed)… and the documentation doesn’t exactly make
everything crystal clear in that regard.
So far, I have:
%%%
\version "2.19.83"
\language "english"
\paper {
line-width = 4\in
ragged-right = ##f
}
rowrefs = #'(6 8 7 2 3 12 5 4 11 1 10 9)
test = { ef4. <fs' a'>8 g2 r4 <b d''>8 cs' }
testier = { bf4 a4 ~ 8 cs''8 4 d'1 }
RowReduce_engraver = #(lambda (...)
`((listeners
(note-event .
,(lambda (engraver event)
(let* ((elem (ly:event-property event 'music-cause))
(pitch (ly:music-property elem 'pitch))
(semitone (ly:pitch-semitones pitch))
(index (modulo semitone (length rowrefs))))
(ly:music-set-property! elem 'pitch
(ly:make-pitch 0 (list-ref rowrefs index) 0))))))))
\layout {
\context {
\type "Engraver_group"
\name RowReductionStaff
\inherit-acceptability RowReductionStaff Staff
\consists "Axis_group_engraver"
\consists "Staff_symbol_engraver"
\consists "Rhythmic_column_engraver"
\consists "Note_heads_engraver"
\consists "Note_head_line_engraver"
\consists "Note_spacing_engraver"
\consists \RowReduce_engraver
\override StaffSymbol.line-count = #6
\defaultchild "Voice"
}
}
\score {
<<
\new Staff { \test }
\new Staff { \testier }
\new RowReductionStaff << \test \\ \testier >>
>>
}
%%%
But clearly that doesn’t Do The Right Thing™. Any guidance would be appreciated.
Thanks,
Kieren.
________________________________
Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: address@hidden
- Re: [Scheme coding] how to turn pitches into music, (continued)
- Re: [Scheme coding] how to turn pitches into music, Aaron Hill, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Aaron Hill, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Kieren MacMillan, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Aaron Hill, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Aaron Hill, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Kieren MacMillan, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Aaron Hill, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Kieren MacMillan, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Aaron Hill, 2020/01/25
- Re: [Scheme coding] how to turn pitches into music, Kieren MacMillan, 2020/01/25
Re: [Scheme coding] how to turn pitches into music,
Kieren MacMillan <=