|
From: | Michael Ellis |
Subject: | Re: Mixing notation and lyric entry |
Date: | Wed, 15 Dec 2010 17:18:59 -0500 |
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 examplefrom 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 coderunlily(template()%locals())where mixlyrics.py is a module containing the MixLyrics class and the template() and runlily() functions.import sysfrom os.path import basename, splitext, join as pjoinfrom subprocess import Popenclass MixLyrics (object):""" Class for interleaving lyrics and notation """def __init__(self, delim="@@"):self.lyrics = []self.melody = []self.delim = delimdef 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 samename as this script.Args:'lymusic' is the lilypond code to process'lilyscript' is the name of your scriptthat processes .ly files."""pyname = basename(sys.argv[0])lyname = pjoin(splitext(pyname)[0] + '.ly')print >>file(lyname,'w'), lymusiccmd = "%(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 runpython template_example.pyThis 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 <address@hidden> wrote:imo it is a question of synchronising & visualising the input of 2 ore more
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
>
>
"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 c&p 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
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user
english-solfa.ly
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |