lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom drum midi notes (Was: mute percussion notation)


From: Pierre-Luc Gauthier
Subject: Custom drum midi notes (Was: mute percussion notation)
Date: Thu, 24 Mar 2016 11:02:42 -0400

Pierre-Luc Gauthier <address@hidden> writes:
>> When one remaps note names like that, is it also possible to map midi
>> notes to those names?

David Kastrup <address@hidden> 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

Attachment: drumMidiNotesMapping.ly
Description: Text Data

Attachment: drumMidiNotesMappingMWE.ly
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]