Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-15 Thread Hermann Hinsch
Am Freitag, 15. April 2011, 05:24:19 schrieb Don Simons:
 Here a test drive report. The really good news is that on my somewhat aging
 Windows XT SP2 system, straight out of the box I got the script to run and
 extract parts. (I'm a little puzzled why it ran at all since I've never
 knowingly installed any Lua interpreter).
 
 PMX 2.603 than ran fine on Sanctus-Q2.
 
 But when I next ran etex on the resulting Sanctus-Q2.tex, I got
 
 ! sorry, musixuad must be input before musixlyr.
 l.48 ...y, musixuad must be input before musixlyr}
 
 After commenting out the two lines
 
 % \input musixadd
 % \input musixuad
 
 etex and dvips ran OK, but produced a .ps with one system on the 1st page
 at the bottom, 1 on the second at the top, and two on the 3rd, and 3 on
 the 4th. I had used these options with dvips: dvips -O0.25in,-0.22in
 Sanctus-Q2 Adding -ta4 didn't help the pagination.

I know this from my experience with many M-Tx scores. This is due to using in 
the preamble 
Bars/line: . I use this in the first run but to get a pleasant layout one has 
to specify 
Pages:  and Systems:  and if necessary distribute the systems by the PMX 
commands Ln  
and LnPm

Hermann

 
 The musixadd issue is probably related (in a way I haven't worked out in
 detail) to assumptions I made in PMX 2.603, namely that it would always
 use MusiXteX 1.15 or better, and therefore never require musixadd,
 musixmad, or musixuad.
 
 Bad news is that I couldn't get prepmx to process Sanctus.mtx at all. It
 complains
 
 == This is M-Tx 0.60d (Music from TeXt) 11 October 2008
 == Input from file Sanctus.mtx
 Writing to Sanctus.pmx
 Too many groups: ERROR on line 5
 
 When Hermann first started this thread, I wondered whether M-Tx could deal
 with so many voices, and I'm still wondering. Have I missed an upgrade?
 
 --Don Simons
 
 -Original Message-
 From: tex-music-boun...@tug.org [mailto:tex-music-boun...@tug.org] On
 Behalf Of Dirk Laurie
 Sent: Wednesday, April 13, 2011 1:03 PM
 To: Werner Icking Music Archive
 Subject: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx
 score
 
 On Mon, Apr 11, 2011 at 01:02:39PM +0200, Hermann Hinsch wrote:
  So Dirk, your suggestion might be easier. As you asked me you will
  find the M-Tx score of the Sanctus (which is the smallest part) in the
 
 attachment.
 
 I append:
 1. The program extract.lua, a rudimentary M-Tx score-to-parts maker,
 
 with just enough features to handle your Sanctus.
 
 2. Your Sanctus.mtx (so others can check that exctact.lua works
 
 on their systems too)
 
 3. The five files made by extract.lua
 
 The coding is to my usual standard, i.e. intelligible to me at the time
 of writing.  If others can understand it, it is because Lua is an
 unusually readable and intuitive language.
 
 We can start talking revision numbers the moment that more than one
 version exists.
 
 “It is pointless to generalize unless at least two non-isomorphic
 examples of the generalization can be given.”  — Nicolas Bourbaki
 
 Dirk
 
 ---
 TeX-music@tug.org mailing list
 If you want to unsubscribe or look at the archives, go to
 http://tug.org/mailman/listinfo/tex-music


---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-15 Thread Hermann Hinsch
Am Freitag, 15. April 2011, 07:42:08 schrieb Dirk Laurie:
 On Wed, Apr 13, 2011 at 10:02:32PM +0200, Dirk Laurie wrote:
  I append:
  1. The program extract.lua, a rudimentary M-Tx score-to-parts maker,
  
  with just enough features to handle your Sanctus.
  
  We can start talking revision numbers the moment that more than one
  version exists.
 
 OK, here is a newer version: 0.20.  It has one more feature, e.g:
 texlua extract.lua Sanctus.mtx Q3 Bass
 extracts the third choir and the bass part.

