[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extracting pitch of first note, then assign duration
From: |
Lukas-Fabian Moser |
Subject: |
Re: Extracting pitch of first note, then assign duration |
Date: |
Sun, 7 Mar 2021 20:54:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
Hi Matthew,
Am 07.03.21 um 20:03 schrieb Matthew Fong:
I am in the process of writing a note replacement function that allows
me to place a custos anywhere I might need.
I am stuck on writing a function that extracts the pitch of the first
note, given a list of notes, and then forcing a duration of 1/4. Any
pointers would be appreciated.
For example given the list of notes below, I would like a function to
output c4.
{
\clef treble
c2 d e f
g4 a b c
}
Something like this?
\version "2.22.0"
test = \relative c' {
\clef treble
c2 d e f
g4 a b c
}
firstnote =
#(define-music-function (mus dur) (ly:music? ly:duration?)
#{ $(first (music-pitches test)) $dur #})
\score {
\firstnote \test 8
}
Lukas