[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 4-Drum Conga Notation in LilyPond
From: |
Thomas Morley |
Subject: |
Re: 4-Drum Conga Notation in LilyPond |
Date: |
Fri, 21 Dec 2012 14:23:17 +0100 |
2012/12/18 Eric Pancer <address@hidden>:
[...]
> How do I make things like this work with your example:
>
> (muteconga () "stopped" 1)
>
> or
>
> opentumba . ,(ly:make-pitch 0 -1 NATURAL))
>
>
> Can I put that all in a new drum definition and have the corresponding
> MIDI files generated properly?
>
> Thank you, again.
>
> - Eric
Hi Eric,
please excuse if I start with some obvious thoughts and statements.
Currently /ly(drumpitch-init.ly contains three elements
(1)
drumPitchNames = #'( ... )
Listing the names
(2)
midiDrumPitches = #`( ... )
Listing the definitions for midi-pitches
(3)
(for-each (lambda (k-v) ... ))
A procedure turning the given alist into a hash-table.
It's quite easy to acces (1) and (2) to insert new elements.
But the given alist hidden in (3) is the problem.
The NR provides a method to insert a new style:
\set DrumStaff.drumStyleTable = #(alist->hash-table myDrumStyle)
With the disadvantage that the other default-settings are not longer available.
Some time ago I created a function to change this hidden list:
http://lilypond.1069038.n5.nabble.com/GLISS-facilitate-changes-of-the-default-drumStyleTable-td133573.html
With the disadvantage of possible bleed overs into other files.
Nevertheless, I used it in the code below.
If you're thinking about a patch, I'd change first the position of
that hidden list. I've never understood why it isn't stored in a
variable and simply called by the procedure.
If there is a reason behind it, the review will probably show it.
But now my code. I didn't test, though, whether a midi is correct.
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.16.1"
#(define mydrumPitchNamesList
`((quinto . quinto)
(openquinto . openquinto)
(mutequinto . mutequinto)
(conga . conga)
(openconga . openconga)
(muteconga . muteconga)
(tumba . tumba)
(opentumba . opentumba)
(mutetumba . mutetumba)
(lotumba . lotumba)
(openlotumba . openlotumba)
(mutelotumba . mutelotumba)
(hitumba . hitumba)
(openhitumba . openhitumba)
(mutehitumba . mutehitumba)
(qnto . openquinto)
(qntm . mutequinto)
(cgo . openconga)
(cgm . muteconga)
(tmbo . opentumba)
(tmbm . mutetumba)
(tmbho . openhitumba)
(tmbhm . mutehitumba)
(tmblo . openhitumba)
(tmblm . mutelotumba)))
#(define myMidiDrumPitches
`((quinto . ,(ly:make-pitch 0 3 NATURAL))
(openquinto . ,(ly:make-pitch 0 3 NATURAL))
(mutequinto . ,(ly:make-pitch 0 3 SHARP))
(conga . ,(ly:make-pitch 0 1 NATURAL))
(openconga . ,(ly:make-pitch 0 1 NATURAL))
(muteconga . ,(ly:make-pitch 0 1 SHARP))
(tumba . ,(ly:make-pitch 0 -1 NATURAL))
(opentumba . ,(ly:make-pitch 0 -1 NATURAL))
(mutetumba . ,(ly:make-pitch 0 -1 SHARP))
(hitumba . ,(ly:make-pitch 0 -1 NATURAL))
(openhitumba . ,(ly:make-pitch 0 -1 NATURAL))
(mutehitumba . ,(ly:make-pitch 0 -1 SHARP))
(lotumba . ,(ly:make-pitch 0 -3 NATURAL))
(openlotumba . ,(ly:make-pitch 0 -3 NATURAL))
(mutelotumba . ,(ly:make-pitch 0 -3 SHARP))))
#(define myDrumStyle
'((quinto () #f 3)
(openquinto () "open" 3)
(mutequinto () "stopped" 3)
(conga () #f 1)
(openconga () "open" 1)
(muteconga () "stopped" 1)
(tumba () #f -1)
(opentumba () "open" -1)
(mutetumba () "stopped" -1)
(hitumba () #f -1)
(openhitumba () "open" -1)
(mutehitumba () "stopped" -1)
(lotumba () #f -3)
(openlotumba () "open" -3)
(mutelotumba () "stopped" -3)))
#(map
(lambda (x)
(set! drumPitchNames (acons (car x) (cdr x) drumPitchNames)))
mydrumPitchNamesList)
#(map
(lambda (x)
(set! midiDrumPitches (acons (car x) (cdr x) midiDrumPitches)))
myMidiDrumPitches)
changeDrumStyleTable =
#(define-music-function (parser location custom-style)(list?)
(make-music
'ApplyContext
'procedure
(lambda (x)
(let* ((ctx (ly:context-property-where-defined x 'drumStyleTable))
(dr-st-tab (ly:context-property ctx 'drumStyleTable)))
(if (list? (car custom-style))
(for-each
(lambda (x) (hashq-set! dr-st-tab (car x) (cdr x)))
custom-style)
(hashq-set! dr-st-tab (car custom-style) (cdr custom-style)))))))
\new DrumStaff <<
%\set DrumStaff.drumStyleTable = #(alist->hash-table myDrumStyle)
\changeDrumStyleTable #myDrumStyle
\drummode {
quinto
openquinto
mutequinto
conga
openconga
muteconga
tumba
opentumba
mutetumba
hitumba
openhitumba
mutehitumba
lotumba
openlotumba
mutelotumba
handclap
}
>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTH,
Harm
- 4-Drum Conga Notation in LilyPond, Eric Pancer, 2012/12/12
- Re: 4-Drum Conga Notation in LilyPond, Eric Pancer, 2012/12/12
- Re: 4-Drum Conga Notation in LilyPond, Thomas Morley, 2012/12/12
- Re: 4-Drum Conga Notation in LilyPond, Eric Pancer, 2012/12/13
- Re: 4-Drum Conga Notation in LilyPond, Eric Pancer, 2012/12/16
- Re: 4-Drum Conga Notation in LilyPond, Thomas Morley, 2012/12/17
- Re: 4-Drum Conga Notation in LilyPond, Eric Pancer, 2012/12/17
- Re: 4-Drum Conga Notation in LilyPond, David Kastrup, 2012/12/18
- Re: 4-Drum Conga Notation in LilyPond, David Rogers, 2012/12/18
- Re: 4-Drum Conga Notation in LilyPond,
Thomas Morley <=
- Re: 4-Drum Conga Notation in LilyPond, David Kastrup, 2012/12/18