Dirk, 

this is excellent! The performer of the whole Mass asked just for this. 
Therefore I made a 
C-program to extract the necessary lines but I had to add all M-Tx specific 
instructions. Of 
course this was a stopbag. 

Hermann

 
 And it corrects a bug that Hermann reported.
 
 Dirk

---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-15 Thread Don Simons
Dirk Laurie wrote
If your TeX is recent enough, there's a Lua interpreter hidden in it.


Aha! I guess MiKTeX 2.6 is recent enough.

 ! sorry, musixuad must be input before musixlyr.
 l.48 ...y, musixuad must be input before musixlyr}

It is needed for Hermann's huge score but not for the extracted
ones.  I simply made an empty file in the same directory and called
it musixuad.sty.  It is found in preference to the system-wide one.


I don't believe it is needed for Hermann's huge score. Try the most recent
version of MusiXTeX 1.15
(http://www.icking-music-archive.org/software/musixtex/musixtex.zip).

 produced a .ps with one system on
 the 1st page at the bottom, 1 on the second at the top, and two
 on the 3rd, and 3 on the 4th.
That's caused by the paragraph of pure TeX.  Responsibility of the
user, not of extract.lua.

Long ago I built into PMX the Ae option, which equalizes the vertical
spaces on a page between the bottoms of one system and the tops of the next.
I did it by adding very long vertical struts to the top staff of every
system except the top one, and to the bottom staff of every system except
the bottom one, so in the end all systems are the same virtual height and
they all overlap by a lot, which is OK because the pagebreaks are forced. A
welcome consequence is that this forces the specified numbers of pages and
systems ALWAYS to be rigorously observed, with no spillover ever. I always
use the Ae option and never have problems with unintended  numbers of
systems on any page. Perhaps there is some way that M-Tx could take
advantage of this feature.

 Bad news is that I couldn't get prepmx to process Sanctus.mtx at
 all. It complains
   Too many groups: ERROR on line 5
 When Hermann first started this thread, I wondered whether M-Tx could
deal
 with so many voices, and I'm still wondering. Have I missed an
upgrade?
extract.lua can deal with any number of voices even if M-Tx can't :-)
But anyway it's trivial.  In globals.pas, omitting the quaint comments
on 64K data segments:

const PMXlinelength = 128;
  lines_in_paragraph = 100;
  max_words = 128;
  max_notes = 128;
  max_bars = 16;
  maxstaves = 15;
  maxvoices = 15;
  maxgroups = 3;
  standardPMXvoices = 12;

Just change the ones you need and recompile.  

So I suppose that's what Hermann did to compile Sanctus in the first place,
as well as somehow manually dealing with the musixlyr/musixuad problem?

Of course, you need a PMX
that can handle it, 

You have had one for 6 months in pmx2602, then pmx2603.

which is not the one documented in pmxdoc.pdf.

I've never named the manual that way, so I don't know which version it is,
but it's probably the last one I published before today, which I named
pmx250.pdf. I apologize for not uploading the more recent one, pmx260.pdf,
but today I've corrected that by adding it to pmx2603.zip: 
http://www.icking-music-archive.org/software/pmx/pmx2603.zip
No changes in syntax are needed to go up to 24 voices, but as stated in the
preface to pmx260.pdf, (1) MusiXTeX 1.15 is required, and (2) the file MUST
be processed with etex.

--Don Simons





Dirk
---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to
http://tug.org/mailman/listinfo/tex-music


---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-15 Thread Dirk Laurie
On Fri, Apr 15, 2011 at 05:18:24PM +0200, Don Simons wrote:
 Long ago I built into PMX the Ae option, which equalizes the vertical
 spaces on a page between the bottoms of one system and the tops of the next.
 ... I always use the Ae option ...
 Perhaps there is some way that M-Tx could take advantage of this feature.
Line 54 of preamble.pas reads:
  ( '', '', '', '', '', '', '', '1/4',
Change it to
  ( '', '', '', 'Ae', '', '', '', '1/4',
Then M-Tx will also always use the Ae option.

You know, backward compatibility is always thought to be a good thing,
but if it means go on doing it badly because it has always been
done badly I start recalling the proverb Too much of a good thing
is also bad.  So I think, if I make a new M-Tx release, I'll make that
the default.

Dirk
---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-14 Thread Don Simons
Here a test drive report. The really good news is that on my somewhat aging 
Windows XT SP2 system, straight out of the box I got the script to run and 
extract parts. (I'm a little puzzled why it ran at all since I've never 
knowingly installed any Lua interpreter). 

PMX 2.603 than ran fine on Sanctus-Q2.

But when I next ran etex on the resulting Sanctus-Q2.tex, I got

! sorry, musixuad must be input before musixlyr.
l.48 ...y, musixuad must be input before musixlyr}

After commenting out the two lines

% \input musixadd
% \input musixuad

etex and dvips ran OK, but produced a .ps with one system on the 1st page at 
the bottom, 1 on the second at the top, and two on the 3rd, and 3 on the 4th. I 
had used these options with dvips: dvips -O0.25in,-0.22in Sanctus-Q2
Adding -ta4 didn't help the pagination. 

The musixadd issue is probably related (in a way I haven't worked out in 
detail) to assumptions I made in PMX 2.603, namely that it would always use 
MusiXteX 1.15 or better, and therefore never require musixadd, musixmad, or 
musixuad. 

Bad news is that I couldn't get prepmx to process Sanctus.mtx at all. It 
complains

== This is M-Tx 0.60d (Music from TeXt) 11 October 2008
== Input from file Sanctus.mtx
Writing to Sanctus.pmx
Too many groups: ERROR on line 5

When Hermann first started this thread, I wondered whether M-Tx could deal with 
so many voices, and I'm still wondering. Have I missed an upgrade?

--Don Simons

-Original Message-
From: tex-music-boun...@tug.org [mailto:tex-music-boun...@tug.org] On
Behalf Of Dirk Laurie
Sent: Wednesday, April 13, 2011 1:03 PM
To: Werner Icking Music Archive
Subject: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx
score

On Mon, Apr 11, 2011 at 01:02:39PM +0200, Hermann Hinsch wrote:

 So Dirk, your suggestion might be easier. As you asked me you will
 find the M-Tx score of the Sanctus (which is the smallest part) in the
attachment.


I append:
1. The program extract.lua, a rudimentary M-Tx score-to-parts maker,
with just enough features to handle your Sanctus.
2. Your Sanctus.mtx (so others can check that exctact.lua works
on their systems too)
3. The five files made by extract.lua

The coding is to my usual standard, i.e. intelligible to me at the time
of writing.  If others can understand it, it is because Lua is an
unusually readable and intuitive language.

We can start talking revision numbers the moment that more than one
version exists.
“It is pointless to generalize unless at least two non-isomorphic
examples of the generalization can be given.”  — Nicolas Bourbaki

Dirk



---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-14 Thread Bodo Meissner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I just tested it on Ubuntu Lucid. I installed the latest Debian packages 
musixtex, pmx and m-tx because Ubuntu does not yet have the latest versions.

Am 15.04.2011 05:24, schrieb Don Simons:

 PMX 2.603 than ran fine on Sanctus-Q2.

The same here with Sanctus-Q1

 But when I next ran etex on the resulting Sanctus-Q2.tex, I got
 
 ! sorry, musixuad must be input before musixlyr.
 l.48 ...y, musixuad must be input before musixlyr}

Where does musixuad come from?
On my system it is not present and I did not find it in the musixtex 1.15 .zip 
file.

MusiXADDitional instruments T.115 19 Nov 2010
maxinstruments=9 maxgroups=4 maxslurs=9)
! I can't find file `musixuad'.
l.14  \input musixuad


 After commenting out the two lines
 
 % \input musixadd
 % \input musixuad
 
 etex and dvips ran OK, but produced a .ps with one system on the 1st page at 
 the bottom, 1 on the second at the top, and two on the 3rd, and 3 on the 4th. 

