Re: [Tex-music] musixflx in Lua

2011-04-11 Thread David Allsopp
Bob Tennent wrote:
  | It should be functionally identical to musixflx.c (up to round-off
 |error).
  |
  |Is this just a throw-away line or are there actual systemic differences
 |in the precision of the floating point variables used? Floating point
 |calculations are a CPU function - it would be beneficial if the results
 |strived to be *identical* on the same architecture (a guarantee which
 TeX  |provides).
 
 That's because TeX doesn't do floating-point! One of the reasons (the
 other being the lack of arrays) that a separate musiflx program was
 introduced.

Internally TeX does (at least the paragraphing algorithm uses floating point) - 
that's why the TRIP test can have rounding errors in some of the calculations 
and so numbers in logs are allowed to differ but still pass the TRIP test.

 The differences are in the last digit and since there are no significant
 numerical calculations involved, I'm guessing the differences arise from
 differences in the output formatting.
 
  |I'm not terribly familiar with Lua, but I would anticipate  |that C
 will be more flexible here - both scripts should use the same  |floating
 point representation for calculations which will eliminate all  |sources
 of non-algorithmic rounding error (if necessary, the C script  |could be
 changed).
 
 I think that's called moving the goalposts :+)

Possibly, but if two scripts were being maintained then I'd maintain that 
identical output is the more critical thing to have (and, yes, in the 16th 
decimal place - no optimising compiler re-orders floating point instructions 
without being told that unsafe optimisations are allowed precisely because the 
results can differ, the same algorithm over the same precision of floating 
point representation should produce *exactly* the same output regardless of 
language)
 
But that said...

snip

 I think it would be much better to
 incorporate the musixflx calculations into musixtex.tex and make LuaTeX a
 requirement for MusiXTeX.

I was thinking that binding musixtex to a specific TeX driver was too radical 
but if that's the plan then it seems like a very good idea - anyone who wishes 
to use an alternate TeX driver with musixtex can then be expected to install a 
lua interpreter themselves. And of course if luatex is the required driver (and 
musixflx.lua is still available in the distribution) then there'd be no need to 
maintain musixflx.c any more.


David

---
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] musixflx in Lua

2011-04-11 Thread David Allsopp
Dirk Laurie wrote:
 1. Identical results on the same architecture requires switching off *all*
 optimization in the C compiler.  Not even a widely disseminated
 software package such as BLAS (Basic Linear Algebra Subroutines)
 promises identical runs nowadays, even for two runs on the same
 machine.  One should not write software that behaves qualitatively
 differently depending on what happens in the sixteenth decimal place.

This is not relevant to my point - when regressing output of scripts, it is 
exceedingly useful if the output can be strived to be identical (and in this 
case, all that means is the translation from .mx1 to .mx2). And no 
optimisations in the compiler should by default be re-ordering floating point 
instructions because that is unsafe.

 2. Lua is written in C; in fact, the C code for a customized version of
 the Lua interpreter is compiled and linked into the LuaTeX
 executable.  Lua's number and C's double is one and the same.

Then this should eliminate the errors assuming the algorithms have been 
implemented using the same sequenced floating point operations.

 3. There is a strong possibility that LuaTeX will become the default
 TeX engine in most distributions.  I.e. when you type latex,
 or etex, or pdftex, or luatex, in all cases the actual executable
 will be luatex, although what it actually does will depend on which
 of the four names you used.  (If you type tex, you should still get
 an executable generated from Knuth's cweb source, by the terms of
 his licence.)  I.e. if you have TeX, you will have luatex without
 lifting a finger.

I hadn't reckoned that this step was actually being taken - but it eliminates 
virtually all my concerns if musixflx.lua becomes the only version of the 
script anyway! 
 
 4. I can find only one place where musixflx may possibly, even though
 he probability is remote, be roundoff-sensitive:
 If the overhang is less than half the barlength, include the
 latest bar in the line, and shrink the line accordingly.
 It is possible (though the probability is less than that of my winning
 the lottery if I buy only one ticket) that the overhang on musixflx.c
 could be 0.4999 and on musixflx.lua 0.5000,
 or vice versa.
 I suspect that on PMX-generated scores no decision on line breaking
 is left to musixflx, so this conditional should not be encountered
 in that case.

I was only talking about musixflx (i.e. musixtex itself) - I don't use PMX. 
Incidentally, while I appreciate your exaggeration to make a point, the 
resulting output in the .mx2 file is only to 5 decimal places as the result is 
a TeX pt...


