"; wc = window.open("","nocren","width=700,height=600,left=250,top=200") wc.document.write(html); wc.document.close(); } function startup() { document.penta.DeBugging.checked=false; var dloc = document.location.toString(); var DeBugging = document.getElementById("DeBugging") if (dloc.slice(0,4) != "file") { DeBugging.style.visibility = 'hidden'; } } function noteTable(thisLine) { if (thisLine == "--") { this.dur = Number.POSITIVE_INFINITY this.begPos = Number.POSITIVE_INFINITY; this.endPos = Number.POSITIVE_INFINITY; } else { this.dur = 0; this.begPos = sumMeasure * 50000 + sumBatch; result=thisLine.match(/Dur:([^\|]*)/); if ((result != null) && (thisLine.indexOf("Grace") == -1)) { // Has duration but is not grace. var durVal = result[1]; var durLen = getNoteLength(durVal); this.dur = durLen; if (durLen == -1) { alert("Illegal length: " + thisLine); return 1; } else { sumBatch += durLen; } // Keeping a running total of note durations in 768th notes } // End of object with "Dur:" not a grace note else { if (thisLine.slice(0,4) == "|Bar") { sumBatch=0; sumMeasure++; } } this.endPos = 50000 * sumMeasure + sumBatch; } } function doMove() { var result=new Array(), lineCarr=new Array(), lineLarr=new Array(); var iL=0,iC=0; var cookieRet = getCookie("WPGuiChord"); crumbs = cookieRet.split("|"); if ((crumbs != null) && (crumbs.length > 7)) PosLoc = Number(crumbs[8]); else PosLoc = Number(prompt("Guitar cookie missing, need location of chord text",10)); tempField=document.penta.IOField.value; tempField=tempField.replace(/\r/g,""); var lineL=tempField.split("\n"); // A line with the melody and Lyrics tempField=document.penta.IOChords.value; tempField=tempField.replace(/\r/g,""); var lineC=tempField.split("\n"); // A line with the guitar Chords sumMeasure = 0, sumBatch = 0; for (var iC=0; iC < lineC.length; iC++) { // Initial processing loop on chord staff. lineCarr[iC] = new noteTable(lineC[iC]); } //End of initial processing of chord staff. sumMeasure = 0, sumBatch = 0; for (var iL=0; iL < lineL.length; iL++) { // Initial processing loop on lyric staff. lineLarr[iL] = new noteTable(lineL[iL]); } //End of initial processing of lyric staff. lineLarr[iL] = new noteTable("--"); // Prevents crash if there are fewer notes on the lyric staff. iL = 1; // Will be advanced by a 'while' command for (iC=1; iC < lineC.length; iC++) { //First line is NWC header result = lineC[iC].match(/\|Text\|Text.*Pos:(\d+)/) if ((result != null) && (PosLoc == Number(result[1]))) { // Checking duration prevents insertion in front of clef, signature, dynamic, etc. while ((lineLarr[iL].begPos < lineCarr[iC].begPos) || (lineLarr[iL].dur == 0)) iL++; if (lineLarr[iL].begPos == Number.POSITIVE_INFINITY) { alert("No place to move final chord(s)"); return 1; } lineL[iL-1] += "\r\n" + lineC[iC]; // Append chord text to end of previous line lineC[iC] = "#"; } } // Change chord text to comment on chord line document.penta.IOField.value=""; for (i=0; i < lineL.length; i++) { document.penta.IOField.value+= lineL[i]; if ((i + 1) < lineL.length) document.penta.IOField.value+= "\r\n"; } document.penta.IOField.select(); document.penta.IOChords.value=""; for (i=0; i < lineC.length; i++) { document.penta.IOChords.value+= lineC[i]; if ((i + 1) < lineC.length) document.penta.IOChords.value+= "\r\n"; } return 0; }

Move Chord Names

 

       Save your file first!!

Cut Section of NWC lyric staff into here.

 

Cut Section of NWC guitar chord staff into here.     

 

 

This Web Page Created with PageBreeze Free HTML Editor

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License 2013 by Warren Porter