Re: Mixing notation and lyric entry

2010-12-15 Thread Michael Ellis
Jan Warchol wrote I don't know how it could be done, and i strongly
recommend not doing
this. Separating different types of content is in my opinion very
beneficial

I agree that separating content is useful.  As you point out, it allows one
to easily recombine it in various formats.  It's just that I prefer to have
the computer do the work whenever possible.  Let me see if I can clarify
what I mean by that.

Conceptually, I could write a preprocessor that would use special comment
prefixes '%!T' and '%!!T' to take input like

%!T  These are lyr- rics
%!!T do8  re mi fa

%!T  and a few more.
%!!T sol la ti do

and output the music and the lyrics in separate variable assignments

\tenormelody = \relative do { do8 re mi fa sol la ti do }
\tenorlyric   =  \lyricmode  { These are ly-rics and a few more }

and then use these in your template, right?  I can code that up in Python in
a heartbeat, but it's an unappealing solution for obvious reasons.   Hence
the query about how to do it with LilyPond and Scheme.

Cheers,
Mike


On Wed, Dec 15, 2010 at 1:52 AM, Jan Warchoł 
lemniskata.bernoulli...@gmail.com wrote:

 Hi,

 2010/12/14 Michael Ellis michael.f.el...@gmail.com:
  Is there a clean way to enter a phrase followed by the corresponding
 notes
  in a \relative block?  The example given in the docs,
 
  {
\time 3/4
\relative c' { c2 e4 g2. }
\addlyrics { play the game }
  }
 
  is fine for a small example, but it gets messy for longer music.   I do a
  lot of transcribing choral parts out of printed scores and would like to
 be
  able to keep the lyrics together with the music in chunks of a few bars

 I don't know how it could be done, and i strongly recommend not doing
 this. Separating different types of content is in my opinion very
 beneficial, for example i use the following template for choral music
 and i find it very logically structured, clear to read and easy to
 maintain (for example i can easily change an existing piece to be
 written on two staves instead of four just by changing structure in
 choir block):

 \version 2.12.3
 \pointAndClickOff
 \header {
title = 
subtitle = 
poet = słowa: 
composer = muzyka: 
arranger = opracowanie: 
 }
 global = {
\autoBeamOff
\key
\time
 }
 scoretempomarker = {
\tempo
\set Score.tempoHideNote = ##t
 }
 %MUSIC
 sopranomelody = \relative c'' {

\bar |.
 }
 altomelody = \relative f' {

\bar |.
 }
 tenormelody = \relative c' {

