lilypond-user
[Top][All Lists]
Advanced

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

Re: How can I create from my custom drum note to a pitch? (for fransposi


From: Thomas Morley
Subject: Re: How can I create from my custom drum note to a pitch? (for fransposing)
Date: Fri, 1 Apr 2016 00:31:17 +0200

2016-03-31 22:41 GMT+02:00 Bernard <address@hidden>:
> On 31-03-16 20:33, Thomas Morley wrote:
>>
>> 2016-03-31 16:34 GMT+02:00 Bernard <address@hidden>:
>>>
>>> How can I create from my custom drum note to a pitch?
>>>
>>> Or, strongly related, how can I transpose from a custom drum note to a
>>> standard piano note (pitch)?
>>
>>
>> I've no idea what you're talking about.
>
> Hi Thomas,
>
> Thanks for your answer. I can understand. These are work arrounds on work
> arrounds so the idea can be lost.
>
> The new thread
> http://lilypond.1069038.n5.nabble.com/naturalize-pitches-td188666.html does
> give me additional info.
> Maybe changing automatic the source code is a better idea.
>
> Simply I want as simple as possible notation in Lilypond for the instrument
> Djembe. Which is standard not supported in Lilypond.
> With help with this newsgroup I could do so and it displays (layout {}
> function) fine.
>
> All custom notes are :
> one = \drummode { dba4 do ds dbm dom dsm }
>
> But when generating midi I can not hear them. I bought a Djembe soundfount
> from https://robntweber.wordpress.com/2007/04/01/finally-moving-on/  with
> Piano layout.
>
> So I had to match these layout. To generated a correct midi Djembe sound I
> need :
>
> onemidi = { g4 a b  fis gis ais   }
>>
>> Drum notes don't have pitches. Ergo, they can't be transposed. The
>> pitches in midiDrumPitches are somehow creating a midi, but I've no
>> clue about how it is done either.
>
> Transpose is not possible I understand from you.
> So I have to change following table :
>
> Custom drum note -> Piano note
> dba -> g
> do -> a
> ds -> b
> etc.
>
>
>>
>> You can access those pitches as mapped in midiDrumPitches and put them
>> into a normal Staff.
>> The result is crazy to say the least:
>>
>> drms = \drummode { hh bd }
>>
>> \new DrumStaff \drms
>>
>> \new Staff {
>>    \clef bass
>>    $(music-clone
>>      drms
>>      'elements
>>      (begin
>>        (for-each
>>          (lambda (n)
>>            (ly:music-set-property! n 'pitch
>>              (assoc-get (ly:music-property n 'drum-type) midiDrumPitches
>> '()))
>>            (ly:music-set-property! n 'drum-type '()))
>>        (extract-named-music drms 'NoteEvent))
>>        (extract-named-music drms 'NoteEvent)))
>> }
>
> That could do it, but I could not see how I could enter my table into that
> function.
> Could you give an example of two note's?
>>
>>
>> What do you really want?
>
> Different results for layout and midi.
>
> Remark : this code can not be executed, because it requires the Djembe
> libary.
> I am more then willing to share this with you (all) if desired, but I think
> this makes it more confusing at the moment.
>
> one = \drummode { dba do ds r dbm dom dsm }
>
> % layout
> \score {
>  \new DrumStaff  <<
>       \override DrumStaff.StaffSymbol.line-count =  #3
>       \set DrumStaff.drumStyleTable = #(alist->hash-table djembe)
>       \new DrumVoice = voice { #one }
>          \set Staff.instrumentName = #"Djembe"
>        >>
>   \layout {}
> }
>
>
> %midi
> \score {
>   <<
> \new Staff {
>   % Statement should be enabled
>   %  \new Voice = voice { djembe_to_midi_conversion {#one} }
>   % Statement is now required but should be disable
>   \new Voice = voice { g4 a b r  fis gis ais r  }
> }
>   >>
>   \midi{}
> }
>
> How to implement the "djembe_to_midi_conversion" function?
>
> This what I had in mind. But maybe changing the source code is a much better
> idea.
>
> WIth regards,
>
> Bernard
>
>>
>>
>> -Harm
>>
>

Well, let's see whether I understood correctly.

A)
You want to create your own drum-style, with custom-drum-note-names
and a certain appearence when printed.

For the names you did:
          drumPitchNames.dbass      = #'dbass
          etc
Ok, this is fine

For the appearence you did
          #(define djembe '(
                  (dbass            default   #f           -2)
          ;; etc
          )
Ok, fine as well

Later on you LilyPond to use the above with
          drumStyleTable = #(alist->hash-table djembe)
Also fine, here we're done.

B)
Then you want the new stuff to be used in midi.
In general, follow the same route.

Assign pitches to the names:
         midiDrumPitches.dba = ##{ g #}
         etc

Tell Lilypond to use them:
         drumPitchTable = #(alist->hash-table midiDrumPitches


In general you're done now. Below a full example.
Because I don't know all your settings I used random ones. For the
drum-pitches I tried to follow yours, but I'm not always sure about
the octave you may need to change it.

\version "2.19.36"

drumPitchNames.dbass = #'dbass
drumPitchNames.dba = #'dbass
drumPitchNames.do  = #'do
drumPitchNames.ds  = #'ds
drumPitchNames.dbm  = #'dbm
drumPitchNames.dom  = #'dom
drumPitchNames.dsm = #'dsm

#(define djembe
  '(
    (dsm   default  #f  -6)
    (dom   default  #f  -5)
    (dbm   default  #f  -4)
    (ds    default  #f  -3)
    (do    default  #f  -2)
    (dba   default  #f  -1)
    (dbass default  #f  -1)
   ))

midiDrumPitches.dba = g
midiDrumPitches.do =  a
midiDrumPitches.ds =  b
midiDrumPitches.dbm = fis
midiDrumPitches.dom = gis
midiDrumPitches.dsm = ais

one = \drummode { r4 dba4 do ds dbm dom dsm }

\score {
  \new DrumStaff
    \with {
      drumStyleTable = #(alist->hash-table djembe)
      drumPitchTable = #(alist->hash-table midiDrumPitches)
    }
    \one
  \layout {}
  \midi {}
}


HTH,
  Harm

P.S.
The most difficult part for me was how to tell LilyPond to use the new pitches.
There's a hint in performer-init.ly, but:

git grep "midiDrumPitches"
ly/drumpitch-init.ly:midiDrumPitches =
ly/performer-init.ly:  drumPitchTable = #(alist->hash-table midiDrumPitches)

is not what I'd called "well documented"

Maybe worth a bug report.



reply via email to

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