[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making two functions into one
From: |
Valentin Petzel |
Subject: |
Re: Making two functions into one |
Date: |
Mon, 16 Jan 2023 15:32:49 +0100 |
Hello,
not sure about that one, but this seems to work:
\version "2.24.0"
nd = #(define-music-function (number) (integer?)
#{
#(time (cons number 8))
s8 * $number
#})
\score {
\new Staff {
\nd 8
\nd 7
}
}
Cheers,
Valentin
Am Montag, 16. Jänner 2023, 15:12:15 CET schrieb | || | |:
> Hi,
>
> I would like to make a function which will be responsible for two things:
>
> 1. Change time signature
>
> 2. Fill empty bar with 's8'
>
> I made this one, but there is a problem with point'n'click function, so
> I can't click on time signature to go to correspondent place in code:
>
> \version "2.24.0"
>
> nd = #(define-music-function (number) (integer?)
> (make-music
> 'SequentialMusic
> 'elements
> (list (make-music
> 'SequentialMusic
> 'elements
> (list (make-music
> 'TimeSignatureMusic
> 'numerator
> number
> 'denominator
> 8
> 'beat-structure
> '())))
> (make-music
> 'UnfoldedRepeatedMusic
> 'elements
> '()
> 'repeat-count
> number
> 'element
> (make-music
> 'SequentialMusic
> 'elements
> (list (make-music
> 'SkipEvent
> 'duration
> (ly:make-duration 3)))))))
> )
>
> \score {
> \new Staff {
>
> \nd 8
> \nd 7
> }
> }
>
>
> So I thought about delete one nested (list) and try it:
>
> nd = #(define-music-function (number) (integer?)
> (make-music
> 'TimeSignatureMusic
> 'numerator
> 8
> 'denominator
> 8
> 'beat-structure
> '())
> (make-music
> 'UnfoldedRepeatedMusic
> 'elements
> '()
> 'repeat-count
> 8
> 'element
> (make-music
> 'SequentialMusic
> 'elements
> (list (make-music
> 'SkipEvent
> 'duration
> (ly:make-duration 3))))))
>
>
> But the problem is, when I don't use (list) for two adjacent
> (make-music) functions, one of them doesn't run, so depending on the
> kind of second (make-music) code, one od them goes, another don't.
>
> Honestly, I don't understand why it's like that, because when I run
> displayScheme{}, it display it properly without (list) and
> SquentialMusic for this two events. I suspect it could be something
> wrong with my definition.
>
>
> Thank you :)
signature.asc
Description: This is a digitally signed message part.
Re: Making two functions into one, David Kastrup, 2023/01/16
Re: Making two functions into one, Jean Abou Samra, 2023/01/16