The same here for Synctus-Q1 displayed with xdvi.

 == This is M-Tx 0.60d (Music from TeXt) 11 October 2008
 == Input from file Sanctus.mtx
 Writing to Sanctus.pmx
 Too many groups: ERROR on line 5

The same here.

I get another error for Sanctus-Bass:

== This is M-Tx 0.60d (Music from TeXt) 11 October 2008
== Input from file Sanctus-Bass.mtx
Writing to Sanctus-Bass.pmx
No music paragraphs!: ERROR on line 0

The resulting .pmx file is empty (0 bytes).

I used the file Sanctus-Bass.mtx attached to Dirk's mail.


Bodo
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk2n09gACgkQnMz9fgzDSqdprgCgjEriIhJD9ud36RS6jeMI/kJF
BNQAnR+K1q6Zx6O9nEA8W5hnH8Vll5YW
=5LAk
-END PGP SIGNATURE-
---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


Re: [Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-14 Thread Dirk Laurie
On Fri, Apr 15, 2011 at 05:24:19AM +0200, Don Simons wrote:
 Here a test drive report. The really good news is that on my somewhat aging
 Windows XT SP2 system, straight out of the box I got the script to run and
 extract parts. (I'm a little puzzled why it ran at all since I've never
 knowingly installed any Lua interpreter). 
If your TeX is recent enough, there's a Lua interpreter hidden in it.
You have texlua if you have luatex.  It's the same program, but what
it does depends on the name by which it is called.  If you call it as
texlua, it's just a slightly customized Lua interpreter.

 PMX 2.603 than ran fine on Sanctus-Q2.
 
 But when I next ran etex on the resulting Sanctus-Q2.tex, I got
 
 ! sorry, musixuad must be input before musixlyr.
 l.48 ...y, musixuad must be input before musixlyr}
 
