[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with music-function generating music
From: |
Paul Morris |
Subject: |
Re: Help with music-function generating music |
Date: |
Wed, 26 Mar 2014 09:18:40 -0700 (PDT) |
Ok, here are some next steps. Only dealing with specifying pitch so far.
The number of notes and their duration are both still hard-coded...
-Paul
\version "2.18.0"
% use this to see what the end result should look like:
% \displayMusic { c'4 d e f }
% ===>
% Here it is:
{
#(make-music
'SequentialMusic
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1)
'pitch
(ly:make-pitch 0 0 0))
(make-music
'NoteEvent
'pitch
(ly:make-pitch -1 1 0)
'duration
(ly:make-duration 2 0 1))
(make-music
'NoteEvent
'pitch
(ly:make-pitch -1 2 0)
'duration
(ly:make-duration 2 0 1))
(make-music
'NoteEvent
'pitch
(ly:make-pitch -1 3 0)
'duration
(ly:make-duration 2 0 1))))
}
% a function that accepts three arguments that are used to determine pitch:
% octave note and alteration:
makeFourQuarterNotes =
#(define-music-function (parser location oct nt alt)
(number? number? number?)
(make-music
'SequentialMusic
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1)
'pitch
(ly:make-pitch oct nt alt))
(make-music
'NoteEvent
'pitch
(ly:make-pitch oct nt alt)
'duration
(ly:make-duration 2 0 1))
(make-music
'NoteEvent
'pitch
(ly:make-pitch oct nt alt)
'duration
(ly:make-duration 2 0 1))
(make-music
'NoteEvent
'pitch
(ly:make-pitch oct nt alt)
'duration
(ly:make-duration 2 0 1)))))
{
\makeFourQuarterNotes #1 #1 #0
\makeFourQuarterNotes #1 #2 #0
\makeFourQuarterNotes #0 #1 #-1/2
\makeFourQuarterNotes #0 #2 #1/2
}
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Help-with-music-function-generating-music-tp160833p160861.html
Sent from the User mailing list archive at Nabble.com.