[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Passing pitch to function
From: |
Valentin Petzel |
Subject: |
Re: Passing pitch to function |
Date: |
Thu, 15 Jun 2023 18:32:24 +0200 |
Hello Pierre-Luc,
It works for me if I copy and paste your code. Can you maybe attach a ly file
that does not work for you?
Cheers,
Valentin
Am Donnerstag, 15. Juni 2023, 18:25:37 CEST schrieb Pierre-Luc Gauthier:
> What am-I doing wrong here… ☹
>
> \version "2.25.6"
>
> \language "english"
>
> #(define instrumentsInfo
> '(
> (piccolo . ((fullName "Piccolo") (transposition #{bf'#})))
> ))
>
> instrumentInfoLookup =
> #(define-scheme-function
> (instrument info)
> (symbol? symbol?)
> (car (cdr (assq info (cdr (assq instrument instrumentsInfo))))))
>
> #(display (instrumentInfoLookup 'piccolo 'fullName))
> #(display (instrumentInfoLookup 'piccolo 'transposition))
>
> part =
> #(define-music-function
> (music fullName transposition)
> (ly:music? markup? ly:pitch?)
> #{
> \new Staff \with {
> shortInstrumentName = fullName
> } <<
> \transpose $transposition c'
> $music
>
> >>#} )
>
> %\part c' "test" bf
> \part c'' #(instrumentInfoLookup 'piccolo 'fullName)
> c''%#(instrumentInfoLookup 'piccolo 'transposition)
>
> The ly:pitch? predicate fails. Is there a way for that pitch to be
> sent as a correct ly:pitch? ¿
>
> Thanks for any pointers.
signature.asc
Description: This is a digitally signed message part.
Re: Passing pitch to function, Jean Abou Samra, 2023/06/15