It is needed for Hermann's huge score but not for the extracted
ones.  I simply made an empty file in the same directory and called 
it musixuad.sty.  It is found in preference to the system-wide one.

 etex and dvips ran OK, but produced a .ps with one system on 
 the 1st page at the bottom, 1 on the second at the top, and two 
 on the 3rd, and 3 on the 4th. 
That's caused by the paragraph of pure TeX.  Responsibility of the
user, not of extract.lua.
 
 Bad news is that I couldn't get prepmx to process Sanctus.mtx at 
 all. It complains
   Too many groups: ERROR on line 5
 When Hermann first started this thread, I wondered whether M-Tx could deal
 with so many voices, and I'm still wondering. Have I missed an upgrade?

extract.lua can deal with any number of voices even if M-Tx can't :-)

But anyway it's trivial.  In globals.pas, omitting the quaint comments 
on 64K data segments:

const PMXlinelength = 128;
  lines_in_paragraph = 100;
  max_words = 128;
  max_notes = 128;
  max_bars = 16;
  maxstaves = 15;
  maxvoices = 15;
  maxgroups = 3;
  standardPMXvoices = 12;

Just change the ones you need and recompile.  Of course, you need a PMX
that can handle it, which is not the one documented in pmxdoc.pdf.

Dirk
---
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music


[Tex-music] [ANNOUNCE] extract.lua: Making parts of a M-Tx score

2011-04-13 Thread Dirk Laurie
On Mon, Apr 11, 2011 at 01:02:39PM +0200, Hermann Hinsch wrote:
 
 So Dirk, your suggestion might be easier. As you asked me you will find the
 M-Tx score of the Sanctus (which is the smallest part) in the attachment.


I append:
1. The program extract.lua, a rudimentary M-Tx score-to-parts maker,
with just enough features to handle your Sanctus.
2. Your Sanctus.mtx (so others can check that exctact.lua works
on their systems too)
3. The five files made by extract.lua 

The coding is to my usual standard, i.e. intelligible to me at the
time of writing.  If others can understand it, it is because Lua is
an unusually readable and intuitive language.

