Re: Enhancement: command line option to transpose N halftones up or down

2015-03-16 Thread David Nalesnik
Hi Michael,



 Am 16.03.2015 um 15:02 schrieb Michael Schuerig:

  I've only been using LilyPond for a rather short time, so far mostly for
 engraving short snippets transposed into several keys for practicing. Of
 course, the transpose command works nicely for this.

 However, it made me think of how transposing could be even nicer and now
 I'm
 wishing for a command line option to the lilypond command to transpose the
 engraved document by N halftones up or down. The particular advantage
 would
 be that this way the original document doesn't need to be changed in any
 way
 in order to transpose it.


If you're simply dealing with numbers of semitones, how would you be able
to control whether the output begins on, say, F# versus Gb?

I can imagine something which specifies that the music begin on
such-and-such a pitch.  For that, you could define a simple music
function--which really isn't saving any effort!

%%%
\version 2.19.16

beginOn =
#(define-music-function (layout props new mus)
   (ly:pitch? ly:music?)
   #{
 \transpose #(ly:make-pitch 0 0) #new
 #mus
   #})

music = { c' d' e' f' }

{
  \music
  \beginOn es'' \music
  \beginOn g \music
}

%%%
I'd have to investigate what would be possible from the command line.

--David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Enhancement: command line option to transpose N halftones up or down

2015-03-16 Thread Simon Albrecht

Hello Michael,

I think this question is more appropriate for the -user list.
Since I usually call lily from inside frescobaldi, my solution to this 
has been defining a variable for the resulting pitch:


\version 2.18

newTonic = des
music = \relative { c' }

\score {
  \transpose c \newTonic \music
}

%%

Anyone else knowing how to get this via the commandline? I seem to 
recall there was some possibility for custom options or something.


HTH, Simon

Am 16.03.2015 um 15:02 schrieb Michael Schuerig:

I've only been using LilyPond for a rather short time, so far mostly for
engraving short snippets transposed into several keys for practicing. Of
course, the transpose command works nicely for this.

However, it made me think of how transposing could be even nicer and now I'm
wishing for a command line option to the lilypond command to transpose the
engraved document by N halftones up or down. The particular advantage would
be that this way the original document doesn't need to be changed in any way
in order to transpose it.

Does this sound reasonable?

Michael



___
bug-lilypond mailing list
bug-lilyp...@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Enhancement: command line option to transpose N halftones up or down

2015-03-16 Thread Marc Hohl



Am 16.03.2015 um 16:09 schrieb Simon Albrecht:

Hello Michael,

I think this question is more appropriate for the -user list.
Since I usually call lily from inside frescobaldi, my solution to this
has been defining a variable for the resulting pitch:

\version 2.18

newTonic = des
music = \relative { c' }

\score {
   \transpose c \newTonic \music
}

%%

Anyone else knowing how to get this via the commandline? I seem to
recall there was some possibility for custom options or something.


I have done something like that some time ago.

I put these definitions in an include file:
#(define opt-octave (or (ly:get-option 'octave) 0))
#(define opt-note (or (ly:get-option 'note) 0))
#(define opt-alteration (or (ly:get-option 'alteration) 0))

#(define to-pitch (ly:make-pitch opt-octave opt-note opt-alteration))

optionalTranspose = #(define-music-function (parser location music) 
(ly:music?)

  #{ \transpose c' $to-pitch  $music #})

In the main file, you can use

\optionalTranspose { ...your music ...}

It is a bit cumbersome to specify

lilypond -dopt-octave=... -dopt-note=--- -dopt-alteration=... filename.ly

for each file, but aas I used this in a bash script to transpose a tune 
in *all* keys, it didn't matter.


HTH,

marc




HTH, Simon

Am 16.03.2015 um 15:02 schrieb Michael Schuerig:

I've only been using LilyPond for a rather short time, so far mostly for
engraving short snippets transposed into several keys for practicing. Of
course, the transpose command works nicely for this.

However, it made me think of how transposing could be even nicer and
now I'm
wishing for a command line option to the lilypond command to transpose
the
engraved document by N halftones up or down. The particular advantage
would
be that this way the original document doesn't need to be changed in
any way
in order to transpose it.

Does this sound reasonable?

Michael



___
bug-lilypond mailing list
bug-lilyp...@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Enhancement: command line option to transpose N halftones up or down

2015-03-16 Thread Simon Albrecht

Am 16.03.2015 um 17:43 schrieb Michael Schuerig:

On Monday 16 March 2015 11:26:30 David Nalesnik wrote:

Am 16.03.2015 um 15:02 schrieb Michael Schuerig:

I've only been using LilyPond for a rather short time, so far mostly
for engraving short snippets transposed into several keys for
practicing. Of course, the transpose command works nicely for this.

However, it made me think of how transposing could be even nicer and
now I'm wishing for a command line option to the lilypond command to
transpose the engraved document by N halftones up or down. The
particular advantage would be that this way the original document
doesn't need to be changed in any way in order to transpose it.

If you're simply dealing with numbers of semitones, how would you be
able to control whether the output begins on, say, F# versus Gb?

Fair question -- I have no idea. I came up with the semitones so that
the direction, up or down, is made explicit instead of left to LilyPond.

This is normally achieved through
\transpose c fis \music (up an augmented fourth) versus
\transpose c fis, \music (down a diminished fifth).

HTH, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Enhancement: command line option to transpose N halftones up or down

2015-03-16 Thread Michael Schuerig
On Monday 16 March 2015 11:26:30 David Nalesnik wrote:
 Am 16.03.2015 um 15:02 schrieb Michael Schuerig:
 
 I've only been using LilyPond for a rather short time, so far mostly
 for engraving short snippets transposed into several keys for
 practicing. Of course, the transpose command works nicely for this.
 
 However, it made me think of how transposing could be even nicer and
 now I'm wishing for a command line option to the lilypond command to
 transpose the engraved document by N halftones up or down. The
 particular advantage would be that this way the original document
 doesn't need to be changed in any way in order to transpose it.
 
 If you're simply dealing with numbers of semitones, how would you be
 able to control whether the output begins on, say, F# versus Gb?  

Fair question -- I have no idea. I came up with the semitones so that 
the direction, up or down, is made explicit instead of left to LilyPond.

 I can imagine something which specifies that the music begin on
 such-and-such a pitch.  For that, you could define a simple music
 function--which really isn't saving any effort!

My experience with LilyPond is very limited, as I wrote before, but my 
understanding is that such an approach would not work at the topmost 
level, i.e. for a book. As such, it could not be used without changing 
the document and that's exactly the thing I'd like to avoid. Also, 
that's why I think this is a valid enhancement request for the bug- list 
instead of the -user list.

Michael

-- 
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user