1 Gˆl–ß=¿J å2ÛB‚„ _¸\iÕ1hß’þH7l­M ÒK´ÞÍ_ó¿ÆÅÄ ƒ_‹I|¥Žƒî4ÃVŸÃ‹ÅVßoÛ6~÷_Áñ¡ EnÝ> õ²"Àì­fs€ hƒ‘)›©,j$•Äò¿ï(þ%;-X‰÷Ýñî¾ï.z mKq‡.�d7\2‚Í;N¦£Ñ×î8 'éÁÏ£äšÍyÉV‡*ˆGg=ƒÅ²'®´»S‹’ŒnNŒÏ©MâÜjªw>»{Á«(Æ$3Ö´á²¢{Ö³º³Aô·qô|G¹�N•bRGÞföÈØð¢ˆ}ï™Òçæð¨·ïbظQr¬vT²q%6ì^�ƒãø®áåfœ‹JiZéÀÂb¹þùã|¾þ}¶Z]þ2‹Rz— lîæ«_ÿ\^¯ÖW]ë��*ÓO;ûb¹üc=_€±hª\sQù#’ F†&ÝÈ apxöT èEo™žó'€0E\[­_!$"mí%3ÜP¹mö jÉà}«w)DV¦©{D—RÒi‘?¡7èƒu:‡Ç÷èu’¢õgv蛩}ú±µÛ—³3{jã}jíàx_ÙžÞNõ<‚_–3 #“ŒÖuy ‚oÐë}rUÜfÐýœjbÂ&ÉÔù®Xp6Ó“)P©)Ü0�/ñW'º¸¸€\Ž-mÉ3)…$x!º�…hª %ct†~[-™Ò’W[^Ú+’P�#Å{5£QLÉU˳™¢>)¦l®’FbéÊ鯖tžI×ó6‘xf#XŠp£‹p’A{âò>VQ.ö5ÌÁª-Wšë†–),’šåšmìmöÔðÚ>D1=lþ1²š¢Ec¤fF‹xDêât¥ÐwÀVÕ”%zõ ù÷Ád½ÈåMeˆ¯Ž(»'2˜QZ—ex{¡×\ïf$Õ‘X·{z8Síð@â�ðaL +Vð :ô¡o|ï§Ý7Êçfès{óÄ-“þ-“/Ý21·àÀË#Ufù  Þ 6ÅŒæ;Z@TÿS|›¹¶ïi×#âm6g^Õ-½=:'Ài÷©Ø!1ƒ|j`\=Ï @³ ݹ–‡�L¤Q ˆ´y¥È VkúP3Q s1]Ä¡�8‰"ŸÐ›×Á€Ì3Çèc¿ºúÑ¡78EwЫ­Ð¨ËpW Q¬û‹À9ßÁìÇ ØeÐo]Lú©dY<<¦�e{¦ݲtÐŽ(5»gü{ˆ5Tì`£9Ó#UŸÔà ”FË¥'°8æ‘ÎN·0 e…ÒØ~FÍ¢�ƒøaW :ðµÍižíFúÒÂ9±d`..ÃÎýö«ÂÏ¢†|ƒ-]ð¿m—°B÷†{àXyÖýIü'ºû"øš¸`]h袭»÷AÿÐ\b>NEɲRl ¾6N]= qìlJN|ߣBŠ=ÂÙ¸ ŸÙ¹© Oÿƒb \¦ 6 ˆl–ß=¿J2/”ŠmA ã/Üm¥1hß�þC ^Y±<Ëí¶ÜƒÀþÁ ƒu¦žÆÄà #! /usr/bin/env texlua -- -- global constants -- VERSION = "0.9.3" FILE_SUFFIX = "_chtr" PMX_CMD = "pmxab" --[[ pmxchords.lua: transpose chords (\ch.C.\) and process pmxab (c) Copyright 2013 Ondrej Fafejta https://github.com/fafejtao/pmxChords This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --]] --[[ ChangeLog: version 0.9.3 2014-04-21 - fixed transposition problem: If song began in E-minor and signature is changed in half of song to A-minor transposition must be omitted. version 0.9.2 2013-12-13 - fixed: stop processing when pmxab fail. - When pmxab is called generated file pmxaerr.dat is not removed. version 0.9.1 2013-12-09 - added some options. Improved processing. version 0.9 2013-12-05 - rewritted code from perl to lua... --]] function usage() print("Usage: [texlua] pmxchords.lua basename[.pmx] ") print(" 1. transpose chords into new file basename" .. FILE_SUFFIX .. ".pmx") print(" 2. call pmxab on transposed file basename" .. FILE_SUFFIX .. ".pmx") print(" 3. rename basename" .. FILE_SUFFIX .. ".tex to basename.tex") print("options: -v version") print(" -h help") print(" -s stop after fist step. e.g. generate only transposed basename" .. FILE_SUFFIX .. ".pmx file") end function whoami() print("This is pmxchords.lua version " .. VERSION) end whoami() if #arg == 0 then usage() os.exit(0) end kpse.set_program_name("luatex") require"ChordsTr" function parseInputSignature(line) -- parse input signature from pmx digits line. Only one line digits format is supported! -- e.g. -- 1 1 2 4 2 4 0 -1 -- signature is -1 : F major local res = string.match(line, "^%s*[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+([%+%-]?[0-9]+)%s*$") return tonumber(res) end function parseOutputSignature(line) -- parse output signature from pmx -- e.g. -- K-2+2 -- output signature is +2 : D major local res = string.match(line, "^K[%+%-]?[0-9]+([%+%-]?[0-9]+)") return tonumber(res) end -- -- Strip comments fr