David 


---
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] Making parts of a M-Tx score

2011-04-11 Thread Hermann Hinsch
Hi Christian, Dirk and Don,

Thank you very much for your help. First of all this is my whole project:
Typesetting a complete catholic mass by Abbatini (1600 - 1679) of 16 voices 
with all 5 parts 
(Kyrie, Gloria, Credo, Sanctus, and Agnus-Dei). You may find this mass at 
www.rzuser.uni-
heidelberg.de/~nh0/QUICS.html. 
As the mass will be performed in the next future the leader of the ensemble ask 
me to 
extract single voices.

I wasn´t at home during the last days. So I only tried to use abcpp as 
Christian suggested. 
I had a first success taking the same scheme as in the example given  in 
.../pmxtricks/ihrl.mtp. Following this example I have to change all used 
labels. This would 
be rather tedious because the mass consists of 312 bars. 

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.

Don, I will send the PMX score of the Sanctus to your private address.

Hermann
---
\def\mtxversion{0.60d}
\def\mtxdate{11 October 2008}
\input mtx
 \def\writebarno{\ifnum\barno1\lrlap{\tenrm\it\the\barno\barnoadd}\fi}
 \def\raisebarno{4mm}
 \raggedbottom
 \parskip 9\Interligne plus 7\Interligne minus 7\Interligne
 \input musixadd
 \input musixuad
 \input musixlit
 \tenbf
---
17 -17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 0 6  0.0 0 0 3 20 0

















66000600060006000
./
\\mtxGroup{1}{17}{14}\
\\mtxGroup{2}{13}{10}\
\\mtxGroup{3}{9}{6}\
\\mtxGroup{4}{5}{2}\
\\mtxSetSize{17}{\mtxNormalSize}\
\\mtxTenorClef{16}\
\\mtxTenorClef{15}\
\\mtxTenorClef{12}\
\\mtxTenorClef{11}\
\\mtxTenorClef{8}\
\\mtxTenorClef{7}\
\\mtxTenorClef{4}\
\\mtxTenorClef{3}\
% Paragraph 3 line 22 bar 1
 P2
 Ab
 h290m
 \\let\interstaffsav\interstaff\def\interstaff#1{}\interstaffsav{8.6}\
 \\\roffset{79.5}{\zcharnote{306}{\medtype\bf 1}}\
 \\setinterinstrument{1}{3.2mm}\
 \\setinterinstrument{5}{3.5mm}\
 \\setinterinstrument{9}{3.5mm}\
 \\setinterinstrument{13}{3.5mm}\
\\\mtxSetLyrics{11}{San---ctus}\
\\\mtxSetLyrics{21}{San-}\
\\\mtxAssignLyrics{17}{11}\
\\\mtxAssignLyrics{16}{21}\
g03 g2- b2 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
XS3 r0 \mtxBM\ g25d f4 /
d25d c4 b2 d2 /

% Paragraph 4 line 66 bar 2
\\\mtxSetLyrics{11}{San-}\
\\\mtxSetLyrics{21}{-}\
\\\mtxSetLyrics{31}{San---}\
\\\mtxAssignLyrics{15}{31}\
c23 e2 d0 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
XS6 r0 d25d c4 /
e45 f4s g0 \mtxEM\ f2  /
\mtxBM\ c45 b4 b4 [ a8 g8 ] \mtxEM\ a0  /

% Paragraph 5 line 101 bar 3
\\\mtxSetLyrics{11}{ctus}\
\\\mtxSetLyrics{21}{ctus}\
\\\mtxSetLyrics{31}{-ctus San-}\
\\\mtxSetLyrics{41}{San-}\
\\\mtxAssignLyrics{14}{41}\
g23d f4s e4 f4 g2 s /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
\\\mtxLyricsAdjust{14}{2}\ \mtxBM\ g23d f4s e4 f4 (Q g2 /
b24 d2 \mtxBM\ c4 b4 b4 [ a8 g8 ] /
g05 r0 /
b04 r0 /

% Paragraph 6 line 136 bar 4
\\\mtxSetLyrics{11}{San---ctus,}\
\\\mtxSetLyrics{21}{San---}\
\\\mtxSetLyrics{31}{ctus,}\
\\\mtxSetLyrics{41}{ctus,}\
g23 s f2s g0 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
g23 )Q \mtxEM\ f2s  g0 /
\mtxEM\ a04  b0 /
XS3 r0 g25d f4 /
d25d c4 b2 d2 /

