Pierre-Luc Gauthier <[email protected]> writes:
>> When one remaps note names like that, is it also possible to map midi
>> notes to those names?
David Kastrup <[email protected]> writes:
> It would appear that midiDrumPitches are used for initializing
> drumPitchTable in some context in ly/performer-init.ly so it should be
> possible to add stuff to midiDrumPitches in a similar manner and then
> create a new drumPitchTable context property from it for some suitable
context.
> You need to dig through the respective files to find all the information
> I guess.
Well, I did :-) and it was worthwhile.
I looked into ly/performer-init.ly and found drumMidiPitches.
git grep told me it was defined in ly/drumpitch-init.ly
(it took me a while to realize that the alist started with a ` and not ' )
So I made my own midiDrumPitches alist but I was wondering :
How can one *append* pitches to the midiDrumPitches alist _without_
replacing it?
I am no programmer but I'm quite proud to have got this far.
That was a great exercise.
Here is my MWE :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
#(define typewriter '((key default #f 0)
(cr default #f -2)
(bell default #f 2)))
drumPitchNames.key = #'key
drumPitchNames.cr = #'cr
drumPitchNames.bell = #'bell
% How can I append those bellow to the default list?
% (Instead of replacing the old list)
midiDrumPitches = #`(
(key . ,(ly:make-pitch 0 6 FLAT))
(cr . ,(ly:make-pitch 1 1 NATURAL))
(bell . ,(ly:make-pitch 1 5 NATURAL))
)
\score {
\new DrumStaff
\new DrumVoice \with {
\consists "Balloon_engraver"
} \drummode {
\override Staff.StaffSymbol.line-positions = #'(0)
\override Staff.BarLine.bar-extent = #'(-2 . 2)
\override BalloonTextItem.annotation-balloon = ##f
\set DrumStaff.drumPitchTable = #(alist->hash-table midiDrumPitches)
\set DrumStaff.drumStyleTable = #(alist->hash-table typewriter)
\balloonGrobText #'NoteHead #'(-2 . -2) \markup {"Maracas"}
key4
\balloonGrobText #'NoteHead #'(-2 . 2) \markup {"Open triangle"}
bell4
\balloonGrobText #'NoteHead #'(3 . -3) \markup {"Long guiro"}
cr4
% Bellow is the "test" for a normal midi output
\balloonGrobText #'NoteHead #'(2 . 3) \markup {"Snare"}
sn4 % Is currently not heard
}
\layout {}
\midi {}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I also include a somewhat pedantic and no so minimal example just for
the heck of it.
I went a bit overboard with the balloons; But contextually, they're
soooo practical.
The official Typewriter chart I made is just gorgeous. (And the
complete conductor score also is)
Thanks so much for your help!
--
Pierre-Luc Gauthier
\version "2.18.2"
#(define typewriter '((key default #f 0)
(cr default #f -2)
(bell default #f 2)))
drumPitchNames.key = #'key
drumPitchNames.cr = #'cr
drumPitchNames.bell = #'bell
% How can I append those bellow to the default list?
% (Instead of replacing the old list)
midiDrumPitches = #`(
(key . ,(ly:make-pitch 0 6 FLAT))
(cr . ,(ly:make-pitch 1 1 NATURAL))
(bell . ,(ly:make-pitch -2 0 DOUBLE-FLAT))
)
\header {
title = \markup {\smallCaps "The Data Typewriter"}
composer = \markup {\smallCaps "LaJoy Randallson"}
instrument = \markup {
\score {
\new DrumStaff \with {
\remove "Time_signature_engraver"
%\remove "Clef_engraver"
fontSize = -3
\override StaffSymbol.staff-space = #(magstep -2)
}
\new DrumVoice \with {
\consists "Balloon_engraver"
\override BalloonTextItem.annotation-balloon = ##f
}
\drummode {
\override Staff.StaffSymbol.line-positions = #'(0)
\override Staff.BarLine.bar-extent = #'(-2 . 2)
\set DrumStaff.drumStyleTable = #(alist->hash-table typewriter)
\balloonLengthOff
\balloonGrobText #'NoteHead #'(-1 . -1) \markup {\italic \bold "Key click" }
key8
\balloonGrobText #'NoteHead #'(-1 . .25) \markup {\italic \bold "Bell" }
bell4\laissezVibrer
\balloonGrobText #'NoteHead #'(1.5 . 1) \markup { \italic \bold"Carriage return" }
cr4->
\stopStaff
s
}
\layout {indent = 0}
}
}
}
percussionI = \drummode {
\override Staff.StaffSymbol.line-positions = #'(0)
\override Staff.BarLine.bar-extent = #'(-2 . 2)
\set DrumStaff.drumPitchTable = #(alist->hash-table midiDrumPitches)
\set DrumStaff.drumStyleTable = #(alist->hash-table typewriter)
\override BalloonTextItem.annotation-balloon = ##f
\tempo 2=130
\time 2/2
\balloonGrobText #'NoteHead #'(2 . 2) \markup {
\smaller \italic \bold "Typewriter key click" }
key8\f key key key key key key key |
key key key key key4 key8 key |
key key key key key key key key |
\balloonGrobText #'NoteHead #'(-2 . 2) \markup {
\smaller \italic \bold "Bell" }
bell4\laissezVibrer r
\balloonGrobText #'NoteHead #'(3 . -3) \markup {
\smaller \italic \bold \column {
"Carriage return"
\smaller "(UNIX: line feed)"}}
cr->
% Bellow is the "test" for normal midi output
\balloonGrobText #'NoteHead #'(-2 . 3) \markup {
\smaller \italic \bold "Typical snare" }
sn |
}
percussionIPart =
\new DrumStaff
\new DrumVoice \with {
\consists "Balloon_engraver"
} \percussionI
\score {
\percussionIPart
\layout {}
\midi {}
}\version "2.18.2"
#(define typewriter '((key default #f 0)
(cr default #f -2)
(bell default #f 2)))
drumPitchNames.key = #'key
drumPitchNames.cr = #'cr
drumPitchNames.bell = #'bell
% How can I append those bellow to the default list?
% (Instead of replacing the old list)
midiDrumPitches = #`(
(key . ,(ly:make-pitch 0 6 FLAT))
(cr . ,(ly:make-pitch 1 1 NATURAL))
(bell . ,(ly:make-pitch 1 5 NATURAL))
)
\score {
\new DrumStaff
\new DrumVoice \with {
\consists "Balloon_engraver"
} \drummode {
\override Staff.StaffSymbol.line-positions = #'(0)
\override Staff.BarLine.bar-extent = #'(-2 . 2)
\override BalloonTextItem.annotation-balloon = ##f
\set DrumStaff.drumPitchTable = #(alist->hash-table midiDrumPitches)
\set DrumStaff.drumStyleTable = #(alist->hash-table typewriter)
\balloonGrobText #'NoteHead #'(-2 . -2) \markup {"Maracas"}
key4
\balloonGrobText #'NoteHead #'(-2 . 2) \markup {"Open triangle"}
bell4
\balloonGrobText #'NoteHead #'(3 . -3) \markup {"Long guiro"}
cr4
% Bellow is the "test" for a normal midi output
\balloonGrobText #'NoteHead #'(2 . 3) \markup {"Snare"}
sn4 % Is currently not heard
}
\layout {}
\midi {}
}_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user