\bar |.
 }
 bassmelody = \relative f {

\bar |.
 }
 akordy = \chordmode {

 }
 %LYRICS
 sopranotext =  \lyricmode { \set stanza = 1. 

 }
 altotext =  \lyricmode { \set stanza = 1. 

 }
 tenortext =  \lyricmode { \set stanza = 1. 

 }
 basstext =  \lyricmode { \set stanza = 1. 

 }
 stanzas = \markup {
 }
 %THE BIG STRUCTURE
 VARIABLE

 choirpart = {
\new ChoirStaff 
\scoretempomarker
\new ChordNames { \germanChords \akordy }
\new Staff = soprano {
\clef treble
\set Staff.instrumentName = S 
\set Staff.shortInstrumentName = S 
\new Voice = soprano {
\global
\set Voice.midiInstrument = clarinet
\sopranomelody
}
}
\new Lyrics = sopranolyrics \lyricsto soprano \sopranotext

\new Staff = alto {
\clef treble
\set Staff.instrumentName = A 
\set Staff.shortInstrumentName = A 
\new Voice = alto {
\global
\set Voice.midiInstrument = english horn
\altomelody
}
}
\new Lyrics = altolyrics \lyricsto alto \altotext

\new Staff = tenor {
\clef treble_8
\set Staff.instrumentName = T 
\set Staff.shortInstrumentName = T 
\new Voice = tenor {
\global
\set Voice.midiInstrument = english horn
\tenormelody
}
}
\new Lyrics = tenorlyrics \lyricsto tenor \tenortext

\new Staff = bass {
\clef bass
\set Staff.instrumentName = B 
\set Staff.shortInstrumentName = B 
\new Voice = bass {
\global
 

Re: Mixing notation and lyric entry

2010-12-15 Thread Jan Warchoł
2010/12/15 Michael Ellis michael.f.el...@gmail.com
 Jan Warchol wrote I don't know how it could be done, and i strongly 
 recommend not doing
 this. Separating different types of content is in my opinion very
 beneficial
 I agree that separating content is useful.  As you point out, it allows one 
 to easily recombine it in various formats.  It's just that I prefer to have 
 the computer do the work whenever possible.  Let me see if I can clarify what 
 I mean by that.
 Conceptually, I could write a preprocessor that would use special comment 
 prefixes '%!T' and '%!!T' to take input like
 %!T  These are lyr- rics
 %!!T do8  re mi fa
 %!T  and a few more.
 %!!T sol la ti do
 and output the music and the lyrics in separate variable assignments
 \tenormelody = \relative do { do8 re mi fa sol la ti do }
 \tenorlyric   =  \lyricmode  { These are ly-rics and a few more }
 and then use these in your template, right?  I can code that up in Python in 
 a heartbeat, but it's an unappealing solution for obvious reasons.   Hence 
 the query about how to do it with LilyPond and Scheme.

Ah, i understand. Yeah, this is a good idea. wish i could help with that :/

cheers,
Janek

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


Re: Mixing notation and lyric entry

2010-12-15 Thread Michael Ellis
The following does what I want but requires explicit variables that have to
be manually concatenated.  There's got to be a way to reduce the overhead.
After all, Scheme is the most powerful language in the known universe,
right?


\include english-solfa.ly % english.ly modified to include solfa syllables

lyrfirst = \lyricmode { first two three four }
musfirst = \relative do' { do8 re mi fa }

lyrnext = \lyricmode { five six sev eight }
musnext = \relative do'' { sol la ti do }

% ...

sopmelody = \relative do {
\musfirst \musnext  % ...
}

soplyrics = \lyricmode {
\lyrfirst \lyrnext  % ...
}

\score {

\new Voice = Sop {
\autoBeamOn
\sopmelody
}
\new Lyrics \lyricsto Sop { \soplyrics }

}


Cheers,
Mike


On Wed, Dec 15, 2010 at 10:41 AM, Jan Warchoł 
lemniskata.bernoulli...@gmail.com wrote:

 2010/12/15 Michael Ellis michael.f.el...@gmail.com
  Jan Warchol wrote I don't know how it could be done, and i strongly
 recommend not doing
  this. Separating different types of content is in my opinion very
  beneficial
  I agree that separating content is useful.  As you point out, it allows
 one to easily recombine it in various formats.  It's just that I prefer to
 have the computer do the work whenever possible.  Let me see if I can
 clarify what I mean by that.
  Conceptually, I could write a preprocessor that would use special comment
 prefixes '%!T' and '%!!T' to take input like
  %!T  These are lyr- rics
  %!!T do8  re mi fa
  %!T  and a few more.
  %!!T sol la ti do
  and output the music and the lyrics in separate variable assignments
  \tenormelody = \relative do { do8 re mi fa sol la ti do }
  \tenorlyric   =  \lyricmode  { These are ly-rics and a few more }
  and then use these in your template, right?  I can code that up in Python
 in a heartbeat, but it's an unappealing solution for obvious reasons.
 Hence the query about how to do it with LilyPond and Scheme.

 Ah, i understand. Yeah, this is a good idea. wish i could help with that :/

 cheers,
 Janek

attachment: mixlyrics.png___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Mixing notation and lyric entry

2010-12-15 Thread -Eluze


Michael Ellis wrote:
 
 Is there a clean way to enter a phrase followed by the corresponding notes
 in a \relative block?  The example given in the docs,
 
 {
   \time 3/4
   \relative c' { c2 e4 g2. }
   \addlyrics { play the game }
 }
 
 is fine for a small example, but it gets messy for longer music.   I
 do a lot of transcribing choral parts out of printed scores and would
 like to be able to keep the lyrics together with the music in chunks
 of a few bars, e.g. something like
 
 themusic = \relative do {
 
snip
 
 \withlyrics { Stir- ring be- yond your watch- ful eye. } {
 do2 do4 do |
 do4 re do la |
 \time 3/4 re2. |
 }
 
 
 \withlyrics { Though they may not flow- er, flow- er, } {
 \time 2/4 sol,4 do |
 \time 2/2 fa,2 mi2 |
 re4( mi) fa( la) |
 \time 3/4 te2 la4 |
 
}
 
 snip
 
 }
 
 I'm finding that I make fewer errors and can fix the ones I do make
 faster if the lyrics are close to the notation.  As it is now, I have
 to re-enter (cut, paste  edit)  the lyrics in a separate \lyricmode
 block.  Any suggestions for how to write the \withLyrics function?  Or
 is there an existing clean solution I haven't found yet?
 
 Thanks,
 Mike
 
 

imo it is a question of synchronising  visualising the input of 2 ore more
voices (in a general way) 

one way is to put both in a table, the first row being the melody, the
second row the lyrics. then you can cp each to the corresponding ly-file.

if you are not happy with spreadsheet tools you can do the same with an
editor allowing to edit two synchronized files (in vertical scrolling); that
way you could have the melody in the left and the lyric text in the right
window (which are both included somewhere in your main score).

(of course you can also use one line per measure)

hope these ideas are helpful!

Eluze


-- 
View this message in context: 
http://old.nabble.com/Mixing-notation-and-lyric-entry-tp30458087p30467715.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: Mixing notation and lyric entry

2010-12-15 Thread Michael Ellis
Thanks, Eluze. The spreadsheet idea is clever!

Since my last post, I've been playing with a python template substitution
approach that, I think, will meet most of my needs.  Here's a trivial
example

from mixlyrics import *

## --
## Enter lyrics and notation here. Begin
## lyric lines with @@
soply = 
@@ Twink- le, twink- le lit- le star.
do4 do sol' sol |
la la sol2 |

@@ How I won- der what you are.
fa4 fa mi mi |
re re do2 \\bar |.

## ---

sml = MixLyrics()
sml.parse(soply)
soplyrics = sml.emitlyrics()
sopmelody = sml.emitmelody()

## Finally, process the Lilypond code
runlily(template()%locals())


where mixlyrics.py is a module containing the MixLyrics class and the
template() and runlily() functions.

import sys
from os.path import basename, splitext, join as pjoin
from subprocess import Popen

class MixLyrics (object):
 Class for interleaving lyrics and notation 
def __init__(self, delim=@@):
self.lyrics = []
self.melody = []
self.delim = delim

def parse(self,s):
for line in s.split('\n'):
line=line.strip()
if line.startswith(self.delim):
self.lyrics.append(line[len(self.delim):])
else:
self.melody.append(line)

def emitlyrics(self):
return  .join(self.lyrics)
def emitmelody(self):
return  .join(self.melody)

def template():
return 
\include english-solfa.ly %% english.ly modified to include solfa
syllables
\score {

\\new Voice = Sop {
\\autoBeamOn
\\relative do' { %(sopmelody)s }
}
\\new Lyrics \lyricsto Sop { %(soplyrics)s }

}


def runlily(lymusic, lilyscript=lily):

Write and process an .ly file with the same
name as this script.
Args:
'lymusic' is the lilypond code to process
'lilyscript' is the name of your script
that processes .ly files.

pyname = basename(sys.argv[0])
lyname = pjoin(splitext(pyname)[0] + '.ly')
print file(lyname,'w'), lymusic
cmd = %(lilyscript)s %(lyname)s%locals()
p = Popen(cmd, shell=True)
p.wait()


To try it out, put the attached .py files into any convenient directory and
run

python template_example.py

This should create and process a file named template_example.ly.  Note
that you need have a lilypond script named 'lily' or else change the call to
runlily().

I developed this on OS X and it should run as is on Linux.  On Windows you
may have to muck with the definition of runlily().

For me, this was a lot easier than outsmarting LilyPond's internals since I
can program in Python at least 10 times faster than in Scheme.  Only
downsides so far are having to double backslash some lilypond commands and
the loss of syntax highlighting.  The latter could be fixed by changing the
extension on input file to something like '.lyp' and telling my editor to
use lilypond syntax for that extension.

Hope someone finds this useful.

Cheers,
Mike


On Wed, Dec 15, 2010 at 3:40 PM, -Eluze elu...@gmail.com wrote:



 Michael Ellis wrote:
 
  Is there a clean way to enter a phrase followed by the corresponding
 notes
  in a \relative block?  The example given in the docs,
 
  {
\time 3/4
\relative c' { c2 e4 g2. }
\addlyrics { play the game }
  }
 
  is fine for a small example, but it gets messy for longer music.   I
  do a lot of transcribing choral parts out of printed scores and would
  like to be able to keep the lyrics together with the music in chunks
  of a few bars, e.g. something like
 
  themusic = \relative do {
 
 snip
 
  \withlyrics { Stir- ring be- yond your watch- ful eye. } {
  do2 do4 do |
  do4 re do la |
  \time 3/4 re2. |
  }
 
 
  \withlyrics { Though they may not flow- er, flow- er, } {
  \time 2/4 sol,4 do |
  \time 2/2 fa,2 mi2 |
  re4( mi) fa( la) |
  \time 3/4 te2 la4 |
 
 }
 
  snip
 
  }
 
  I'm finding that I make fewer errors and can fix the ones I do make
  faster if the lyrics are close to the notation.  As it is now, I have
  to re-enter (cut, paste  edit)  the lyrics in a separate \lyricmode
  block.  Any suggestions for how to write the \withLyrics function?  Or
  is there an existing clean solution I haven't found yet?
 
  Thanks,
  Mike
 
 

 imo it is a question of synchronising  visualising the input of 2 ore more
 voices (in a general way)

 one way is to put both in a table, the first row being the melody, the
 second row the lyrics. then you can cp each to the corresponding ly-file.

 if you are not happy with spreadsheet tools you can do the same with an
 editor allowing to edit two synchronized files (in vertical scrolling);
 that
 way you could have the melody in the left and the lyric text in the right
 window (which are both included somewhere in your main score).

 (of course you can also use 

Re: Mixing notation and lyric entry

2010-12-15 Thread Michael Ellis
Oops! You'll also need my english-solfa.ly file (attached) to run the
example as is.

Cheers,
Mike


On Wed, Dec 15, 2010 at 5:09 PM, Michael Ellis michael.f.el...@gmail.comwrote:

 Thanks, Eluze. The spreadsheet idea is clever!

 Since my last post, I've been playing with a python template substitution
 approach that, I think, will meet most of my needs.  Here's a trivial
 example

 from mixlyrics import *

 ## --
 ## Enter lyrics and notation here. Begin
 ## lyric lines with @@
 soply = 
 @@ Twink- le, twink- le lit- le star.
 do4 do sol' sol |
 la la sol2 |

 @@ How I won- der what you are.
 fa4 fa mi mi |
 re re do2 \\bar |.
 
 ## ---

 sml = MixLyrics()
 sml.parse(soply)
 soplyrics = sml.emitlyrics()
 sopmelody = sml.emitmelody()

 ## Finally, process the Lilypond code
 runlily(template()%locals())


 where mixlyrics.py is a module containing the MixLyrics class and the
 template() and runlily() functions.

 import sys
 from os.path import basename, splitext, join as pjoin
 from subprocess import Popen

 class MixLyrics (object):
  Class for interleaving lyrics and notation 
 def __init__(self, delim=@@):
 self.lyrics = []
 self.melody = []
 self.delim = delim

 def parse(self,s):
 for line in s.split('\n'):
 line=line.strip()
 if line.startswith(self.delim):
 self.lyrics.append(line[len(self.delim):])
 else:
 self.melody.append(line)

 def emitlyrics(self):
 return  .join(self.lyrics)
 def emitmelody(self):
 return  .join(self.melody)

 def template():
 return 
 \include english-solfa.ly %% english.ly modified to include solfa
 syllables
 \score {
 
 \\new Voice = Sop {
 \\autoBeamOn
 \\relative do' { %(sopmelody)s }
 }
 \\new Lyrics \lyricsto Sop { %(soplyrics)s }
 
 }
 

 def runlily(lymusic, lilyscript=lily):
 
 Write and process an .ly file with the same
 name as this script.
 Args:
 'lymusic' is the lilypond code to process
 'lilyscript' is the name of your script
 that processes .ly files.
 
 pyname = basename(sys.argv[0])
 lyname = pjoin(splitext(pyname)[0] + '.ly')
 print file(lyname,'w'), lymusic
 cmd = %(lilyscript)s %(lyname)s%locals()
 p = Popen(cmd, shell=True)
 p.wait()


 To try it out, put the attached .py files into any convenient directory and
 run

 python template_example.py

 This should create and process a file named template_example.ly.  Note
 that you need have a lilypond script named 'lily' or else change the call to
 runlily().

 I developed this on OS X and it should run as is on Linux.  On Windows you
 may have to muck with the definition of runlily().

 For me, this was a lot easier than outsmarting LilyPond's internals since I
 can program in Python at least 10 times faster than in Scheme.  Only
 downsides so far are having to double backslash some lilypond commands and
 the loss of syntax highlighting.  The latter could be fixed by changing the
 extension on input file to something like '.lyp' and telling my editor to
 use lilypond syntax for that extension.

 Hope someone finds this useful.

 Cheers,
 Mike



 On Wed, Dec 15, 2010 at 3:40 PM, -Eluze elu...@gmail.com wrote:



 Michael Ellis wrote:
 
  Is there a clean way to enter a phrase followed by the corresponding
 notes
  in a \relative block?  The example given in the docs,
 
  {
\time 3/4
\relative c' { c2 e4 g2. }
\addlyrics { play the game }
  }
 
  is fine for a small example, but it gets messy for longer music.   I
  do a lot of transcribing choral parts out of printed scores and would
  like to be able to keep the lyrics together with the music in chunks
  of a few bars, e.g. something like
 
  themusic = \relative do {
 
 snip
 
  \withlyrics { Stir- ring be- yond your watch- ful eye. } {
  do2 do4 do |
  do4 re do la |
  \time 3/4 re2. |
  }
 
 
  \withlyrics { Though they may not flow- er, flow- er, } {
  \time 2/4 sol,4 do |
  \time 2/2 fa,2 mi2 |
  re4( mi) fa( la) |
  \time 3/4 te2 la4 |
 
 }
 
  snip
 
  }
 
  I'm finding that I make fewer errors and can fix the ones I do make
  faster if the lyrics are close to the notation.  As it is now, I have
  to re-enter (cut, paste  edit)  the lyrics in a separate \lyricmode
  block.  Any suggestions for how to write the \withLyrics function?  Or
  is there an existing clean solution I haven't found yet?
 
  Thanks,
  Mike
 
 

 imo it is a question of synchronising  visualising the input of 2 ore
 more
 voices (in a general way)

 one way is to put both in a table, the first row being the melody, the
 second row the lyrics. then you can cp each to the corresponding ly-file.

 if you are not happy with spreadsheet tools 

Re: Mixing notation and lyric entry

2010-12-15 Thread -Eluze


Michael Ellis wrote:
 
 Thanks, Eluze. The spreadsheet idea is clever!
 
 Since my last post, I've been playing with a python template substitution
 approach that, I think, will meet most of my needs.  
 
hi Mike

what you are doing is in a way expanding parrallel input to lyrics.

to be honest, i tried it, and i'm back now to normal input with one file
for every voice/lyric/dynamics/...

but maybe your aproach will find approvers!

regards
Eluze
-- 
View this message in context: 
http://old.nabble.com/Mixing-notation-and-lyric-entry-tp30458087p30468887.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: Mixing notation and lyric entry

2010-12-14 Thread Laura Conrad
 Michael == Michael Ellis michael.f.el...@gmail.com writes:

Michael Any suggestions for how to write the \withLyrics function?
Michael Or is there an existing clean solution I haven't found yet?

I always used to wish for that, and then I figured out how to use
point-and-click and I don't need it any more.

Before I figured that out, I solved the problem by using ABC and abc2ly,
which does let (require that) you enter the lyrics right under the notes:

  AB   C
w:Play the game

-- 
Laura   (mailto:lcon...@laymusic.org)
(617) 661-8097  233 Broadway, Cambridge, MA 02139   
http://www.laymusic.org/ http://www.serpentpublications.org

At dawn, the magpie sings, and by day the black cockatoo wing their
way across a sunny sky.  The koala, possum, dingo and carpet snake are
silent on the land below.  A mist covers the mountains.  We and our
land are crying for you.

Eve Fesl, Matriarch of the Gubbi Gubbi tribe, eulogizing Steve Irwin


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


Re: Mixing notation and lyric entry

2010-12-14 Thread Jan Warchoł
Hi,

2010/12/14 Michael Ellis michael.f.el...@gmail.com:
 Is there a clean way to enter a phrase followed by the corresponding notes
 in a \relative block?  The example given in the docs,

 {
   \time 3/4
   \relative c' { c2 e4 g2. }
   \addlyrics { play the game }
 }

 is fine for a small example, but it gets messy for longer music.   I do a
 lot of transcribing choral parts out of printed scores and would like to be
 able to keep the lyrics together with the music in chunks of a few bars

I don't know how it could be done, and i strongly recommend not doing
this. Separating different types of content is in my opinion very
beneficial, for example i use the following template for choral music
and i find it very logically structured, clear to read and easy to
maintain (for example i can easily change an existing piece to be
written on two staves instead of four just by changing structure in
choir block):

\version 2.12.3
\pointAndClickOff
\header {
title = 
subtitle = 
poet = słowa: 
composer = muzyka: 
arranger = opracowanie: 
}
global = {
\autoBeamOff
\key
\time
}
scoretempomarker = {
\tempo
\set Score.tempoHideNote = ##t
}
%MUSIC
sopranomelody = \relative c'' {

\bar |.
}
altomelody = \relative f' {

\bar |.
}
tenormelody = \relative c' {

\bar |.
}
bassmelody = \relative f {

\bar |.
}
akordy = \chordmode {

}
%LYRICS
sopranotext =  \lyricmode { \set stanza = 1. 

}
altotext =  \lyricmode { \set stanza = 1. 

}
tenortext =  \lyricmode { \set stanza = 1. 

}
basstext =  \lyricmode { \set stanza = 1. 

}
stanzas = \markup {
}
%THE BIG STRUCTURE
VARIABLE

choirpart = {
\new ChoirStaff 
\scoretempomarker
\new ChordNames { \germanChords \akordy }
\new Staff = soprano {
\clef treble
\set Staff.instrumentName = S 
\set Staff.shortInstrumentName = S 
\new Voice = soprano {
\global
\set Voice.midiInstrument = clarinet
\sopranomelody
}
}
\new Lyrics = sopranolyrics \lyricsto soprano \sopranotext

\new Staff = alto {
\clef treble
\set Staff.instrumentName = A 
\set Staff.shortInstrumentName = A 
\new Voice = alto {
\global
\set Voice.midiInstrument = english horn
\altomelody
}
}
\new Lyrics = altolyrics \lyricsto alto \altotext

\new Staff = tenor {
\clef treble_8
\set Staff.instrumentName = T 
\set Staff.shortInstrumentName = T 
\new Voice = tenor {
\global
\set Voice.midiInstrument = english horn
\tenormelody
}
}
\new Lyrics = tenorlyrics \lyricsto tenor \tenortext

\new Staff = bass {
\clef bass
\set Staff.instrumentName = B 
\set Staff.shortInstrumentName = B 
\new Voice = bass {
\global
\set Voice.midiInstrument = clarinet
\bassmelody
}   
}
\new Lyrics = basslyrics \lyricsto bass \basstext

}

%-MIDI-
\score {
\unfoldRepeats \choir
\midi {
\context {
\Staff \remove Staff_performer
}
\context {
\Voice
\consists Staff_performer
\remove Dynamic_performer
}
}
}

%LAYOUT
\score {
\choir
\layout {
indent = 0\cm
\context {
\Staff \consists Ambitus_engraver
}
}
}

\stanzas

(if anyone wants to use this template, feel free to do it).

cheers,
Janek

___
lilypond-user mailing