Re: [Tex-music] musixflx in Lua
On Sun, Apr 10, 2011 at 12:55:58PM +0200, David Allsopp wrote: > 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). See Remark 1 below. >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). See Remark 2 below. > Are there options available for producing native executables from Lua scripts > on at least the major three platforms? If there are, then it would seem an > excellent time to look towards dumping the C script entirely - the ability to > produce a native executable would mean that anyone using MusiXTeX on a system > which doesn't have LuaTeX instead would not have to install a Lua interpreter > so it wouldn't make the installation of LuaTeX any harder. See Remark 3 below. 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. 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. 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. 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. 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] musixflx in Lua
>|> 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. 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 :+) The differences are of no practical significance. What I'm looking for are significant differences, such as the lua script crashing because of a typo. >|Most of the work I do involves a lot of regression tests against >|reference copies of known output so I'm always particularly sensitive >|to statements about rounding "errors" ;o) The script was produced by a line-by-line translation of the C code. It doesn't use different calculational algorithms. >|Are there options available for producing native executables from Lua >|scripts on at least the major three platforms? If there are, then it >|would seem an excellent time to look towards dumping the C script >|entirely - the ability to produce a native executable would mean that >|anyone using MusiXTeX on a system which doesn't have LuaTeX instead >|would not have to install a Lua interpreter so it wouldn't make the >|installation of LuaTeX any harder. ^^ I'm guessing you meant to write MusiXTeX there. That would simply perpetuate the maintainance problems of requiring platform-dependent executables. I think it would be much better to incorporate the musixflx calculations into musixtex.tex and make LuaTeX a requirement for MusiXTeX. 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
Re: [Tex-music] musixflx in Lua
>|i had, in fact, vaguely thought of making musixflx into a separate ctan >|package (it's already separate from musixtex in the distributions, >|brought in by their "requirement" directives[*]). >| >|doing that would involve breaking your structure, but i think it would >|add clarity to the distribution, and would also allow mirrored >|distribution of this excellent script. I combined musixflx and musixtex into a single package because the former is *essential* to the proper use of the latter; also there is a version compatibilty issue. Ultimately, the musixflx code should be incorporated into musixtex, so it seems premature to separate them now. 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
Re: [Tex-music] musixflx in Lua
Bob Tennent wrote: > Last November, Dirk Laurie suggested that we should be porting the M- > Tx/PMX/musixtex/musixflx toolchain to LuaTeX. I won't review his arguments > here, but I'm pleased to report that Nikhil Helferty, a student here, has > successfully converted musixflx.c (version 0.83.3) to musixflx.lua > (version 0.83.3.luaN, currently N=1). This is indeed excellent news! > 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). 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). Most of the work I do involves a lot of regression tests against reference copies of known output so I'm always particularly sensitive to statements about rounding "errors" ;o) > It's been tested on hundreds of examples but there may be bugs lurking in > rarely-exercised parts of the code so please test it on your most complex > and unusual scores, and report problems to me (attach problematic .mx1 > files). > > Usage: > > musixflx.lua is a lua script and so is used essentially as follows: > > lua musixflx.lua basename > > This requires a lua interpreter; for example, from here: Are there options available for producing native executables from Lua scripts on at least the major three platforms? If there are, then it would seem an excellent time to look towards dumping the C script entirely - the ability to produce a native executable would mean that anyone using MusiXTeX on a system which doesn't have LuaTeX instead would not have to install a Lua interpreter so it wouldn't make the installation of LuaTeX any harder. 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
Bob Tennent wrote: > Last November, Dirk Laurie suggested that we should be porting the > M-Tx/PMX/musixtex/musixflx toolchain to LuaTeX. I won't review his > arguments here, but I'm pleased to report that Nikhil Helferty, a > student here, has successfully converted musixflx.c (version 0.83.3) to > musixflx.lua (version 0.83.3.luaN, currently N=1). This is available by > anonymous ftp from here: this is great news -- kudos to that student! i did preliminary poking around towards a port to perl, but real life intervened (it's as well the world isn't made up of robins). i had, in fact, vaguely thought of making musixflx into a separate ctan package (it's already separate from musixtex in the distributions, brought in by their "requirement" directives[*]). doing that would involve breaking your structure, but i think it would add clarity to the distribution, and would also allow mirrored distribution of this excellent script. robin --- 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] Swing
Here is another way of achieving it (with PSTricks): --- \input pstricks\relax \input pst-node\relax \input musixtex\relax \input musixlyr\relax \setlyrics{solo}{% No-bo-dy knows the trou-ble I see No-bo-dy knows my sor-row} \assignlyrics{1}{solo} \setsongraise{1}{2\internote} \forcelyrhyphenstrue --- 1 1 4 4 0 6 0 1 1 1 20 0 t ./ \\def\rythm{\ \\loffset{2}{\zcharnote{12}{\vbox to0pt{\vss\hbox{\kern-3pt\smallnotesize\ibu010\zqb01\off{15pt}\ \\tbu0\zqb01\kern9pt=\kern3pt\rlap{\ \\zcharnote{8}{\kern.8pt\roffset{.8}{\pnode(0,0){A}}\ \\roffset{.4}{\pnode(20pt,0\internote){B}}\ \\ncdiag[arm=4pt,angleA=90,angleB=90,linewidth=.4pt]{A}{B}\lput*{0}{{\eightit 3}}}\ \\smallnotesize\zqu 1}\kern18pt\smallnotesize\zcu 1}\ w170m Abrp % \rythm\ b84a d-a ea \beginmel\ ga st \endmel\ g4d st a8a / b8a ba ba \beginmel\ ba st \endmel\ b4 st r4 / b8a d-a ea \beginmel\ ga st \endmel\ g4d st g8a / e8a \beginmel\ d8a st d4 st st \endmel\ d4 st r4 / Olivier --- 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] Swing
Jill-Jênn VIE wrote: > Is there a way in PMX (or, I bet, rather MusiXTeX) to put the well-known > swing tempo indication: > http://totalguitarist.com/lessons/reading/notation/guide/notes-and- > rhythm/swung-8th-notes.gif ? Afraid I don't quite have enough time this morning to try it myself, but in principle: * Typeset the symbol itself inside \startextract on a stave with no lines (as just a simple pair of beamed quavers and a triplet all on the same note - the equals will have to be a text insert with some spacing) * Put this inside \setbox0=\hbox{...} to store it for later use * When you want the symbol, use \zcharnote{pitch}{\box0} within your actual score If you want to use the symbol more than once, use \newbox\swingbox and then \setbox\swingbox=... and then later on \copy\swingbox instead of \box0. And obviously if you want to use the symbol in more than one score, package it up in a macro! It doesn't look to me like something which should need an additional package. HTH, 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] Swing
I think I can do what you want in MusiXTeX with the ossia philosophy. I used the tuplet package, but it seems if I want to shorten the tuplet length the gap which accomodates the '3' diseappears. Regards, Jean-Pierre Coulon cou...@obs-nice.fr\input musixtex \input tuplet \instrumentnumber1 \setstaffs1{2} % \nobarmessages\nolinemessages% \nobarnumbers \newbox\myossia \setbox\myossia=\hbox to 0pt{\kern-2.3mm\vbox{\hsize=22mm% \nostartrule% \def\tuplettxt{\smalltype\it3\/\/} \smallmusicsize\setsize1{\smallvalue}% \setclefsymbol1\empty% \generalsignature0\generalmeter{\empty}\nobarnumbers\setstaffs11% \setlines10 \setclef1\treble% \parindent=0mm% \setclefsymbol1\empty \startextract% \znotes\ibu1g0\qb1g\en% \hardspace{5.4mm}% \znotes\tqh1g\en% \hardspace{4mm}% \znotes\zcharnote h{=}\en \hardspace{4mm}% \NOTes\uptuplet q{1.2}0\qu g\en %\hardspace{6mm}% \znotes\cu g\en \zendextract}\hss} \setstaffs12 \parindent=0mm \generalmeter{\meterC} \generalsignature1 \startbarno1 \setclef1{\bass\treble} %\setname1{N$^o$2} \interstaff{10} \nobarnumbers \startpiece% \znotes|\zcharnote n{\box\myossia}\en \qspace% \Notes\cl N\ds\zq d\cl b\ds|\hpause\en \Notes\cl N\ds|\qp\en \Notes\zq d\cl b|\ibl2q{-1}\qbp2r\en \notes\ds|\qsk\tbbl2\tqb2{^q}\en \bar% 2 \Notes\cl N\ds\zq d\cl b\ds|\cl s\ds\cl r\ds\en \Notes\cl N\ds\zq d\cl b\ds|\cl{^o}\ds\cl p\ds\en \bar% 3 \Notes\cl N\ds\zq d\cl b\ds|\hl n\en \Notes\cl N|\ibl2k0\qbp2k\en \notes\ds|\qsk\tbbl2\qb2k\en \Notes\zq d\cl b|\qbp2p\en \notes\ds|\qsk\tbbl2\tqb2o\en \bar% 4 \Notes\cl N|\ibl2m1\isluru3m\qbp2m\en \notes\ds|\qsk\tbbl2\tslur3n\qb2n\en \Notes\zq d\cl b|\qbp2r\en \notes\ds|\qsk\tbbl2\tqb2q\en \Notes\cl N|\ibl2o1\isluru3o\qbp2o\en \notes\ds|\qsk\tbbl2\tslur3p\qb2p\en \Notes\zq d\cl b|\qbp2u\en \notes\ds|\qsk\tbbl2\tqb2t\en \Stoppiece \eject \end --- 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] Swing
Hi, Is there a way in PMX (or, I bet, rather MusiXTeX) to put the well-known swing tempo indication: http://totalguitarist.com/lessons/reading/notation/guide/notes-and-rhythm/swung-8th-notes.gif ? Else, I will just let “Swing”, but people might not understand. Thanks in advance. -- Jill-Jênn http://www.jill-jenn.net --- 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