[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: String Results of Changing Pitches
From: |
Thomas Morley |
Subject: |
Re: String Results of Changing Pitches |
Date: |
Sun, 9 Aug 2015 15:37:59 +0200 |
2015-08-09 14:39 GMT+02:00 Nike Hedges <address@hidden>:
> Hi,
>
> How can I get an actual string result of changing pitches (\transpose
> \inversion \retrograde)?
> Not in PDF result but string itself.
> e.g.
> \retrograde \relative c' {c d e}
> -> \relative c' {e d c}
>
> I can't find such a thing in documents but I want to get it for the next
> operation.
>
> Thank you in advance,
> NIke
displayLilyMusic puts out absolute music.
Therefore best I can do for you:
\version "2.19.24"
#(define* ((my-write #:optional (port (current-output-port))
(option "a") ;; or "w"
(write-proc display))
arg)
;; my-write is meant as a general custom-definition of write/display etc
;; to make other custom-definitions possible quite easily
;;
;; optional arguments are
;; port - defaults to the terminal on most systems
;; can be set to a file-name-string
;; option - default "a" means the output is appended
;; "w" means the file content will be overriden
;; write-proc - defaults to display
;; other possible settings are write or
;; pretty-print (with the need use the relevant modules) etc
;;
;; (my-write) without any specification is pretty much the same as display with
;; an added (newline)
(let* ((port (if (eq? (current-output-port) port)
port
(open-file port option))))
(write-proc arg port)
(newline port)
(if (not (eq? (current-output-port) port))
(close port))))
#(define file-name (string-append (ly:parser-output-name) ".ly"))
specialWrite =
#(define-void-function (parser location arg)(scheme?)
((my-write file-name "a" display-lily-music) arg))
\specialWrite \retrograde \relative c' { c d e }
The output wil be added to the current .ly-file
Ofcourse you could specify a different file-name.
Not sure whether Frescobaldi has a feature which fits your needs better
Cheers,
Harm