% Paragraph 7 line 171 bar 5
\\\mtxSetLyrics{11}{San-}\
\\\mtxSetLyrics{21}{-ctus, San-}\
\\\mtxSetLyrics{31}{San---ctus,}\
\\\mtxSetLyrics{41}{San-}\
c23d b4 a2 b2 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
\mtxBM\ c23d b4 a2 b2 /
e25d d4 c2 d2 /
e25 g2 r2 \mtxBM\ f2s /
\mtxBM\ c25d d4 e2 b2 /

% Paragraph 8 line 206 bar 6
\\\mtxSetLyrics{11}{ctus}\
\\\mtxSetLyrics{21}{ctus}\
\\\mtxSetLyrics{31}{Sanctus}\
\\\mtxSetLyrics{41}{ctus}\
\\\mtxSetLyrics{51}{San-}\
\\\mtxSetLyrics{61}{San-}\
\\\mtxSetLyrics{71}{San-}\
\\\mtxSetLyrics{81}{San-}\
\\\mtxSetLyrics{91}{San-}\
\\\mtxAssignLyrics{13}{51}\
\\\mtxAssignLyrics{12}{61}\
\\\mtxAssignLyrics{11}{71}\
\\\mtxAssignLyrics{10}{81}\
\\\mtxAssignLyrics{9}{91}\
c23 d2 g0- /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
r9 /
XS8 r0 r2 \mtxBM\ b44 a4 /
XS8 r0 r2 \\\mtxLyricsAdjust{10}{2}\ \mtxBM\ g43 f4 /
XS8 r0 \mtxBM\ b44 a4 g4 [ a8 b8 ] /
XS4 r2 \mtxBM\ d45 c4 b4 c4 \mtxEM\ d2  /
XS8 r0 \mtxBM\ d45 c4 b4 [ c8 d8 ] /
c23 \mtxEM\ d2  g0- /
c45d ba8 a4 d4 d0 /
[ e85 f8 ] g2 \mtxEM\ f4s  g0 /
\mtxEM\ a04  b0 /

% Paragraph 9 line 241 bar 7
\\\mtxSetLyrics{51}{ctus San-}\
\\\mtxSetLyrics{61}{ctus}\
\\\mtxSetLyrics{71}{ctus}\
\\\mtxSetLyrics{81}{ctus, San-ctus}\
\\\mtxSetLyrics{91}{ctus}\
\\\mtxSetLyrics{101}{San-}\
\\\mtxSetLyrics{111}{San-ctus}\
\\\mtxSetLyrics{121}{San-}\
\\\mtxSetLyrics{131}{San-}\
\\\mtxSetLyrics{141}{San-}\
\\\mtxSetLyrics{151}{San-}\
\\\mtxAssignLyrics{17}{}\
\\\mtxAssignLyrics{16}{}\
\\\mtxAssignLyrics{15}{}\
\\\mtxAssignLyrics{14}{}\
\\\mtxAssignLyrics{8}{101}\
\\\mtxAssignLyrics{7}{111}\
\\\mtxAssignLyrics{6}{121}\
\\\mtxAssignLyrics{5}{131}\
\\\mtxAssignLyrics{4}{141}\
\\\mtxAssignLyrics{3}{151}\
c23 a2 d2 g2- /
r9 /
XS8 r0 \mtxBM\ d45 c4 b4 [ c8 d8 ] /
XS8 r0 \mtxBM\ f45d e8 d4 [ e8 f8 ] /
XS3 r2 \mtxBM\ c45 b4 a4 [ b8 c8 

Re: [Tex-music] musixflx in Lua

2011-04-11 Thread Bob Tennent
 |Possibly, but if two scripts were being maintained then I'd maintain
 |that identical output is the more critical thing to have (and, yes, in
 |the 16th decimal place - no optimising compiler re-orders floating point
 |instructions without being told that unsafe optimisations are allowed
 |precisely because the results can differ, the same algorithm over the
 |same precision of floating point representation should produce *exactly*
 |the same output regardless of language)

David: I'm pleased to report that after replacing Nikhil's own
formatting function (which truncated decimal parts rather than
rounding!) by

string.format(%.., ...)

I'm getting exact matches with musixflx.c output. It seems Nikhil
didn't find the string.format( ) function in the manual :+)

Bob
---
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