We can start talking revision numbers the moment that more than one
version exists.  
“It is pointless to generalize unless at least two non-isomorphic 
examples of the generalization can be given.”  — Nicolas Bourbaki

Dirk   
#!/usr/bin/texlua
-- extract.lua DPL 2011-04-13
-- write separate M-Tx scores for each style element
-- Usage (Unix):extract.lua MYFILE.mtx 
--   (all systems)  texlua extract.lua MYFILE.mtx   

-- There must be exactly one style line in the preamble.  Each 
--  separate entry in that line will get one part.
-- Features:
--  will look for lyrics, uptext and chord lines
-- Bugs:
--  does not look for special lyrics lines, only for those
--  starting with L:
--  only adjacent C or L lines are found (i.e. no intervening
--  comment lines allowed)


-- some convenient abbreviations and utility subroutines
append = table.insert
match = string.match
upper = string.upper
format = string.format
gmatch = string.gmatch
find = string.find
comment = '^%s*%%'  -- first non-blank is a comment
lyrics = '^%s*{.*}' -- first word is enclosed in braces
keyword = '^%s*(.*):'   -- first word if followed by colon
kwbody = .*:(.*)  -- everything after keyword
word = '%s*(%S+)'   -- maximal string of non-blanks
styleclause = ';?([^;]*)'   -- clauses of style line separated by semicolons

function wordset(line)
local ws = {}
for w in gmatch(line,word) do ws[w]=true end
return ws
end

-- read input and separate into paragraphs
infilename = arg[1]
if infilename then infile = io.open(arg[1]) end
assert (infile, Usage: extract.lua MYFILE.mtx)
base, ext = match(infilename,'(.*)%.(.*)')

lines = {}
index = {}
for l in infile:lines() do
blank = match(l,^%s*$) 
if blank and start then append(index,{start,#lines}); start=nil
elseif not (blank or start) then start = #lines+1 
end
append(lines,l)
end
if start then append(index,{start,#lines}) end

-- classify paragraphs
function classify(item)
local first
for l=item[1],item[2] do
if not match(lines[l],comment) then first=lines[l] break end
end
if not first then return 'comment' end
if match(first,lyrics) then return 'lyrics' end
for l=item[1],item[2] do
if match(upper(lines[l]),'^%s*STYLE:') then 
styleline = lines[l]; return 'style' 
end
end
return 'music'
end

for _,item in ipairs(index) do item.class = classify(item) end

-- identify style elements and open part files
assert(styleline,No styleline found)
body = match(styleline,kwbody)
parts={}
partfile={}
partset={}
style={}
for part in gmatch(body,word) do 
append(parts,part) 
partset[part] = true
partfile[part]=io.open(format(%s-%s.%s,base,part,ext),'w')
end

-- go through file and print relevant lines

function writeln(part,line)
partfile[part]:write(line..'\n') 
end

function to_all(line)
for _,part in pairs(parts) do writeln(part,line) end
end

function stylepara(item)
for l=item[1],item[2] do
local line = lines[l]
local kw = match(line,keyword)
if upper(kw)=='STYLE' then 
for _,part in ipairs(parts) do
writeln(part,'Style: '..part)
end
elseif partset[kw] then 
style[kw] =  match(line,kwbody)
writeln(kw,line)
else to_all(line)
end
end
end

function commentpara(item)
for l=item[1],item[2] do to_all(lines[l]) end
end

function musicpara(item,part)
-- write line to file if it matches
function maybe(line,lbl)
if not line then return end
local x = match(line,keyword)
if x and find(lbl,x) then writeln(part,line) end
end
label=voices[part]
for l=item[1],item[2] do
local line = lines[l]
local kw = match(line,keyword)
if label[kw] then -- Aha! this is one of our voices.
maybe(lines[l-1],'U')
writeln(part,line) 
maybe(lines[l+1],'CL')
maybe(lines[l+2],'CL')
elseif match(line,comment) then writeln(part,line) 
end
end
end

function labels()
-- Identify voice labels for each part