Creating Chorded Notes

2008-07-12 Thread Eric Knapp
Hi, all.

I'm trying to write a music function that creates chorded notes. I'm
starting simply and I'm stumped. How would I create this simple music
expression in a function?

  a c2

Is there a grob for these? What I'm working on is being able to
customize the individual NoteHead and Stem grobs for each note.

Thanks,

-Eric


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Creating Chorded Notes

2008-07-12 Thread Jonathan Kulp
Maybe you could adjust something in this macro to do it for you.  This 
one makes octaves (it's awesome!!).


Jon


\version 2.11.47

%LSR This function was contributed by Jay Anderson.

#(define (octave-up m t)
 (let* ((octave (1- t))
  (new-note (ly:music-deep-copy m))
  (new-pitch (ly:make-pitch
octave
(ly:pitch-notename (ly:music-property m 'pitch))
(ly:pitch-alteration (ly:music-property m 'pitch)
  (set! (ly:music-property new-note 'pitch) new-pitch)
  new-note))

#(define (octavize-chord elements t)
 (cond ((null? elements) elements)
 ((eq? (ly:music-property (car elements) 'name) 'NoteEvent)
   (cons (car elements)
 (cons (octave-up (car elements) t)
   (octavize-chord (cdr elements) t
 (else (cons (car elements) (octavize-chord (cdr elements ) t)

#(define (octavize music t)
 (if (eq? (ly:music-property music 'name) 'EventChord)
   (ly:music-set-property! music 'elements (octavize-chord
(ly:music-property music 'elements) t)))
 music)

octaves = #(define-music-function (parser location arg mus) (integer? 
ly:music?)

 (music-map (lambda (x) (octavize x arg)) mus))


\relative c' { d e \octaves #-1 { \times 2/3 {f g c }}} % this is an 
example of the macro in practice



Eric Knapp wrote:

Hi, all.

I'm trying to write a music function that creates chorded notes. I'm
starting simply and I'm stumped. How would I create this simple music
expression in a function?

  a c2

Is there a grob for these? What I'm working on is being able to
customize the individual NoteHead and Stem grobs for each note.

Thanks,

-Eric


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user



--
Jonathan Kulp
http://www.jonathankulp.com


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Creating Chorded Notes

2008-07-12 Thread Trevor Daniels


Eric

The key to discovering how to do this is \displayMusic.  Compile

\displayMusic { a c 2 }

in LilyPond and the Scheme equivalent is shown in the console log.

In this case it is:

(make-music
 'SequentialMusic
 'elements
 (list (make-music
 'EventChord
 'elements
 (list (make-music
 'NoteEvent
 'duration
 (ly:make-duration 1 0 1 1)
 'pitch
 (ly:make-pitch -1 5 0))
   (make-music
 'NoteEvent
 'duration
 (ly:make-duration 1 0 1 1)
 'pitch
 (ly:make-pitch -1 0 0))

Trevor


- Original Message - 
From: Eric Knapp [EMAIL PROTECTED]

To: List lilypond-user lilypond-user@gnu.org
Sent: Saturday, July 12, 2008 3:36 PM
Subject: Creating Chorded Notes



Hi, all.

I'm trying to write a music function that creates chorded notes. I'm
starting simply and I'm stumped. How would I create this simple music
expression in a function?

 a c2

Is there a grob for these? What I'm working on is being able to
customize the individual NoteHead and Stem grobs for each note.

Thanks,

-Eric


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Creating Chorded Notes

2008-07-12 Thread Eric Knapp
Sounds like you are also saying that the way I'm going to get this to
work is to learn a little scheme. I'm OK with that, I like learning
new languages. I like to learn a new one every year or so. It's just
that I'm already learning a couple this year. Getting this all to work
is a big priority for me so here I go. I'm starting with the Scheme
Tutorial in the LM. Then I'll read the Interfaces for programmers
chapter in the NR. If that doesn't get me all the way there I'll keep
asking questions.

Thanks for getting going in the right direction. Having a path to
follow makes the journey fun.

-Eric

On Sat, Jul 12, 2008 at 10:59 AM, Trevor Daniels [EMAIL PROTECTED] wrote:

 Eric

 The key to discovering how to do this is \displayMusic.  Compile

 \displayMusic { a c 2 }

 in LilyPond and the Scheme equivalent is shown in the console log.

 In this case it is:

 (make-music
  'SequentialMusic
  'elements
  (list (make-music
 'EventChord
 'elements
 (list (make-music
 'NoteEvent
 'duration
 (ly:make-duration 1 0 1 1)
 'pitch
 (ly:make-pitch -1 5 0))
   (make-music
 'NoteEvent
 'duration
 (ly:make-duration 1 0 1 1)
 'pitch
 (ly:make-pitch -1 0 0))

 Trevor


 - Original Message - From: Eric Knapp [EMAIL PROTECTED]
 To: List lilypond-user lilypond-user@gnu.org
 Sent: Saturday, July 12, 2008 3:36 PM
 Subject: Creating Chorded Notes


 Hi, all.

 I'm trying to write a music function that creates chorded notes. I'm
 starting simply and I'm stumped. How would I create this simple music
 expression in a function?

  a c2

 Is there a grob for these? What I'm working on is being able to
 customize the individual NoteHead and Stem grobs for each note.

 Thanks,

 -Eric


 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 http://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user