[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: |
Sun, 26 Jan 2020 09:17:04 -0500 |
Hi Aaron,
> If you permit me to be honest: I would not have the foggiest idea either. (:
LOL
> The Internals Reference does list which engravers produce which grobs, and
> there is always the source code itself. The problem though is knowing what
> you are looking for. This is especially tricky when you have normally
> invisible grobs, since their very existence is a mystery before pulling back
> the curtain.
Exactly.
> we might need both a custom RowReducedStaff and RowReducedVoice to reach the
> goal.
Even if that’s not technically required, I think it’s a great idea so I did it.
Here’s what I have so far, with some "real world" music data:
%%%
\version "2.19.83"
\language "english"
\paper {
line-width = 6\in
ragged-right = ##f
system-system-spacing.padding = #6
}
%%%%% ↓↓↓↓↓ \INCLUDE ↓↓↓↓↓ %%%%%
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 RowReductionVoice
\consists "Note_heads_engraver"
\consists "Note_spacing_engraver"
\consists "Rhythmic_column_engraver"
\consists \RowReduce_engraver
\override NoteHead.duration-log = #4
}
\context {
\type "Engraver_group"
\name RowReductionStaff
\alias Staff
\inherit-acceptability RowReductionStaff Staff
\defaultchild "RowReductionVoice"
\consists "Axis_group_engraver"
\consists "Staff_symbol_engraver"
\consists "Bar_engraver" %% possibly omit?
\override StaffSymbol.line-count = #6
}
}
%%%%% ↑↑↑↑↑ \INCLUDE ↑↑↑↑↑ %%%%%
rowrefs = #'(6 8 7 2 3 12 5 4 11 1 10 9)
arco = -\tweak self-alignment-X #RIGHT ^\markup "arco."
pizz = -\tweak self-alignment-X #RIGHT ^\markup "pizz."
global = {
\time 2/4
\tweak font-size #2 \tweak padding #2 \tempo "Gemächlich"
s2*2
\bar ".|:"
s2*2 \break
s2*5 \break
s2*5
}
vlnI = {
\clef treble
r4 cs'\pp\pizz
d''4 b''
c''4 af''
g'4 r
bf''4\sfp a'
f''4 fs'
ds''4\> e'''\!
r4 c''(\pp^\arco
b''4-.) d''\pizz
cs'4 r
a'4(\f\arco bf''-.)
g'4( gs''-.)
e'''4(\> ds''-.)\!
fs'4\p\> f''\!
}
vlnII = {
\clef treble
R2 r4 af'4\pp\pizz
g4 bf'
r4 cs''
d'4\sf r
b'4\p c'
r4 ds''\>
fs'4\pp f''
r4 a\pp
bf'4\> g'\!
af4\sf r
c''4\f\arco( b-.)
r4 cs'\>\pizz
f''4\arco\p(\> fs'->)\!
}
\score {
<<
\new StaffGroup <<
\new Staff << \global \vlnI >>
\new Staff << \global \vlnII >>
>>
\new RowReductionStaff << \vlnI \\ \vlnII >>
>>
}
%%%
My next question is: How do I "partcombine" properly? For example, I’d like the
noteheads in the reduction staff to appear arranged in "chords" (e.g., with
proper shifting), even though the original notes might be of very different
durations. I feel like even knowing the basic area of the function set to look
in for this task would reveal a whole new world of how to manipulate Lilypond
music.
Thanks,
Kieren.
p.s. My first "real-world" problem with all of this Scheme-ing will be to
assist in taking the partcombine mechanism to the intended/expected goal line.
So it’s great that I’m already running into the kinds of issues I will be when
working on that. =)
________________________________
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, 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, 2020/01/25