From 9518a8dfca8ff9e247a4373331fc403419949803 Mon Sep 17 00:00:00 2001 From: "Son A. Pham" Date: Tue, 16 Apr 2024 18:41:04 -0700 Subject: [PATCH] Add option to display text description --- index.html | 15 +++++++++--- js/groove_display_utils.min.js | 2 +- render.html | 42 ++++++++++++++++++++++++++++++---- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 7e6f723..d41bedf 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,8 @@ } input#url, - input#convertedUrl { + input#convertedUrl, + input#text { width: 70%; } @@ -30,10 +31,12 @@

Tool for converting a GrooveScribe drum notation for embedding in URL:

+ +



-

+

@@ -67,14 +70,20 @@

Tool for converting a GrooveScribe drum notation for embedding in 0) { + convertedUrl += "&text=" + text; + } + const convertedUrlElement = document.getElementById("convertedUrl"); convertedUrlElement.value = convertedUrl; convertedUrlElement.select(); diff --git a/js/groove_display_utils.min.js b/js/groove_display_utils.min.js index ad0f390..f0d213d 100644 --- a/js/groove_display_utils.min.js +++ b/js/groove_display_utils.min.js @@ -1 +1 @@ -if(void 0===e){var e={};!function(){"use strict";var t,n,a,o=e;o.filesadded="",o.getLocalScriptRoot=(a=(n=(t=document.getElementsByTagName("script"))[t.length-1]).src.lastIndexOf("/"),n.rootSrc=n.src.slice(0,a+1),function(){return n.rootSrc}),o.GrooveDisplayUniqueCounter=1,o.GrooveDBFormatPutGrooveInHTMLElement=function(e,t){var n=new GrooveUtils,a=new n.grooveDataNew,r=n.mergeDrumTabLines(t.snareAccentTab,t.snareOtherTab),s=n.mergeDrumTabLines(t.kickTab,t.footOtherTab);if(void 0===t.div||isNaN(t.div)||(a.timeDivision=t.div),void 0===t.tempo||isNaN(t.tempo)||(a.tempo=t.tempo),void 0===t.swingPercent||isNaN(t.swingPercent)||(a.swingPercent=t.swingPercent),void 0===t.measures||isNaN(t.measures)||(a.numberOfMeasures=t.measures),void 0===t.notesPerTabMeasure||isNaN(t.notesPerTabMeasure)||(a.notesPerMeasure=t.notesPerTabMeasure),void 0!==t.stickingTab&&(a.sticking_array=n.noteArraysFromURLData("Stickings",t.stickingTab,t.notesPerTabMeasure,t.measures)),void 0!==t.hihatTab&&(a.hh_array=n.noteArraysFromURLData("H",t.hihatTab,t.notesPerTabMeasure,t.measures)),a.snare_array=n.noteArraysFromURLData("S",r,t.notesPerTabMeasure,t.measures),a.kick_array=n.noteArraysFromURLData("K",s,t.notesPerTabMeasure,t.measures),void 0!==t.tom1Tab&&(a.toms_array[0]=n.noteArraysFromURLData("T1",t.tom1Tab,t.notesPerTabMeasure,t.measures)),void 0!==t.tom4Tab&&(a.toms_array[3]=n.noteArraysFromURLData("T4",t.tom4Tab,t.notesPerTabMeasure,t.measures)),void 0!==t.timeSignature){var i=function e(t){var n=4,a=4;if(t){var o=t.split("/");2==o.length&&(n=Math.ceil(o[0]),a=Math.ceil(o[1]))}return[n,a]}(t.timeSignature);a.numBeats=i[0],a.noteValue=i[1]}var l="svgTarget"+o.GrooveDisplayUniqueCounter,c="midiPlayerTarget"+o.GrooveDisplayUniqueCounter;document.getElementById(e).innerHTML='
\n
\n';var m=document.getElementById(l),u=m.offsetWidth-100,d=n.createABCFromGrooveData(a,u),g=n.renderABCtoSVG(d);m.innerHTML=g.svg,n.setGrooveData(a),n.AddMidiPlayerToPage(c,a.notesPerMeasure,!0),n.expandOrRetractMIDI_playback(!0,!1),n.setTempo(a.tempo),n.setSwing(a.swingPercent),n.oneTimeInitializeMidi(),o.GrooveDisplayUniqueCounter++},o.GrooveDBFormatPutGrooveOnPage=function(e){o.GrooveDisplayUniqueCounter++;var t="GrooveDisplay"+o.GrooveDisplayUniqueCounter;document.write(''),window.addEventListener("load",function(){o.GrooveDBFormatPutGrooveInHTMLElement(t,e)},!1)},o.AddGrooveDisplayToElementId=function(e,t,n,a,r){var s=new GrooveUtils;o.GrooveDisplayUniqueCounter++;var i="svgTarget"+o.GrooveDisplayUniqueCounter,l="midiPlayerTarget"+o.GrooveDisplayUniqueCounter;document.getElementById(e).innerHTML='
\n
\n';var c,m,u,d,g=s.getGrooveDataFromUrlString(t);c=document.getElementById("tempoTimeSig"),g.embedTempoTimeSig&&(c.innerHTML="♩ = "+g.tempo+"    "+g.numBeats+"/"+g.noteValue),m=document.getElementById(i),u=s.createABCFromGrooveData(g,600),d=s.renderABCtoSVG(u),a?m.innerHTML='
'+d.svg+"":m.innerHTML=d.svg,n&&(s.setGrooveData(g),s.AddMidiPlayerToPage(l,g.notesPerMeasure,!0),s.expandOrRetractMIDI_playback(!0,r),s.setTempo(g.tempo),s.setSwing(g.swingPercent),s.setMetronomeFrequencyDisplay(g.metronomeFrequency),s.oneTimeInitializeMidi())},o.AddGrooveDisplayToPage=function(e,t,n,a){o.GrooveDisplayUniqueCounter++;var r="GrooveDisplay"+o.GrooveDisplayUniqueCounter,s=document.createElement("div");s.class="GrooveDisplay",s.id=r,document.getElementsByTagName("body")[0].appendChild(s),window.addEventListener("load",function(){o.AddGrooveDisplayToElementId(r,e,t,n,a)},!1)}}()}var global_num_GrooveUtilsCreated=0,global_grooveUtilsScriptSrc="";document.currentScript&&(global_grooveUtilsScriptSrc=document.currentScript.src);var global_midiInitialized=!1,constant_MAX_MEASURES=10,constant_DEFAULT_TEMPO=80,constant_ABC_STICK_R='"R"x',constant_ABC_STICK_L='"L"x',constant_ABC_STICK_BOTH='"R/L"x',constant_ABC_STICK_COUNT='"count"x',constant_ABC_STICK_OFF='""x',constant_ABC_HH_Ride="^A'",constant_ABC_HH_Ride_Bell="^B'",constant_ABC_HH_Cow_Bell="^D'",constant_ABC_HH_Crash="^c'",constant_ABC_HH_Stacker="^d'",constant_ABC_HH_Metronome_Normal="^e'",constant_ABC_HH_Metronome_Accent="^f'",constant_ABC_HH_Open="!open!^g",constant_ABC_HH_Close="!plus!^g",constant_ABC_HH_Accent="!accent!^g",constant_ABC_HH_Normal="^g",constant_ABC_SN_Ghost="!(.!!).!c",constant_ABC_SN_Accent="!accent!c",constant_ABC_SN_Normal="c",constant_ABC_SN_XStick="^c",constant_ABC_SN_Buzz="!///!c",constant_ABC_SN_Flam="!accent!{/c}c",constant_ABC_SN_Drag="{/cc}c",constant_ABC_KI_SandK="[F^d,]",constant_ABC_KI_Splash="^d,",constant_ABC_KI_Normal="F",constant_ABC_T1_Normal="e",constant_ABC_T2_Normal="d",constant_ABC_T3_Normal="B",constant_ABC_T4_Normal="A",constant_NUMBER_OF_TOMS=4,constant_ABC_OFF=!1,constant_OUR_MIDI_VELOCITY_NORMAL=85,constant_OUR_MIDI_VELOCITY_ACCENT=120,constant_OUR_MIDI_VELOCITY_GHOST=50,constant_OUR_MIDI_METRONOME_1=76,constant_OUR_MIDI_METRONOME_NORMAL=77,constant_OUR_MIDI_HIHAT_NORMAL=42,constant_OUR_MIDI_HIHAT_OPEN=46,constant_OUR_MIDI_HIHAT_ACCENT=108,constant_OUR_MIDI_HIHAT_CRASH=49,constant_OUR_MIDI_HIHAT_STACKER=52,constant_OUR_MIDI_HIHAT_METRONOME_NORMAL=77,constant_OUR_MIDI_HIHAT_METRONOME_ACCENT=76,constant_OUR_MIDI_HIHAT_RIDE=51,constant_OUR_MIDI_HIHAT_RIDE_BELL=53,constant_OUR_MIDI_HIHAT_COW_BELL=105,constant_OUR_MIDI_HIHAT_FOOT=44,constant_OUR_MIDI_SNARE_NORMAL=38,constant_OUR_MIDI_SNARE_ACCENT=22,constant_OUR_MIDI_SNARE_GHOST=21,constant_OUR_MIDI_SNARE_XSTICK=37,constant_OUR_MIDI_SNARE_BUZZ=104,constant_OUR_MIDI_SNARE_FLAM=107,constant_OUR_MIDI_SNARE_DRAG=103,constant_OUR_MIDI_KICK_NORMAL=35,constant_OUR_MIDI_TOM1_NORMAL=48,constant_OUR_MIDI_TOM2_NORMAL=47,constant_OUR_MIDI_TOM3_NORMAL=45,constant_OUR_MIDI_TOM4_NORMAL=43,global_current_midi_start_time=0,global_last_midi_update_time=0,global_total_midi_play_time_msecs=0,global_total_midi_notes=0,global_total_midi_repeats=0;function GrooveUtils(){"use strict";global_num_GrooveUtilsCreated++;var e=this;e.abc_obj=null,e.note_mapping_array=null,e.debugMode=!1,e.viewMode=!0,e.grooveDBAuthoring=!1,e.isMIDIPaused=!1,e.shouldMIDIRepeat=!0,e.swingIsEnabled=!1,e.grooveUtilsUniqueIndex=global_num_GrooveUtilsCreated,e.metronomeSolo=!1,e.metronomeOffsetClickStart="1",e.metronomeOffsetClickStartRotation=0,e.isLegendVisable=!1,e.noteCallback=null,e.playEventCallback=null,e.repeatCallback=null,e.tempoChangeCallback=null;var t=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1];function n(e,t){switch(t){case"b":case"B":if("Stickings"==e)return constant_ABC_STICK_BOTH;if("H"==e)return constant_ABC_HH_Ride_Bell;if("S"==e)return constant_ABC_SN_Buzz;break;case"c":if("Stickings"==e)return constant_ABC_STICK_COUNT;if("H"==e)return constant_ABC_HH_Crash;break;case"d":if("S"==e)return constant_ABC_SN_Drag;break;case"f":if("S"==e)return constant_ABC_SN_Flam;break;case"g":if("S"==e)return constant_ABC_SN_Ghost;break;case"l":case"L":if("Stickings"==e)return constant_ABC_STICK_L;break;case"m":if("H"==e)return constant_ABC_HH_Cow_Bell;break;case"n":if("H"==e)return constant_ABC_HH_Metronome_Normal;break;case"N":if("H"==e)return constant_ABC_HH_Metronome_Accent;break;case"O":if("S"==e)return constant_ABC_SN_Accent;break;case"o":switch(e){case"H":return constant_ABC_HH_Open;case"S":return constant_ABC_SN_Normal;case"K":case"B":return constant_ABC_KI_Normal;case"T1":return constant_ABC_T1_Normal;case"T2":return constant_ABC_T2_Normal;case"T3":return constant_ABC_T3_Normal;case"T4":return constant_ABC_T4_Normal}break;case"r":case"R":switch(e){case"H":return constant_ABC_HH_Ride;case"Stickings":return constant_ABC_STICK_R}break;case"s":if("H"==e)return constant_ABC_HH_Stacker;break;case"x":switch(e){case"S":return constant_ABC_SN_XStick;case"K":case"B":return constant_ABC_KI_Splash;case"H":return constant_ABC_HH_Normal;case"T1":return constant_ABC_T1_Normal;case"T4":return constant_ABC_T4_Normal}break;case"X":switch(e){case"K":return constant_ABC_KI_SandK;case"H":return constant_ABC_HH_Accent}break;case"+":if("H"==e)return constant_ABC_HH_Close;break;case"-":return!1}return console.log("Bad tablature note found in tablatureToABCNotationPerNote. Tab: "+t+" for drum type: "+e),!1}function a(e,t){var n="-";switch(t){case constant_ABC_STICK_R:n="R";break;case constant_ABC_STICK_L:n="L";break;case constant_ABC_STICK_BOTH:n="B";break;case constant_ABC_STICK_OFF:n="-";break;case constant_ABC_STICK_COUNT:n="c";break;case constant_ABC_HH_Ride:n="r";break;case constant_ABC_HH_Ride_Bell:n="b";break;case constant_ABC_HH_Cow_Bell:n="m";break;case constant_ABC_HH_Crash:n="c";break;case constant_ABC_HH_Stacker:n="s";break;case constant_ABC_HH_Metronome_Normal:n="n";break;case constant_ABC_HH_Metronome_Accent:n="N";break;case constant_ABC_HH_Open:n="o";break;case constant_ABC_HH_Close:n="+";break;case constant_ABC_SN_Accent:n="O";break;case constant_ABC_SN_Buzz:n="b";break;case constant_ABC_HH_Normal:case constant_ABC_SN_XStick:n="x";break;case constant_ABC_SN_Ghost:n="g";break;case constant_ABC_SN_Normal:case constant_ABC_KI_Normal:case constant_ABC_T1_Normal:case constant_ABC_T2_Normal:case constant_ABC_T3_Normal:case constant_ABC_T4_Normal:n="o";break;case constant_ABC_SN_Flam:n="f";break;case constant_ABC_SN_Drag:n="d";break;case constant_ABC_HH_Accent:case constant_ABC_KI_SandK:n="X";break;case constant_ABC_KI_Splash:n="x";break;case constant_ABC_OFF:n="-";break;default:console.log("bad case in abcNotationToTablaturePerNote: "+t)}return n}function o(e,t){var n=!1,a=e.notes1.lastIndexOf(t);return(a>-1&&(n=!0,e.notes1=e.notes1.replace(t,"")),(a=e.notes2.lastIndexOf(t))>-1&&(n=!0,e.notes2=e.notes2.replace(t,"")),(a=e.notes3.lastIndexOf(t))>-1&&(n=!0,e.notes3=e.notes3.replace(t,"")),n)?t:""}function r(e,t,n){for(var a=0;a1?(i+=o(l,"!accent!"),o(l,"!accent!"),i+=o(l,"!plus!"),i+=o(l,"!open!"),i+=o(l,"!///!"),o(l,"["),o(l,"]"),i+=o(l,"{/c}"),i+=o(l,"{/cc}"),i+="["+l.notes1+l.notes2+l.notes3+"]"):i+=l.notes1+l.notes2+l.notes3,i}function i(e,t,n,a,o){var s="";if(r(e,t,!1)){for(var i=1,l=t+1;l0?(e="Edge",t=n.substr(n.lastIndexOf("Edge/")+5,4)):n.lastIndexOf("Chrome/")>0?(e="Chrome",t=n.substr(n.lastIndexOf("Chrome/")+7,4)):n.lastIndexOf("Firefox/")>0?(e="Firefox",t=n.substr(n.lastIndexOf("Firefox/")+8,5)):n.lastIndexOf("Safari/")>0?(e="Safari",t=n.substr(n.lastIndexOf("Safari/")+7,6)):n.lastIndexOf("Trident/")>0?(e="MSIE",t=n.substr(n.lastIndexOf("rv:")+3,4)):console.log("undefined browser");break;case"Opera":t=n.substr(n.lastIndexOf("Version/")+8,5)}var a="windows";return n.lastIndexOf("iPhone")>0?a="iOS":n.lastIndexOf("iPad")>0?a="iOS":n.lastIndexOf("Android")>0?a="android":n.lastIndexOf("Macintosh")>0&&(a="mac"),{browser:e,version:t,platform:a,uastring:n}},e.is_touch_device=function(){return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0},e.calc_notes_per_measure=function(e,t,n){return e/n*t},e.documentOnClickHanderCloseContextMenu=function(t){e.visible_context_menu&&e.hideContextMenu(e.visible_context_menu)},e.showContextMenu=function(t){e.visible_context_menu&&e.hideContextMenu(e.visible_context_menu),t.style.display="block",e.visible_context_menu=t,t.offsetTop+t.clientHeight>document.documentElement.clientHeight&&(t.style.top=document.documentElement.clientHeight-t.clientHeight+"px"),setTimeout(function(){document.onclick=e.documentOnClickHanderCloseContextMenu,document.body.style.cursor="pointer"},100)},e.hideContextMenu=function(t){document.onclick=!1,document.body.style.cursor="auto",t&&(t.style.display="none"),e.visible_context_menu=!1},e.isTripletDivision=function(e){return e%12==0},e.isTripletDivisionFromNotesPerMeasure=function(t,n,a){return e.isTripletDivision(t/n*a)},e.getMetronomeSolo=function(){return e.metronomeSolo},e.setMetronomeSolo=function(t){e.metronomeSolo=t},e.getMetronomeOffsetClickStart=function(){return e.metronomeOffsetClickStart},e.getMetronomeOffsetClickStartIsRotating=function(){return"ROTATE"==e.metronomeOffsetClickStart},e.setMetronomeOffsetClickStart=function(t){e.metronomeOffsetClickStart=t},e.advanceMetronomeOptionsOffsetClickStartRotation=function(t){return!!e.getMetronomeOffsetClickStartIsRotating()&&(e.metronomeOffsetClickStartRotation++,!0)},e.getMetronomeOptionsOffsetClickStartRotation=function(t){if(!e.getMetronomeOffsetClickStartIsRotating())return e.metronomeOffsetClickStart;switch(t&&e.metronomeOffsetClickStartRotation>2?e.metronomeOffsetClickStartRotation=0:e.metronomeOffsetClickStartRotation>3&&(e.metronomeOffsetClickStartRotation=0),e.metronomeOffsetClickStartRotation){case 0:return"1";case 1:if(t)return"TI";return"E";case 2:if(t)return"TA";return"AND";case 3:return"A"}},e.resetMetronomeOptionsOffsetClickStartRotation=function(t){return e.metronomeOffsetClickStartRotation=0},e.GetEmptyGroove=function(e,t){var n,a="",o="|";for(n=0;nt.length?e.length:t.length,a="",o=0;os&&i.length/s>=2?l=Math.ceil(i.length/s):i.length=2&&(c=Math.ceil(s/i.length));for(var m=0;mt.length&&(r=t.length);for(var l=0;l0&&(l+1)%s==0&&(i+="|")}return i},e.parseTimeSigString=function(e){var t=e.split("/");if(2!=t.length)return[4,4];var n=parseInt(t[0],10),a=parseInt(t[1],10);return(n<1||n>32)&&(n=4),2!=a&&4!=a&&8!=a&&16!=a&&(a=4),[n,a]},e.getGrooveDataFromUrlString=function(t){var n,a,o,r,s,i=new e.grooveDataNew;i.debugMode=parseInt(e.getQueryVariableFromString("Debug",e.debugMode,t),10);var l=e.parseTimeSigString(e.getQueryVariableFromString("TimeSig","4/4",t));for(i.numBeats=l[0],i.noteValue=l[1],i.timeDivision=parseInt(e.getQueryVariableFromString("Div",16,t),10),i.notesPerMeasure=e.calc_notes_per_measure(i.timeDivision,i.numBeats,i.noteValue),i.metronomeFrequency=parseInt(e.getQueryVariableFromString("MetronomeFreq","0",t),10),i.numberOfMeasures=parseInt(e.getQueryVariableFromString("measures",1,t),10),i.numberOfMeasures<1||isNaN(i.numberOfMeasures)?i.numberOfMeasures=1:i.numberOfMeasures>constant_MAX_MEASURES&&(i.numberOfMeasures=constant_MAX_MEASURES),(n=e.getQueryVariableFromString("Stickings",!1,t))?i.showStickings=!0:(n=e.GetDefaultStickingsGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures),i.showStickings=!1),(a=e.getQueryVariableFromString("H",!1,t))||(e.getQueryVariableFromString("HH",!1,t),a||(a=e.GetDefaultHHGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures))),(o=e.getQueryVariableFromString("S",!1,t))||(o=e.GetDefaultSnareGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures)),(r=e.getQueryVariableFromString("K",!1,t))||(e.getQueryVariableFromString("B",!1,t),r||(r=e.GetDefaultKickGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures))),s=0;s<4;s++){var c=e.getQueryVariableFromString("T"+(s+1),!1,t);c?i.showToms=!0:c=e.GetDefaultTomGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures),i.toms_array[s]=e.noteArraysFromURLData("T"+(s+1),c,i.notesPerMeasure,i.numberOfMeasures)}i.sticking_array=e.noteArraysFromURLData("Stickings",n,i.notesPerMeasure,i.numberOfMeasures),i.hh_array=e.noteArraysFromURLData("H",a,i.notesPerMeasure,i.numberOfMeasures),i.snare_array=e.noteArraysFromURLData("S",o,i.notesPerMeasure,i.numberOfMeasures),i.kick_array=e.noteArraysFromURLData("K",r,i.notesPerMeasure,i.numberOfMeasures),i.title=e.getQueryVariableFromString("title","",t),i.title=decodeURIComponent(i.title),i.title=i.title.replace(/\+/g," "),i.author=e.getQueryVariableFromString("author","",t),i.author=decodeURIComponent(i.author),i.author=i.author.replace(/\+/g," "),i.comments=e.getQueryVariableFromString("comments","",t),i.comments=decodeURIComponent(i.comments),i.comments=i.comments.replace(/\+/g," "),i.tempo=parseInt(e.getQueryVariableFromString("tempo",constant_DEFAULT_TEMPO,t),10),(isNaN(i.tempo)||i.tempo<20||i.tempo>400)&&(i.tempo=constant_DEFAULT_TEMPO),i.swingPercent=parseInt(e.getQueryVariableFromString("swing",0,t),10),(isNaN(i.swingPercent)||i.swingPercent<0||i.swingPercent>100)&&(i.swingPercent=0);var m=e.getQueryVariableFromString("embedTempoTimeSig",!1,t);return i.embedTempoTimeSig="true"===m||"True"===m,i},e.getUrlStringFromGrooveData=function(t,n){var a=window.location.protocol+"//"+window.location.host+window.location.pathname;n&&("display"==n?a.includes("index.html")?a=a.replace("index.html","GrooveEmbed.html"):a.includes("/gscribe")?a=a.replace("/gscribe","/groove/GrooveEmbed.html"):a+="GrooveEmbed.html":"fullGrooveScribe"==n&&(a="https://www.mikeslessons.com/gscribe")),a+="?",t.debugMode&&(a+="Debug=1&"),t.viewMode&&(a+="Mode=view&"),t.grooveDBAuthoring&&(a+="GDB_Author=1&"),a+="TimeSig="+t.numBeats+"/"+t.noteValue,a+="&Div="+t.timeDivision,""!==t.title&&(a+="&Title="+encodeURIComponent(t.title)),""!==t.author&&(a+="&Author="+encodeURIComponent(t.author)),""!==t.comments&&(a+="&Comments="+encodeURIComponent(t.comments)),a+="&Tempo="+t.tempo,t.swingPercent>0&&(a+="&Swing="+t.swingPercent),a+="&Measures="+t.numberOfMeasures,0!==t.metronomeFrequency&&(a+="&MetronomeFreq="+t.metronomeFrequency);var o=t.notesPerMeasure*t.numberOfMeasures,r="&H=|"+e.tabLineFromAbcNoteArray("H",t.hh_array,!0,!0,o,t.notesPerMeasure),s="&S=|"+e.tabLineFromAbcNoteArray("S",t.snare_array,!0,!0,o,t.notesPerMeasure),i="&K=|"+e.tabLineFromAbcNoteArray("K",t.kick_array,!0,!0,o,t.notesPerMeasure);if(a+=r+s+i,t.showToms){var l="&T1=|"+e.tabLineFromAbcNoteArray("T1",t.toms_array[0],!0,!0,o,t.notesPerMeasure),c="&T4=|"+e.tabLineFromAbcNoteArray("T4",t.toms_array[3],!0,!0,o,t.notesPerMeasure);a+=l+c}return t.showStickings&&(a+="&Stickings=|"+e.tabLineFromAbcNoteArray("stickings",t.sticking_array,!0,!0,o,t.notesPerMeasure)),a},e.get_top_ABC_BoilerPlate=function(t,n,a,o,r,s,i,l,c,m){var u="%abc\n%%fullsvg _"+e.grooveUtilsUniqueIndex+"\nX:6\n";return u+="M:"+l+"/"+c+"\n",u+="T: "+n+"\n",""!==a&&(u+="C: "+a+"\n",u+="%%musicspace 20px\n"),m<400&&(m=400),m>3e3&&(m=3e3),u+="L:1/32\n",t?u+="%%stretchlast 0\n":u+="%%stretchlast 1\n",u+="%%flatbeams 1\n%%ornament up\n%%pagewidth "+(m=Math.floor(.75*m))+'px\n%%leftmargin 0cm\n%%rightmargin 0cm\n%%topspace 10px\n%%titlefont calibri 20\n%%partsfont calibri 16\n%%gchordfont calibri 16\n%%annotationfont calibri 16\n%%infofont calibri 16\n%%textfont calibri 16\n%%deco (. 0 a 5 1 1 "@-8,-3("\n%%deco ). 0 a 5 1 1 "@4,-3)"\n%%beginsvg\n \n \n \n \n%%endsvg\n%%map drum ^g heads=Xhead print=g % Hi-Hat\n%%map drum ^c\' heads=Xhead print=c\' % Crash\n%%map drum ^d\' heads=Xhead print=d\' % Stacker\n%%map drum ^e\' heads=Xhead print=e\' % Metronome click\n%%map drum ^f\' heads=Xhead print=f\' % Metronome beep\n%%map drum ^A\' heads=Xhead print=A\' % Ride\n%%map drum ^B\' heads=Trihead print=A\' % Ride Bell\n%%map drum ^D\' heads=Trihead print=g % Cow Bell\n%%map drum ^c heads=Xhead print=c % Cross Stick\n%%map drum ^d, heads=Xhead print=d, % Foot Splash\n',u+="%%staves (Stickings Hands Feet)\n",""!==o&&(u+="P: "+o+"\n",u+="%%musicspace 20px\n"),u+="K:C clef=perc\n",r&&(u+='V:Stickings\nx8 x8 x8 x8 x8 x8 x8 x8 ||\nV:Hands stem=up \n%%voicemap drum\n"^Hi-Hat"^g4 "^Open"!open!^g4 "^Crash"^c\'4 "^Stacker"^d\'4 "^Ride"^A\'4 "^Ride Bell"^B\'4 x2 "^Tom"e4 "^Tom"A4 "^Snare"c4 "^Buzz"!///!c4 "^Cross"^c4 "^Ghost "!(.!!).!c4 "^Flam"{/c}c4 x10 ||\nV:Feet stem=down \n%%voicemap drum\nx52 "^Kick"F4 "^HH foot"^d,4 x4 ||\nT:\n'),u},e.noteGroupingSize=function(t,n,a){var o;return e.isTripletDivisionFromNotesPerMeasure(t,n,a)?(2!=n&&4!=a&&console.log("Triplets are only supported in 2/4 and 4/4 time"),o=t/(n*(4/a))):o=3==n?t/3:n%6==0&&a%8==0?t/(2*n/6):t/n*(a/4),o},e.notesPerMeasureInFullSizeArray=function(e,t,n){return e?48*(t/n):32*(t/n)},e.getNoteScaler=function(t,n,a){var o;return!n||n<1||n>36?(console.log("Error in getNoteScaler, out of range: "+n),o=1):o=e.isTripletDivisionFromNotesPerMeasure(t,n,a)?Math.ceil(e.notesPerMeasureInFullSizeArray(!0,n,a)/t):Math.ceil(e.notesPerMeasureInFullSizeArray(!1,n,a)/t),o},e.scaleNoteArrayToFullSize=function(t,n,a,o,r){var s,i=e.getNoteScaler(a,o,r),l=[];if(e.isTripletDivisionFromNotesPerMeasure(a,o,r),1==i)return t;for(s=0;s=32&&(v=1),e.isTripletDivisionFromNotesPerMeasure(g,_,I))?function e(t,n,a,o,r,m,u,d,g,$,_,I,v){var p,M="",f="V:Stickings\n",b="V:Hands stem=up\n%%voicemap drum\n",O="V:Feet stem=down\n%%voicemap drum\n";p=$?[a,n,o]:[a,n],r&&(p=p.concat(r));for(var C=d,A=0;Ag&&(T=g-A%u),A%l(!0,_,I)==0){if(0==c(p,A,12))S=!0,f+="x8",b+="z8",A+=11;else if(0==c(p,A+1,11)){for(var y=A+1;y12&&0==c(p,A+1,5)&&0==c(p,A+7,5)){for(var N=A;N<=A+6;N+=6){for(var y=N+1;yd&&(A=d-b%d),C=b%l(!1,$,_)==0?l(!1,$,_):l(!1,$,_)-b%l(!1,$,_),b%d+C>d&&(C=d-b%d),b%l(!1,$,_)==0&&(p+=i([t],b,A,1,!0),g?(M+=i(O,b,A,1,!1),f=""):(M+=i(O,b,A,1,!1),f+=i([o],b,A,1,!1))),p+=s([t],b,C,1),g?(M+=s(O,b,C,1),f=""):(M+=s(O,b,C,1),f+=s([o],b,C,1)),b%l(!1,$,_)==l(!1,$,_)-1&&(p+=" ",M+=" ",f+=" "),(b+1)%(32/_*$)==0&&(p+="|",M+="|",f+="|"),b\n"},this.get_abcmodel=function(e,t,n){},this.anno_start=function(e,t,n,a,o,r,s){},this.svg_highlight_y=0,this.svg_highlight_h=44,this.anno_stop=function(t,n,a,o,r,s,i){"bar"==t&&(this.svg_highlight_y=r+5,this.svg_highlight_h=i+10),("note"==t||"grace"==t)&&(r=this.svg_highlight_y,i=this.svg_highlight_h,e.abc_obj.out_svg('\n'),"grace"!=t&&e.abcNoteNumIndex++)},this.img_out=function(e){this.abc_svg_output+=e},this.page_format=!0};e.renderABCtoSVG=function(t){return e.abc_obj=new Abc(m),e.myGrooveData&&e.myGrooveData.showLegend||e.isLegendVisable?e.abcNoteNumIndex=-15:e.abcNoteNumIndex=0,m.abc_svg_output="",m.abc_error_output="",e.abc_obj.tosvg("SOURCE",t),{svg:m.abc_svg_output,error_html:m.abc_error_output}},e.isElementOnScreen=function(e){var t=e.getBoundingClientRect();return t.top>=80&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},e.abcNoteNumCurrentlyHighlighted=-1,e.clearHighlightNoteInABCSVG=function(){if(e.abcNoteNumCurrentlyHighlighted>-1){for(var t=document.querySelectorAll("#abcNoteNum_"+e.grooveUtilsUniqueIndex+"_"+e.abcNoteNumCurrentlyHighlighted),n=0;n0)return u;if(""!==global_grooveUtilsScriptSrc){var e=global_grooveUtilsScriptSrc.lastIndexOf("/");e=global_grooveUtilsScriptSrc.lastIndexOf("/",e-1),u=global_grooveUtilsScriptSrc.slice(0,e+1)}return u.length<1&&(u="https://b125c4f8bf7d89726feec9ab8202d31e0c8d14d8.googledrive.com/host/0B2wxVWzVoWGYfnB5b3VTekxyYUowVjZ5YVE3UllLaVk5dVd4TzF4Q2ZaUXVsazhNSTdRM1E/"),u},e.getMidiSoundFontLocation=function(){return e.getGrooveUtilsBaseLocation()+"soundfont/"},e.getMidiImageLocation=function(){return e.getGrooveUtilsBaseLocation()+"images/"},e.midiEventCallbackClass=function(t){this.classRoot=t,this.noteHasChangedSinceLastDataLoad=!1,this.playEvent=function(e){var t=document.getElementById("midiPlayImage"+e.grooveUtilsUniqueIndex);t&&(t.className="midiPlayImage Playing"),e.playEventCallback&&e.playEventCallback()},this.loadMidiDataEvent=function(e,t){if(e.myGrooveData){e.myGrooveData.tempo=e.getTempo(),e.myGrooveData.swingPercent=e.getSwing();var n=e.create_MIDIURLFromGrooveData(e.myGrooveData);e.loadMIDIFromURL(n),e.midiEventCallbacks.noteHasChangedSinceLastDataLoad=!1}else console.log("can't load midi song. myGrooveData is empty")},this.doesMidiDataNeedRefresh=function(e){return e.midiEventCallbacks.noteHasChangedSinceLastDataLoad},this.pauseEvent=function(e){var t=document.getElementById("midiPlayImage"+e.grooveUtilsUniqueIndex);t&&(t.className="midiPlayImage Paused")},this.resumeEvent=function(e){},this.stopEvent=function(e){var t=document.getElementById("midiPlayImage"+e.grooveUtilsUniqueIndex);t&&(t.className="midiPlayImage Stopped")},this.repeatChangeEvent=function(e,t){t?document.getElementById("midiRepeatImage"+e.grooveUtilsUniqueIndex).src=e.getMidiImageLocation()+"repeat.png":document.getElementById("midiRepeatImage"+e.grooveUtilsUniqueIndex).src=e.getMidiImageLocation()+"grey_repeat.png"},this.percentProgress=function(e,t){},this.notePlaying=function(e,t,n){},this.midiInitialized=function(t){var n,a=document.getElementById("midiPlayImage"+t.grooveUtilsUniqueIndex);a&&(a.className="midiPlayImage Stopped"),document.getElementById("midiPlayImage"+t.grooveUtilsUniqueIndex).onclick=function(e){t.startOrStopMIDI_playback()},n=!1,document.onkeyup=function(e){17==e.which&&(n=!1)},document.onkeydown=function(t){return(17==t.which&&(n=!0),32==t.which&&("range"==t.target.type||"INPUT"!=t.target.tagName.toUpperCase()&&"TEXTAREA"!=t.target.tagName.toUpperCase()))?(e.startOrStopMIDI_playback(),!1):(179==t.which&&e.startOrPauseMIDI_playback(),178==t.which&&e.stopMIDI_playback(),!0)}}},e.midiEventCallbacks=new e.midiEventCallbackClass(e),e.setGrooveData=function(t){e.myGrooveData=t},e.midiNoteHasChanged=function(){e.midiEventCallbacks.noteHasChangedSinceLastDataLoad=!0},e.midiResetNoteHasChanged=function(){e.midiEventCallbacks.noteHasChangedSinceLastDataLoad=!1},e.MIDI_build_midi_url_count_in_track=function(t,n){var a=new Midi.File,o=new Midi.Track;a.addTrack(o),o.setTempo(e.getTempo()),o.setInstrument(0,19),o.addNoteOff(9,60,1);var r=128;8==n?r=64:16==n&&(r=32),o.addNoteOn(9,constant_OUR_MIDI_METRONOME_1,0,constant_OUR_MIDI_VELOCITY_NORMAL),o.addNoteOff(9,constant_OUR_MIDI_METRONOME_1,r);for(var s=1;s.99)&&(console.log("Swing percentage out of range in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays"),m=0),t.events.length<4&&t.addNoteOff(9,60,1);for(var $=e.isTripletDivisionFromNotesPerMeasure(l,u,d),_=e.getMetronomeOptionsOffsetClickStartRotation($),I=0,v=0;v0){var C=$?12:8,A=$?6:4,T=v;switch(_){case"1":break;case"E":$&&console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=2;break;case"AND":$&&console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=4;break;case"A":$&&console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=6;break;case"TI":$||console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=4;break;case"TA":$||console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=8;break;default:console.log("bad case in MIDI_from_HH_Snare_Kick_Arrays")}T>=0&&(0===T||T%(C*u*(4/d))==0?b=constant_OUR_MIDI_METRONOME_1:T%C==0&&(b=constant_OUR_MIDI_METRONOME_NORMAL),b||8!=i?b||16!=i||T%2!=0||(b=constant_OUR_MIDI_METRONOME_NORMAL,O=25):T%A==0&&(b=constant_OUR_MIDI_METRONOME_NORMAL)),!1!==b&&(t.addNoteOn(9,b,I,O),I=0)}if(!e.metronomeSolo){var h=constant_OUR_MIDI_VELOCITY_NORMAL,S=!1;switch(n[v]){case constant_ABC_HH_Normal:case constant_ABC_HH_Close:S=constant_OUR_MIDI_HIHAT_NORMAL;break;case constant_ABC_HH_Accent:"general_MIDI"==s?(S=constant_OUR_MIDI_HIHAT_NORMAL,h=constant_OUR_MIDI_VELOCITY_ACCENT):S=constant_OUR_MIDI_HIHAT_ACCENT;break;case constant_ABC_HH_Open:S=constant_OUR_MIDI_HIHAT_OPEN;break;case constant_ABC_HH_Ride:S=constant_OUR_MIDI_HIHAT_RIDE;break;case constant_ABC_HH_Ride_Bell:S=constant_OUR_MIDI_HIHAT_RIDE_BELL;break;case constant_ABC_HH_Cow_Bell:S=constant_OUR_MIDI_HIHAT_COW_BELL;break;case constant_ABC_HH_Crash:S=constant_OUR_MIDI_HIHAT_CRASH;break;case constant_ABC_HH_Stacker:S=constant_OUR_MIDI_HIHAT_STACKER;break;case constant_ABC_HH_Metronome_Normal:S=constant_OUR_MIDI_HIHAT_METRONOME_NORMAL;break;case constant_ABC_HH_Metronome_Accent:S=constant_OUR_MIDI_HIHAT_METRONOME_ACCENT;break;case!1:break;default:console.log("Bad case in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays")}!1!==S&&(!1!==g&&(t.addNoteOff(9,g,I),g=!1,I=0),t.addNoteOn(9,S,I,h),I=0,n[v]==constant_ABC_HH_Open&&(g=S));var y=constant_OUR_MIDI_VELOCITY_NORMAL,N=!1;switch(a[v]){case constant_ABC_SN_Normal:N=constant_OUR_MIDI_SNARE_NORMAL;break;case constant_ABC_SN_Flam:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_ACCENT):(N=constant_OUR_MIDI_SNARE_FLAM,y=constant_OUR_MIDI_VELOCITY_NORMAL);break;case constant_ABC_SN_Drag:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_ACCENT):(N=constant_OUR_MIDI_SNARE_DRAG,y=constant_OUR_MIDI_VELOCITY_NORMAL);break;case constant_ABC_SN_Accent:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_ACCENT):N=constant_OUR_MIDI_SNARE_ACCENT;break;case constant_ABC_SN_Ghost:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_GHOST):(N=constant_OUR_MIDI_SNARE_GHOST,y=constant_OUR_MIDI_VELOCITY_GHOST);break;case constant_ABC_SN_XStick:N=constant_OUR_MIDI_SNARE_XSTICK;break;case constant_ABC_SN_Buzz:N=constant_OUR_MIDI_SNARE_BUZZ;break;case!1:break;default:console.log("Bad case in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays")}!1!==N&&(t.addNoteOn(9,N,I,y),I=0);var R=!1,U=!1;switch(o[v]){case constant_ABC_KI_Splash:U=constant_OUR_MIDI_HIHAT_FOOT;break;case constant_ABC_KI_SandK:U=constant_OUR_MIDI_HIHAT_FOOT,R=constant_OUR_MIDI_KICK_NORMAL;break;case constant_ABC_KI_Normal:R=constant_OUR_MIDI_KICK_NORMAL;break;case!1:break;default:console.log("Bad case in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays")}if(!1!==R&&(t.addNoteOn(9,R,I,constant_OUR_MIDI_VELOCITY_NORMAL),I=0),!1!==U&&(!1!==g&&(t.addNoteOff(9,g,I),g=!1,I=0),t.addNoteOn(9,U,I,constant_OUR_MIDI_VELOCITY_NORMAL),I=0),r)for(var k=0;k0&&(r=o.getUTCHours()+":"+(10>o.getUTCMinutes()?"0":"")),r+=o.getUTCMinutes()+":"+(10>o.getSeconds()?"0":"")+o.getSeconds(),n.innerHTML='Total Play Time: '+r+' notes: '+global_total_midi_notes+' repetitions: '+global_total_midi_repeats+""}return global_last_midi_update_time=e,t},e.updateMidiPlayTime=function(){var t=e.getMidiPlayTime(),n=t.getUTCMinutes()+":"+(10>t.getSeconds()?"0":"")+t.getSeconds(),a=document.getElementById("MIDIPlayTime"+e.grooveUtilsUniqueIndex);a&&(a.innerHTML=n)},e.getTempo=function(){var t=document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex),n=constant_DEFAULT_TEMPO;return t&&(n=parseInt(t.value,10))<19&&n>281&&(n=constant_DEFAULT_TEMPO),n},e.tempoUpdate=function(t){document.getElementById("tempoTextField"+e.grooveUtilsUniqueIndex).value=""+t,g("tempoInput"+e.grooveUtilsUniqueIndex),e.midiNoteHasChanged(),e.tempoChangeCallback&&e.tempoChangeCallback(t)},e.tempoUpdateFromTextField=function(t){var n=t.target.value;document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex).value=n,e.tempoUpdate(n)},e.tempoUpdateFromSlider=function(t){e.tempoUpdate(t.target.value)},e.upTempo=function(){var t=e.getTempo();t++,e.setTempo(t)},e.downTempo=function(){var t=e.getTempo();t--,e.setTempo(t)},e.setTempo=function(t){t<19&&t>281||(document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex).value=t,e.tempoUpdate(t))},e.doesDivisionSupportSwing=function(t){return!e.isTripletDivision(t)&&4!=t},e.setSwingSlider=function(t){document.getElementById("swingInput"+e.grooveUtilsUniqueIndex).value=t,g("swingInput"+e.grooveUtilsUniqueIndex)},e.swingEnabled=function(t){e.swingIsEnabled=t,!1===e.swingIsEnabled?e.setSwing(0):e.swingUpdateText(e.getSwing())},e.getSwing=function(){var t=0;if(e.swingIsEnabled){var n=document.getElementById("swingInput"+e.grooveUtilsUniqueIndex);n&&((t=parseInt(n.value,10))<0||t>60)&&(t=0)}return t},e.swingUpdateText=function(t){!1===e.swingIsEnabled?document.getElementById("swingOutput"+e.grooveUtilsUniqueIndex).innerHTML="N/A":(document.getElementById("swingOutput"+e.grooveUtilsUniqueIndex).innerHTML=""+t+"%",e.swingPercent=t,e.midiNoteHasChanged())},e.setSwing=function(t){!1===e.swingIsEnabled&&(t=0),e.setSwingSlider(t),e.swingUpdateText(t)},e.swingUpdateEvent=function(t){!1===e.swingIsEnabled?e.setSwingSlider(0):(e.swingUpdateText(t.target.value),g("swingInput"+e.grooveUtilsUniqueIndex))},e.setMetronomeFrequencyDisplay=function(t){var n=document.getElementById("midiMetronomeMenu"+e.grooveUtilsUniqueIndex);n&&(n.className=n.className.replace(" selected",""),t>0&&(n.className+=" selected"))},e.loadFullScreenGrooveScribe=function(){var t=e.getUrlStringFromGrooveData(e.myGrooveData,"fullGrooveScribe");window.open(t,"_blank").focus()},e.metronomeMiniMenuClick=function(){e.myGrooveData.metronomeFrequency>0?e.myGrooveData.metronomeFrequency=0:e.myGrooveData.metronomeFrequency=4,e.setMetronomeFrequencyDisplay(e.myGrooveData.metronomeFrequency),e.midiNoteHasChanged()},e.expandOrRetractMIDI_playback=function(t,n){var a=document.getElementById("playerControl"+e.grooveUtilsUniqueIndex),o=document.getElementById("playerControlsRow"+e.grooveUtilsUniqueIndex),r=document.getElementById("tempoAndProgress"+e.grooveUtilsUniqueIndex),s=document.getElementById("midiMetronomeMenu"+e.grooveUtilsUniqueIndex),i=document.getElementById("midiGSLogo"+e.grooveUtilsUniqueIndex),l=document.getElementById("midiExpandImage"+e.grooveUtilsUniqueIndex),c=document.getElementById("MIDIPlayTime"+e.grooveUtilsUniqueIndex);a.className.indexOf("small")>-1||t&&n?(a.className=a.className.replace(" small","")+" large",o.className=o.className.replace(" small","")+" large",r.className=r.className.replace(" small","")+" large",s.className=s.className.replace(" small","")+" large",i.className=i.className.replace(" small","")+" large",l.className=l.className.replace(" small","")+" large",c.className=c.className.replace(" small","")+" large"):(a.className=a.className.replace(" large","")+" small",o.className=o.className.replace(" large","")+" small",s.className=s.className.replace(" large","")+" small",r.className=r.className.replace(" large","")+" small",i.className=i.className.replace(" large","")+" small",l.className=l.className.replace(" large","")+" small",c.className=c.className.replace(" large","")+" small")},e.HTMLForMidiPlayer=function(t){var n='
0:00';return t&&(n+=' '),n+='
BPM
SWING 0% swing
',t&&(n+=' '),n+="
"},e.AddMidiPlayerToPage=function(t,n,a){var o=document.getElementById(t);o&&(o.innerHTML=e.HTMLForMidiPlayer(a));var r=e.getBrowserInfo(),s=!1;"MSIE"==r.browser&&r.version<12&&(s=!0),(o=document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex))&&(s?o.addEventListener("click",e.tempoUpdateFromSlider,!1):o.addEventListener("input",e.tempoUpdateFromSlider,!1)),(o=document.getElementById("tempoTextField"+e.grooveUtilsUniqueIndex))&&o.addEventListener("change",e.tempoUpdateFromTextField,!1),(o=document.getElementById("swingInput"+e.grooveUtilsUniqueIndex))&&(s?o.addEventListener("click",e.swingUpdateEvent,!1):o.addEventListener("input",e.swingUpdateEvent,!1)),(o=document.getElementById("midiRepeatImage"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.repeatMIDI_playback,!1),(o=document.getElementById("midiExpandImage"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.expandOrRetractMIDI_playback,!1),(o=document.getElementById("midiGSLogo"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.loadFullScreenGrooveScribe,!1),(o=document.getElementById("midiMetronomeMenu"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.metronomeMiniMenuClick,!1),e.swingEnabled(e.doesDivisionSupportSwing(n))}} \ No newline at end of file +if(void 0===e){var e={};!function(){"use strict";var t,n,a,o=e;o.filesadded="",o.getLocalScriptRoot=(a=(n=(t=document.getElementsByTagName("script"))[t.length-1]).src.lastIndexOf("/"),n.rootSrc=n.src.slice(0,a+1),function(){return n.rootSrc}),o.GrooveDisplayUniqueCounter=1,o.GrooveDBFormatPutGrooveInHTMLElement=function(e,t){var n=new GrooveUtils,a=new n.grooveDataNew,r=n.mergeDrumTabLines(t.snareAccentTab,t.snareOtherTab),s=n.mergeDrumTabLines(t.kickTab,t.footOtherTab);if(void 0===t.div||isNaN(t.div)||(a.timeDivision=t.div),void 0===t.tempo||isNaN(t.tempo)||(a.tempo=t.tempo),void 0===t.swingPercent||isNaN(t.swingPercent)||(a.swingPercent=t.swingPercent),void 0===t.measures||isNaN(t.measures)||(a.numberOfMeasures=t.measures),void 0===t.notesPerTabMeasure||isNaN(t.notesPerTabMeasure)||(a.notesPerMeasure=t.notesPerTabMeasure),void 0!==t.stickingTab&&(a.sticking_array=n.noteArraysFromURLData("Stickings",t.stickingTab,t.notesPerTabMeasure,t.measures)),void 0!==t.hihatTab&&(a.hh_array=n.noteArraysFromURLData("H",t.hihatTab,t.notesPerTabMeasure,t.measures)),a.snare_array=n.noteArraysFromURLData("S",r,t.notesPerTabMeasure,t.measures),a.kick_array=n.noteArraysFromURLData("K",s,t.notesPerTabMeasure,t.measures),void 0!==t.tom1Tab&&(a.toms_array[0]=n.noteArraysFromURLData("T1",t.tom1Tab,t.notesPerTabMeasure,t.measures)),void 0!==t.tom4Tab&&(a.toms_array[3]=n.noteArraysFromURLData("T4",t.tom4Tab,t.notesPerTabMeasure,t.measures)),void 0!==t.timeSignature){var i=function e(t){var n=4,a=4;if(t){var o=t.split("/");2==o.length&&(n=Math.ceil(o[0]),a=Math.ceil(o[1]))}return[n,a]}(t.timeSignature);a.numBeats=i[0],a.noteValue=i[1]}var l="svgTarget"+o.GrooveDisplayUniqueCounter,c="midiPlayerTarget"+o.GrooveDisplayUniqueCounter;document.getElementById(e).innerHTML='
\n
\n';var m=document.getElementById(l),u=m.offsetWidth-100,d=n.createABCFromGrooveData(a,u),g=n.renderABCtoSVG(d);m.innerHTML=g.svg,n.setGrooveData(a),n.AddMidiPlayerToPage(c,a.notesPerMeasure,!0),n.expandOrRetractMIDI_playback(!0,!1),n.setTempo(a.tempo),n.setSwing(a.swingPercent),n.oneTimeInitializeMidi(),o.GrooveDisplayUniqueCounter++},o.GrooveDBFormatPutGrooveOnPage=function(e){o.GrooveDisplayUniqueCounter++;var t="GrooveDisplay"+o.GrooveDisplayUniqueCounter;document.write(''),window.addEventListener("load",function(){o.GrooveDBFormatPutGrooveInHTMLElement(t,e)},!1)},o.AddGrooveDisplayToElementId=function(e,t,n,a,r){var s=new GrooveUtils;o.GrooveDisplayUniqueCounter++;var i="svgTarget"+o.GrooveDisplayUniqueCounter,l="midiPlayerTarget"+o.GrooveDisplayUniqueCounter;document.getElementById(e).innerHTML='
\n
\n';var c,m,u,d,g=s.getGrooveDataFromUrlString(t);c=document.getElementById("tempoTimeSig"),g.embedTempoTimeSig&&(c.innerHTML="♩ = "+g.tempo+"    "+g.numBeats+"/"+g.noteValue),m=document.getElementById(i),u=s.createABCFromGrooveData(g,600),d=s.renderABCtoSVG(u),a?m.innerHTML=''+d.svg+"":m.innerHTML=d.svg,n&&(s.setGrooveData(g),s.AddMidiPlayerToPage(l,g.notesPerMeasure,!0),s.expandOrRetractMIDI_playback(!0,r),s.setTempo(g.tempo),s.setSwing(g.swingPercent),s.setMetronomeFrequencyDisplay(g.metronomeFrequency),s.oneTimeInitializeMidi())},o.AddGrooveDisplayToPage=function(e,t,n,a){o.GrooveDisplayUniqueCounter++;var r="GrooveDisplay"+o.GrooveDisplayUniqueCounter,s=document.createElement("div");s.class="GrooveDisplay",s.id=r,document.getElementsByTagName("body")[0].appendChild(s),window.addEventListener("load",function(){o.AddGrooveDisplayToElementId(r,e,t,n,a)},!1)}}()}var global_num_GrooveUtilsCreated=0,global_grooveUtilsScriptSrc="";document.currentScript&&(global_grooveUtilsScriptSrc=document.currentScript.src);var global_midiInitialized=!1,constant_MAX_MEASURES=10,constant_DEFAULT_TEMPO=80,constant_ABC_STICK_R='"R"x',constant_ABC_STICK_L='"L"x',constant_ABC_STICK_BOTH='"R/L"x',constant_ABC_STICK_COUNT='"count"x',constant_ABC_STICK_OFF='""x',constant_ABC_HH_Ride="^A'",constant_ABC_HH_Ride_Bell="^B'",constant_ABC_HH_Cow_Bell="^D'",constant_ABC_HH_Crash="^c'",constant_ABC_HH_Stacker="^d'",constant_ABC_HH_Metronome_Normal="^e'",constant_ABC_HH_Metronome_Accent="^f'",constant_ABC_HH_Open="!open!^g",constant_ABC_HH_Close="!plus!^g",constant_ABC_HH_Accent="!accent!^g",constant_ABC_HH_Normal="^g",constant_ABC_SN_Ghost="!(.!!).!c",constant_ABC_SN_Accent="!accent!c",constant_ABC_SN_Normal="c",constant_ABC_SN_XStick="^c",constant_ABC_SN_Buzz="!///!c",constant_ABC_SN_Flam="!accent!{/c}c",constant_ABC_SN_Drag="{/cc}c",constant_ABC_KI_SandK="[F^d,]",constant_ABC_KI_Splash="^d,",constant_ABC_KI_Normal="F",constant_ABC_T1_Normal="e",constant_ABC_T2_Normal="d",constant_ABC_T3_Normal="B",constant_ABC_T4_Normal="A",constant_NUMBER_OF_TOMS=4,constant_ABC_OFF=!1,constant_OUR_MIDI_VELOCITY_NORMAL=85,constant_OUR_MIDI_VELOCITY_ACCENT=120,constant_OUR_MIDI_VELOCITY_GHOST=50,constant_OUR_MIDI_METRONOME_1=76,constant_OUR_MIDI_METRONOME_NORMAL=77,constant_OUR_MIDI_HIHAT_NORMAL=42,constant_OUR_MIDI_HIHAT_OPEN=46,constant_OUR_MIDI_HIHAT_ACCENT=108,constant_OUR_MIDI_HIHAT_CRASH=49,constant_OUR_MIDI_HIHAT_STACKER=52,constant_OUR_MIDI_HIHAT_METRONOME_NORMAL=77,constant_OUR_MIDI_HIHAT_METRONOME_ACCENT=76,constant_OUR_MIDI_HIHAT_RIDE=51,constant_OUR_MIDI_HIHAT_RIDE_BELL=53,constant_OUR_MIDI_HIHAT_COW_BELL=105,constant_OUR_MIDI_HIHAT_FOOT=44,constant_OUR_MIDI_SNARE_NORMAL=38,constant_OUR_MIDI_SNARE_ACCENT=22,constant_OUR_MIDI_SNARE_GHOST=21,constant_OUR_MIDI_SNARE_XSTICK=37,constant_OUR_MIDI_SNARE_BUZZ=104,constant_OUR_MIDI_SNARE_FLAM=107,constant_OUR_MIDI_SNARE_DRAG=103,constant_OUR_MIDI_KICK_NORMAL=35,constant_OUR_MIDI_TOM1_NORMAL=48,constant_OUR_MIDI_TOM2_NORMAL=47,constant_OUR_MIDI_TOM3_NORMAL=45,constant_OUR_MIDI_TOM4_NORMAL=43,global_current_midi_start_time=0,global_last_midi_update_time=0,global_total_midi_play_time_msecs=0,global_total_midi_notes=0,global_total_midi_repeats=0;function GrooveUtils(){"use strict";global_num_GrooveUtilsCreated++;var e=this;e.abc_obj=null,e.note_mapping_array=null,e.debugMode=!1,e.viewMode=!0,e.grooveDBAuthoring=!1,e.isMIDIPaused=!1,e.shouldMIDIRepeat=!0,e.swingIsEnabled=!1,e.grooveUtilsUniqueIndex=global_num_GrooveUtilsCreated,e.metronomeSolo=!1,e.metronomeOffsetClickStart="1",e.metronomeOffsetClickStartRotation=0,e.isLegendVisable=!1,e.noteCallback=null,e.playEventCallback=null,e.repeatCallback=null,e.tempoChangeCallback=null;var t=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1];function n(e,t){switch(t){case"b":case"B":if("Stickings"==e)return constant_ABC_STICK_BOTH;if("H"==e)return constant_ABC_HH_Ride_Bell;if("S"==e)return constant_ABC_SN_Buzz;break;case"c":if("Stickings"==e)return constant_ABC_STICK_COUNT;if("H"==e)return constant_ABC_HH_Crash;break;case"d":if("S"==e)return constant_ABC_SN_Drag;break;case"f":if("S"==e)return constant_ABC_SN_Flam;break;case"g":if("S"==e)return constant_ABC_SN_Ghost;break;case"l":case"L":if("Stickings"==e)return constant_ABC_STICK_L;break;case"m":if("H"==e)return constant_ABC_HH_Cow_Bell;break;case"n":if("H"==e)return constant_ABC_HH_Metronome_Normal;break;case"N":if("H"==e)return constant_ABC_HH_Metronome_Accent;break;case"O":if("S"==e)return constant_ABC_SN_Accent;break;case"o":switch(e){case"H":return constant_ABC_HH_Open;case"S":return constant_ABC_SN_Normal;case"K":case"B":return constant_ABC_KI_Normal;case"T1":return constant_ABC_T1_Normal;case"T2":return constant_ABC_T2_Normal;case"T3":return constant_ABC_T3_Normal;case"T4":return constant_ABC_T4_Normal}break;case"r":case"R":switch(e){case"H":return constant_ABC_HH_Ride;case"Stickings":return constant_ABC_STICK_R}break;case"s":if("H"==e)return constant_ABC_HH_Stacker;break;case"x":switch(e){case"S":return constant_ABC_SN_XStick;case"K":case"B":return constant_ABC_KI_Splash;case"H":return constant_ABC_HH_Normal;case"T1":return constant_ABC_T1_Normal;case"T4":return constant_ABC_T4_Normal}break;case"X":switch(e){case"K":return constant_ABC_KI_SandK;case"H":return constant_ABC_HH_Accent}break;case"+":if("H"==e)return constant_ABC_HH_Close;break;case"-":return!1}return console.log("Bad tablature note found in tablatureToABCNotationPerNote. Tab: "+t+" for drum type: "+e),!1}function a(e,t){var n="-";switch(t){case constant_ABC_STICK_R:n="R";break;case constant_ABC_STICK_L:n="L";break;case constant_ABC_STICK_BOTH:n="B";break;case constant_ABC_STICK_OFF:n="-";break;case constant_ABC_STICK_COUNT:n="c";break;case constant_ABC_HH_Ride:n="r";break;case constant_ABC_HH_Ride_Bell:n="b";break;case constant_ABC_HH_Cow_Bell:n="m";break;case constant_ABC_HH_Crash:n="c";break;case constant_ABC_HH_Stacker:n="s";break;case constant_ABC_HH_Metronome_Normal:n="n";break;case constant_ABC_HH_Metronome_Accent:n="N";break;case constant_ABC_HH_Open:n="o";break;case constant_ABC_HH_Close:n="+";break;case constant_ABC_SN_Accent:n="O";break;case constant_ABC_SN_Buzz:n="b";break;case constant_ABC_HH_Normal:case constant_ABC_SN_XStick:n="x";break;case constant_ABC_SN_Ghost:n="g";break;case constant_ABC_SN_Normal:case constant_ABC_KI_Normal:case constant_ABC_T1_Normal:case constant_ABC_T2_Normal:case constant_ABC_T3_Normal:case constant_ABC_T4_Normal:n="o";break;case constant_ABC_SN_Flam:n="f";break;case constant_ABC_SN_Drag:n="d";break;case constant_ABC_HH_Accent:case constant_ABC_KI_SandK:n="X";break;case constant_ABC_KI_Splash:n="x";break;case constant_ABC_OFF:n="-";break;default:console.log("bad case in abcNotationToTablaturePerNote: "+t)}return n}function o(e,t){var n=!1,a=e.notes1.lastIndexOf(t);return(a>-1&&(n=!0,e.notes1=e.notes1.replace(t,"")),(a=e.notes2.lastIndexOf(t))>-1&&(n=!0,e.notes2=e.notes2.replace(t,"")),(a=e.notes3.lastIndexOf(t))>-1&&(n=!0,e.notes3=e.notes3.replace(t,"")),n)?t:""}function r(e,t,n){for(var a=0;a1?(i+=o(l,"!accent!"),o(l,"!accent!"),i+=o(l,"!plus!"),i+=o(l,"!open!"),i+=o(l,"!///!"),o(l,"["),o(l,"]"),i+=o(l,"{/c}"),i+=o(l,"{/cc}"),i+="["+l.notes1+l.notes2+l.notes3+"]"):i+=l.notes1+l.notes2+l.notes3,i}function i(e,t,n,a,o){var s="";if(r(e,t,!1)){for(var i=1,l=t+1;l0?(e="Edge",t=n.substr(n.lastIndexOf("Edge/")+5,4)):n.lastIndexOf("Chrome/")>0?(e="Chrome",t=n.substr(n.lastIndexOf("Chrome/")+7,4)):n.lastIndexOf("Firefox/")>0?(e="Firefox",t=n.substr(n.lastIndexOf("Firefox/")+8,5)):n.lastIndexOf("Safari/")>0?(e="Safari",t=n.substr(n.lastIndexOf("Safari/")+7,6)):n.lastIndexOf("Trident/")>0?(e="MSIE",t=n.substr(n.lastIndexOf("rv:")+3,4)):console.log("undefined browser");break;case"Opera":t=n.substr(n.lastIndexOf("Version/")+8,5)}var a="windows";return n.lastIndexOf("iPhone")>0?a="iOS":n.lastIndexOf("iPad")>0?a="iOS":n.lastIndexOf("Android")>0?a="android":n.lastIndexOf("Macintosh")>0&&(a="mac"),{browser:e,version:t,platform:a,uastring:n}},e.is_touch_device=function(){return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0},e.calc_notes_per_measure=function(e,t,n){return e/n*t},e.documentOnClickHanderCloseContextMenu=function(t){e.visible_context_menu&&e.hideContextMenu(e.visible_context_menu)},e.showContextMenu=function(t){e.visible_context_menu&&e.hideContextMenu(e.visible_context_menu),t.style.display="block",e.visible_context_menu=t,t.offsetTop+t.clientHeight>document.documentElement.clientHeight&&(t.style.top=document.documentElement.clientHeight-t.clientHeight+"px"),setTimeout(function(){document.onclick=e.documentOnClickHanderCloseContextMenu,document.body.style.cursor="pointer"},100)},e.hideContextMenu=function(t){document.onclick=!1,document.body.style.cursor="auto",t&&(t.style.display="none"),e.visible_context_menu=!1},e.isTripletDivision=function(e){return e%12==0},e.isTripletDivisionFromNotesPerMeasure=function(t,n,a){return e.isTripletDivision(t/n*a)},e.getMetronomeSolo=function(){return e.metronomeSolo},e.setMetronomeSolo=function(t){e.metronomeSolo=t},e.getMetronomeOffsetClickStart=function(){return e.metronomeOffsetClickStart},e.getMetronomeOffsetClickStartIsRotating=function(){return"ROTATE"==e.metronomeOffsetClickStart},e.setMetronomeOffsetClickStart=function(t){e.metronomeOffsetClickStart=t},e.advanceMetronomeOptionsOffsetClickStartRotation=function(t){return!!e.getMetronomeOffsetClickStartIsRotating()&&(e.metronomeOffsetClickStartRotation++,!0)},e.getMetronomeOptionsOffsetClickStartRotation=function(t){if(!e.getMetronomeOffsetClickStartIsRotating())return e.metronomeOffsetClickStart;switch(t&&e.metronomeOffsetClickStartRotation>2?e.metronomeOffsetClickStartRotation=0:e.metronomeOffsetClickStartRotation>3&&(e.metronomeOffsetClickStartRotation=0),e.metronomeOffsetClickStartRotation){case 0:return"1";case 1:if(t)return"TI";return"E";case 2:if(t)return"TA";return"AND";case 3:return"A"}},e.resetMetronomeOptionsOffsetClickStartRotation=function(t){return e.metronomeOffsetClickStartRotation=0},e.GetEmptyGroove=function(e,t){var n,a="",o="|";for(n=0;nt.length?e.length:t.length,a="",o=0;os&&i.length/s>=2?l=Math.ceil(i.length/s):i.length=2&&(c=Math.ceil(s/i.length));for(var m=0;mt.length&&(r=t.length);for(var l=0;l0&&(l+1)%s==0&&(i+="|")}return i},e.parseTimeSigString=function(e){var t=e.split("/");if(2!=t.length)return[4,4];var n=parseInt(t[0],10),a=parseInt(t[1],10);return(n<1||n>32)&&(n=4),2!=a&&4!=a&&8!=a&&16!=a&&(a=4),[n,a]},e.getGrooveDataFromUrlString=function(t){var n,a,o,r,s,i=new e.grooveDataNew;i.debugMode=parseInt(e.getQueryVariableFromString("Debug",e.debugMode,t),10);var l=e.parseTimeSigString(e.getQueryVariableFromString("TimeSig","4/4",t));for(i.numBeats=l[0],i.noteValue=l[1],i.timeDivision=parseInt(e.getQueryVariableFromString("Div",16,t),10),i.notesPerMeasure=e.calc_notes_per_measure(i.timeDivision,i.numBeats,i.noteValue),i.metronomeFrequency=parseInt(e.getQueryVariableFromString("MetronomeFreq","0",t),10),i.numberOfMeasures=parseInt(e.getQueryVariableFromString("measures",1,t),10),i.numberOfMeasures<1||isNaN(i.numberOfMeasures)?i.numberOfMeasures=1:i.numberOfMeasures>constant_MAX_MEASURES&&(i.numberOfMeasures=constant_MAX_MEASURES),(n=e.getQueryVariableFromString("Stickings",!1,t))?i.showStickings=!0:(n=e.GetDefaultStickingsGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures),i.showStickings=!1),(a=e.getQueryVariableFromString("H",!1,t))||(e.getQueryVariableFromString("HH",!1,t),a||(a=e.GetDefaultHHGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures))),(o=e.getQueryVariableFromString("S",!1,t))||(o=e.GetDefaultSnareGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures)),(r=e.getQueryVariableFromString("K",!1,t))||(e.getQueryVariableFromString("B",!1,t),r||(r=e.GetDefaultKickGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures))),s=0;s<4;s++){var c=e.getQueryVariableFromString("T"+(s+1),!1,t);c?i.showToms=!0:c=e.GetDefaultTomGroove(i.notesPerMeasure,i.numBeats,i.noteValue,i.numberOfMeasures),i.toms_array[s]=e.noteArraysFromURLData("T"+(s+1),c,i.notesPerMeasure,i.numberOfMeasures)}i.sticking_array=e.noteArraysFromURLData("Stickings",n,i.notesPerMeasure,i.numberOfMeasures),i.hh_array=e.noteArraysFromURLData("H",a,i.notesPerMeasure,i.numberOfMeasures),i.snare_array=e.noteArraysFromURLData("S",o,i.notesPerMeasure,i.numberOfMeasures),i.kick_array=e.noteArraysFromURLData("K",r,i.notesPerMeasure,i.numberOfMeasures),i.title=e.getQueryVariableFromString("title","",t),i.title=decodeURIComponent(i.title),i.title=i.title.replace(/\+/g," "),i.author=e.getQueryVariableFromString("author","",t),i.author=decodeURIComponent(i.author),i.author=i.author.replace(/\+/g," "),i.comments=e.getQueryVariableFromString("comments","",t),i.comments=decodeURIComponent(i.comments),i.comments=i.comments.replace(/\+/g," "),i.tempo=parseInt(e.getQueryVariableFromString("tempo",constant_DEFAULT_TEMPO,t),10),(isNaN(i.tempo)||i.tempo<20||i.tempo>400)&&(i.tempo=constant_DEFAULT_TEMPO),i.swingPercent=parseInt(e.getQueryVariableFromString("swing",0,t),10),(isNaN(i.swingPercent)||i.swingPercent<0||i.swingPercent>100)&&(i.swingPercent=0);var m=e.getQueryVariableFromString("embedTempoTimeSig",!1,t);return i.embedTempoTimeSig="true"===m||"True"===m,i},e.getUrlStringFromGrooveData=function(t,n){var a=window.location.protocol+"//"+window.location.host+window.location.pathname;n&&("display"==n?a.includes("index.html")?a=a.replace("index.html","GrooveEmbed.html"):a.includes("/gscribe")?a=a.replace("/gscribe","/groove/GrooveEmbed.html"):a+="GrooveEmbed.html":"fullGrooveScribe"==n&&(a="https://www.mikeslessons.com/gscribe")),a+="?",t.debugMode&&(a+="Debug=1&"),t.viewMode&&(a+="Mode=view&"),t.grooveDBAuthoring&&(a+="GDB_Author=1&"),a+="TimeSig="+t.numBeats+"/"+t.noteValue,a+="&Div="+t.timeDivision,""!==t.title&&(a+="&Title="+encodeURIComponent(t.title)),""!==t.author&&(a+="&Author="+encodeURIComponent(t.author)),""!==t.comments&&(a+="&Comments="+encodeURIComponent(t.comments)),a+="&Tempo="+t.tempo,t.swingPercent>0&&(a+="&Swing="+t.swingPercent),a+="&Measures="+t.numberOfMeasures,0!==t.metronomeFrequency&&(a+="&MetronomeFreq="+t.metronomeFrequency);var o=t.notesPerMeasure*t.numberOfMeasures,r="&H=|"+e.tabLineFromAbcNoteArray("H",t.hh_array,!0,!0,o,t.notesPerMeasure),s="&S=|"+e.tabLineFromAbcNoteArray("S",t.snare_array,!0,!0,o,t.notesPerMeasure),i="&K=|"+e.tabLineFromAbcNoteArray("K",t.kick_array,!0,!0,o,t.notesPerMeasure);if(a+=r+s+i,t.showToms){var l="&T1=|"+e.tabLineFromAbcNoteArray("T1",t.toms_array[0],!0,!0,o,t.notesPerMeasure),c="&T4=|"+e.tabLineFromAbcNoteArray("T4",t.toms_array[3],!0,!0,o,t.notesPerMeasure);a+=l+c}return t.showStickings&&(a+="&Stickings=|"+e.tabLineFromAbcNoteArray("stickings",t.sticking_array,!0,!0,o,t.notesPerMeasure)),a},e.get_top_ABC_BoilerPlate=function(t,n,a,o,r,s,i,l,c,m){var u="%abc\n%%fullsvg _"+e.grooveUtilsUniqueIndex+"\nX:6\n";return u+="M:"+l+"/"+c+"\n",u+="T: "+n+"\n",""!==a&&(u+="C: "+a+"\n",u+="%%musicspace 20px\n"),m<400&&(m=400),m>3e3&&(m=3e3),u+="L:1/32\n",t?u+="%%stretchlast 0\n":u+="%%stretchlast 1\n",u+="%%flatbeams 1\n%%ornament up\n%%pagewidth "+(m=Math.floor(.75*m))+'px\n%%leftmargin 0cm\n%%rightmargin 0cm\n%%topspace 10px\n%%titlefont calibri 20\n%%partsfont calibri 16\n%%gchordfont calibri 16\n%%annotationfont calibri 16\n%%infofont calibri 16\n%%textfont calibri 16\n%%deco (. 0 a 5 1 1 "@-8,-3("\n%%deco ). 0 a 5 1 1 "@4,-3)"\n%%beginsvg\n \n \n \n \n%%endsvg\n%%map drum ^g heads=Xhead print=g % Hi-Hat\n%%map drum ^c\' heads=Xhead print=c\' % Crash\n%%map drum ^d\' heads=Xhead print=d\' % Stacker\n%%map drum ^e\' heads=Xhead print=e\' % Metronome click\n%%map drum ^f\' heads=Xhead print=f\' % Metronome beep\n%%map drum ^A\' heads=Xhead print=A\' % Ride\n%%map drum ^B\' heads=Trihead print=A\' % Ride Bell\n%%map drum ^D\' heads=Trihead print=g % Cow Bell\n%%map drum ^c heads=Xhead print=c % Cross Stick\n%%map drum ^d, heads=Xhead print=d, % Foot Splash\n',u+="%%staves (Stickings Hands Feet)\n",""!==o&&(u+="P: "+o+"\n",u+="%%musicspace 20px\n"),u+="K:C clef=perc\n",r&&(u+='V:Stickings\nx8 x8 x8 x8 x8 x8 x8 x8 ||\nV:Hands stem=up \n%%voicemap drum\n"^Hi-Hat"^g4 "^Open"!open!^g4 "^Crash"^c\'4 "^Stacker"^d\'4 "^Ride"^A\'4 "^Ride Bell"^B\'4 x2 "^Tom"e4 "^Tom"A4 "^Snare"c4 "^Buzz"!///!c4 "^Cross"^c4 "^Ghost "!(.!!).!c4 "^Flam"{/c}c4 x10 ||\nV:Feet stem=down \n%%voicemap drum\nx52 "^Kick"F4 "^HH foot"^d,4 x4 ||\nT:\n'),u},e.noteGroupingSize=function(t,n,a){var o;return e.isTripletDivisionFromNotesPerMeasure(t,n,a)?(2!=n&&4!=a&&console.log("Triplets are only supported in 2/4 and 4/4 time"),o=t/(n*(4/a))):o=3==n?t/3:n%6==0&&a%8==0?t/(2*n/6):t/n*(a/4),o},e.notesPerMeasureInFullSizeArray=function(e,t,n){return e?48*(t/n):32*(t/n)},e.getNoteScaler=function(t,n,a){var o;return!n||n<1||n>36?(console.log("Error in getNoteScaler, out of range: "+n),o=1):o=e.isTripletDivisionFromNotesPerMeasure(t,n,a)?Math.ceil(e.notesPerMeasureInFullSizeArray(!0,n,a)/t):Math.ceil(e.notesPerMeasureInFullSizeArray(!1,n,a)/t),o},e.scaleNoteArrayToFullSize=function(t,n,a,o,r){var s,i=e.getNoteScaler(a,o,r),l=[];if(e.isTripletDivisionFromNotesPerMeasure(a,o,r),1==i)return t;for(s=0;s=32&&(v=1),e.isTripletDivisionFromNotesPerMeasure(g,_,I))?function e(t,n,a,o,r,m,u,d,g,$,_,I,v){var p,M="",f="V:Stickings\n",b="V:Hands stem=up\n%%voicemap drum\n",O="V:Feet stem=down\n%%voicemap drum\n";p=$?[a,n,o]:[a,n],r&&(p=p.concat(r));for(var C=d,A=0;Ag&&(T=g-A%u),A%l(!0,_,I)==0){if(0==c(p,A,12))S=!0,f+="x8",b+="z8",A+=11;else if(0==c(p,A+1,11)){for(var y=A+1;y12&&0==c(p,A+1,5)&&0==c(p,A+7,5)){for(var N=A;N<=A+6;N+=6){for(var y=N+1;yd&&(A=d-b%d),C=b%l(!1,$,_)==0?l(!1,$,_):l(!1,$,_)-b%l(!1,$,_),b%d+C>d&&(C=d-b%d),b%l(!1,$,_)==0&&(p+=i([t],b,A,1,!0),g?(M+=i(O,b,A,1,!1),f=""):(M+=i(O,b,A,1,!1),f+=i([o],b,A,1,!1))),p+=s([t],b,C,1),g?(M+=s(O,b,C,1),f=""):(M+=s(O,b,C,1),f+=s([o],b,C,1)),b%l(!1,$,_)==l(!1,$,_)-1&&(p+=" ",M+=" ",f+=" "),(b+1)%(32/_*$)==0&&(p+="|",M+="|",f+="|"),b\n"},this.get_abcmodel=function(e,t,n){},this.anno_start=function(e,t,n,a,o,r,s){},this.svg_highlight_y=0,this.svg_highlight_h=44,this.anno_stop=function(t,n,a,o,r,s,i){"bar"==t&&(this.svg_highlight_y=r+5,this.svg_highlight_h=i+10),("note"==t||"grace"==t)&&(r=this.svg_highlight_y,i=this.svg_highlight_h,e.abc_obj.out_svg('\n'),"grace"!=t&&e.abcNoteNumIndex++)},this.img_out=function(e){this.abc_svg_output+=e},this.page_format=!0};e.renderABCtoSVG=function(t){return e.abc_obj=new Abc(m),e.myGrooveData&&e.myGrooveData.showLegend||e.isLegendVisable?e.abcNoteNumIndex=-15:e.abcNoteNumIndex=0,m.abc_svg_output="",m.abc_error_output="",e.abc_obj.tosvg("SOURCE",t),{svg:m.abc_svg_output,error_html:m.abc_error_output}},e.isElementOnScreen=function(e){var t=e.getBoundingClientRect();return t.top>=80&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},e.abcNoteNumCurrentlyHighlighted=-1,e.clearHighlightNoteInABCSVG=function(){if(e.abcNoteNumCurrentlyHighlighted>-1){for(var t=document.querySelectorAll("#abcNoteNum_"+e.grooveUtilsUniqueIndex+"_"+e.abcNoteNumCurrentlyHighlighted),n=0;n0)return u;if(""!==global_grooveUtilsScriptSrc){var e=global_grooveUtilsScriptSrc.lastIndexOf("/");e=global_grooveUtilsScriptSrc.lastIndexOf("/",e-1),u=global_grooveUtilsScriptSrc.slice(0,e+1)}return u.length<1&&(u="https://b125c4f8bf7d89726feec9ab8202d31e0c8d14d8.googledrive.com/host/0B2wxVWzVoWGYfnB5b3VTekxyYUowVjZ5YVE3UllLaVk5dVd4TzF4Q2ZaUXVsazhNSTdRM1E/"),u},e.getMidiSoundFontLocation=function(){return e.getGrooveUtilsBaseLocation()+"soundfont/"},e.getMidiImageLocation=function(){return e.getGrooveUtilsBaseLocation()+"images/"},e.midiEventCallbackClass=function(t){this.classRoot=t,this.noteHasChangedSinceLastDataLoad=!1,this.playEvent=function(e){var t=document.getElementById("midiPlayImage"+e.grooveUtilsUniqueIndex);t&&(t.className="midiPlayImage Playing"),e.playEventCallback&&e.playEventCallback()},this.loadMidiDataEvent=function(e,t){if(e.myGrooveData){e.myGrooveData.tempo=e.getTempo(),e.myGrooveData.swingPercent=e.getSwing();var n=e.create_MIDIURLFromGrooveData(e.myGrooveData);e.loadMIDIFromURL(n),e.midiEventCallbacks.noteHasChangedSinceLastDataLoad=!1}else console.log("can't load midi song. myGrooveData is empty")},this.doesMidiDataNeedRefresh=function(e){return e.midiEventCallbacks.noteHasChangedSinceLastDataLoad},this.pauseEvent=function(e){var t=document.getElementById("midiPlayImage"+e.grooveUtilsUniqueIndex);t&&(t.className="midiPlayImage Paused")},this.resumeEvent=function(e){},this.stopEvent=function(e){var t=document.getElementById("midiPlayImage"+e.grooveUtilsUniqueIndex);t&&(t.className="midiPlayImage Stopped")},this.repeatChangeEvent=function(e,t){t?document.getElementById("midiRepeatImage"+e.grooveUtilsUniqueIndex).src=e.getMidiImageLocation()+"repeat.png":document.getElementById("midiRepeatImage"+e.grooveUtilsUniqueIndex).src=e.getMidiImageLocation()+"grey_repeat.png"},this.percentProgress=function(e,t){},this.notePlaying=function(e,t,n){},this.midiInitialized=function(t){var n,a=document.getElementById("midiPlayImage"+t.grooveUtilsUniqueIndex);a&&(a.className="midiPlayImage Stopped"),document.getElementById("midiPlayImage"+t.grooveUtilsUniqueIndex).onclick=function(e){t.startOrStopMIDI_playback()},n=!1,document.onkeyup=function(e){17==e.which&&(n=!1)},document.onkeydown=function(t){return(17==t.which&&(n=!0),32==t.which&&("range"==t.target.type||"INPUT"!=t.target.tagName.toUpperCase()&&"TEXTAREA"!=t.target.tagName.toUpperCase()))?(e.startOrStopMIDI_playback(),!1):(179==t.which&&e.startOrPauseMIDI_playback(),178==t.which&&e.stopMIDI_playback(),!0)}}},e.midiEventCallbacks=new e.midiEventCallbackClass(e),e.setGrooveData=function(t){e.myGrooveData=t},e.midiNoteHasChanged=function(){e.midiEventCallbacks.noteHasChangedSinceLastDataLoad=!0},e.midiResetNoteHasChanged=function(){e.midiEventCallbacks.noteHasChangedSinceLastDataLoad=!1},e.MIDI_build_midi_url_count_in_track=function(t,n){var a=new Midi.File,o=new Midi.Track;a.addTrack(o),o.setTempo(e.getTempo()),o.setInstrument(0,19),o.addNoteOff(9,60,1);var r=128;8==n?r=64:16==n&&(r=32),o.addNoteOn(9,constant_OUR_MIDI_METRONOME_1,0,constant_OUR_MIDI_VELOCITY_NORMAL),o.addNoteOff(9,constant_OUR_MIDI_METRONOME_1,r);for(var s=1;s.99)&&(console.log("Swing percentage out of range in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays"),m=0),t.events.length<4&&t.addNoteOff(9,60,1);for(var $=e.isTripletDivisionFromNotesPerMeasure(l,u,d),_=e.getMetronomeOptionsOffsetClickStartRotation($),I=0,v=0;v0){var C=$?12:8,A=$?6:4,T=v;switch(_){case"1":break;case"E":$&&console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=2;break;case"AND":$&&console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=4;break;case"A":$&&console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=6;break;case"TI":$||console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=4;break;case"TA":$||console.log("OffsetClickStart error in MIDI_from_HH_Snare_Kick_Arrays"),T-=8;break;default:console.log("bad case in MIDI_from_HH_Snare_Kick_Arrays")}T>=0&&(0===T||T%(C*u*(4/d))==0?b=constant_OUR_MIDI_METRONOME_1:T%C==0&&(b=constant_OUR_MIDI_METRONOME_NORMAL),b||8!=i?b||16!=i||T%2!=0||(b=constant_OUR_MIDI_METRONOME_NORMAL,O=25):T%A==0&&(b=constant_OUR_MIDI_METRONOME_NORMAL)),!1!==b&&(t.addNoteOn(9,b,I,O),I=0)}if(!e.metronomeSolo){var h=constant_OUR_MIDI_VELOCITY_NORMAL,S=!1;switch(n[v]){case constant_ABC_HH_Normal:case constant_ABC_HH_Close:S=constant_OUR_MIDI_HIHAT_NORMAL;break;case constant_ABC_HH_Accent:"general_MIDI"==s?(S=constant_OUR_MIDI_HIHAT_NORMAL,h=constant_OUR_MIDI_VELOCITY_ACCENT):S=constant_OUR_MIDI_HIHAT_ACCENT;break;case constant_ABC_HH_Open:S=constant_OUR_MIDI_HIHAT_OPEN;break;case constant_ABC_HH_Ride:S=constant_OUR_MIDI_HIHAT_RIDE;break;case constant_ABC_HH_Ride_Bell:S=constant_OUR_MIDI_HIHAT_RIDE_BELL;break;case constant_ABC_HH_Cow_Bell:S=constant_OUR_MIDI_HIHAT_COW_BELL;break;case constant_ABC_HH_Crash:S=constant_OUR_MIDI_HIHAT_CRASH;break;case constant_ABC_HH_Stacker:S=constant_OUR_MIDI_HIHAT_STACKER;break;case constant_ABC_HH_Metronome_Normal:S=constant_OUR_MIDI_HIHAT_METRONOME_NORMAL;break;case constant_ABC_HH_Metronome_Accent:S=constant_OUR_MIDI_HIHAT_METRONOME_ACCENT;break;case!1:break;default:console.log("Bad case in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays")}!1!==S&&(!1!==g&&(t.addNoteOff(9,g,I),g=!1,I=0),t.addNoteOn(9,S,I,h),I=0,n[v]==constant_ABC_HH_Open&&(g=S));var y=constant_OUR_MIDI_VELOCITY_NORMAL,N=!1;switch(a[v]){case constant_ABC_SN_Normal:N=constant_OUR_MIDI_SNARE_NORMAL;break;case constant_ABC_SN_Flam:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_ACCENT):(N=constant_OUR_MIDI_SNARE_FLAM,y=constant_OUR_MIDI_VELOCITY_NORMAL);break;case constant_ABC_SN_Drag:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_ACCENT):(N=constant_OUR_MIDI_SNARE_DRAG,y=constant_OUR_MIDI_VELOCITY_NORMAL);break;case constant_ABC_SN_Accent:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_ACCENT):N=constant_OUR_MIDI_SNARE_ACCENT;break;case constant_ABC_SN_Ghost:"general_MIDI"==s?(N=constant_OUR_MIDI_SNARE_NORMAL,y=constant_OUR_MIDI_VELOCITY_GHOST):(N=constant_OUR_MIDI_SNARE_GHOST,y=constant_OUR_MIDI_VELOCITY_GHOST);break;case constant_ABC_SN_XStick:N=constant_OUR_MIDI_SNARE_XSTICK;break;case constant_ABC_SN_Buzz:N=constant_OUR_MIDI_SNARE_BUZZ;break;case!1:break;default:console.log("Bad case in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays")}!1!==N&&(t.addNoteOn(9,N,I,y),I=0);var R=!1,U=!1;switch(o[v]){case constant_ABC_KI_Splash:U=constant_OUR_MIDI_HIHAT_FOOT;break;case constant_ABC_KI_SandK:U=constant_OUR_MIDI_HIHAT_FOOT,R=constant_OUR_MIDI_KICK_NORMAL;break;case constant_ABC_KI_Normal:R=constant_OUR_MIDI_KICK_NORMAL;break;case!1:break;default:console.log("Bad case in GrooveUtils.MIDI_from_HH_Snare_Kick_Arrays")}if(!1!==R&&(t.addNoteOn(9,R,I,constant_OUR_MIDI_VELOCITY_NORMAL),I=0),!1!==U&&(!1!==g&&(t.addNoteOff(9,g,I),g=!1,I=0),t.addNoteOn(9,U,I,constant_OUR_MIDI_VELOCITY_NORMAL),I=0),r)for(var k=0;k0&&(r=o.getUTCHours()+":"+(10>o.getUTCMinutes()?"0":"")),r+=o.getUTCMinutes()+":"+(10>o.getSeconds()?"0":"")+o.getSeconds(),n.innerHTML='Total Play Time: '+r+' notes: '+global_total_midi_notes+' repetitions: '+global_total_midi_repeats+""}return global_last_midi_update_time=e,t},e.updateMidiPlayTime=function(){var t=e.getMidiPlayTime(),n=t.getUTCMinutes()+":"+(10>t.getSeconds()?"0":"")+t.getSeconds(),a=document.getElementById("MIDIPlayTime"+e.grooveUtilsUniqueIndex);a&&(a.innerHTML=n)},e.getTempo=function(){var t=document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex),n=constant_DEFAULT_TEMPO;return t&&(n=parseInt(t.value,10))<19&&n>281&&(n=constant_DEFAULT_TEMPO),n},e.tempoUpdate=function(t){document.getElementById("tempoTextField"+e.grooveUtilsUniqueIndex).value=""+t,g("tempoInput"+e.grooveUtilsUniqueIndex),e.midiNoteHasChanged(),e.tempoChangeCallback&&e.tempoChangeCallback(t)},e.tempoUpdateFromTextField=function(t){var n=t.target.value;document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex).value=n,e.tempoUpdate(n)},e.tempoUpdateFromSlider=function(t){e.tempoUpdate(t.target.value)},e.upTempo=function(){var t=e.getTempo();t++,e.setTempo(t)},e.downTempo=function(){var t=e.getTempo();t--,e.setTempo(t)},e.setTempo=function(t){t<19&&t>281||(document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex).value=t,e.tempoUpdate(t))},e.doesDivisionSupportSwing=function(t){return!e.isTripletDivision(t)&&4!=t},e.setSwingSlider=function(t){document.getElementById("swingInput"+e.grooveUtilsUniqueIndex).value=t,g("swingInput"+e.grooveUtilsUniqueIndex)},e.swingEnabled=function(t){e.swingIsEnabled=t,!1===e.swingIsEnabled?e.setSwing(0):e.swingUpdateText(e.getSwing())},e.getSwing=function(){var t=0;if(e.swingIsEnabled){var n=document.getElementById("swingInput"+e.grooveUtilsUniqueIndex);n&&((t=parseInt(n.value,10))<0||t>60)&&(t=0)}return t},e.swingUpdateText=function(t){!1===e.swingIsEnabled?document.getElementById("swingOutput"+e.grooveUtilsUniqueIndex).innerHTML="N/A":(document.getElementById("swingOutput"+e.grooveUtilsUniqueIndex).innerHTML=""+t+"%",e.swingPercent=t,e.midiNoteHasChanged())},e.setSwing=function(t){!1===e.swingIsEnabled&&(t=0),e.setSwingSlider(t),e.swingUpdateText(t)},e.swingUpdateEvent=function(t){!1===e.swingIsEnabled?e.setSwingSlider(0):(e.swingUpdateText(t.target.value),g("swingInput"+e.grooveUtilsUniqueIndex))},e.setMetronomeFrequencyDisplay=function(t){var n=document.getElementById("midiMetronomeMenu"+e.grooveUtilsUniqueIndex);n&&(n.className=n.className.replace(" selected",""),t>0&&(n.className+=" selected"))},e.loadFullScreenGrooveScribe=function(){var t=e.getUrlStringFromGrooveData(e.myGrooveData,"fullGrooveScribe");window.open(t,"_blank").focus()},e.metronomeMiniMenuClick=function(){e.myGrooveData.metronomeFrequency>0?e.myGrooveData.metronomeFrequency=0:e.myGrooveData.metronomeFrequency=4,e.setMetronomeFrequencyDisplay(e.myGrooveData.metronomeFrequency),e.midiNoteHasChanged()},e.expandOrRetractMIDI_playback=function(t,n){var a=document.getElementById("playerControl"+e.grooveUtilsUniqueIndex),o=document.getElementById("playerControlsRow"+e.grooveUtilsUniqueIndex),r=document.getElementById("tempoAndProgress"+e.grooveUtilsUniqueIndex),s=document.getElementById("midiMetronomeMenu"+e.grooveUtilsUniqueIndex),i=document.getElementById("midiGSLogo"+e.grooveUtilsUniqueIndex),l=document.getElementById("midiExpandImage"+e.grooveUtilsUniqueIndex),c=document.getElementById("MIDIPlayTime"+e.grooveUtilsUniqueIndex);a.className.indexOf("small")>-1||t&&n?(a.className=a.className.replace(" small","")+" large",o.className=o.className.replace(" small","")+" large",r.className=r.className.replace(" small","")+" large",s.className=s.className.replace(" small","")+" large",i.className=i.className.replace(" small","")+" large",l.className=l.className.replace(" small","")+" large",c.className=c.className.replace(" small","")+" large"):(a.className=a.className.replace(" large","")+" small",o.className=o.className.replace(" large","")+" small",s.className=s.className.replace(" large","")+" small",r.className=r.className.replace(" large","")+" small",i.className=i.className.replace(" large","")+" small",l.className=l.className.replace(" large","")+" small",c.className=c.className.replace(" large","")+" small")},e.HTMLForMidiPlayer=function(t){var n='
0:00';return t&&(n+=' '),n+='
BPM
SWING 0% swing
',t&&(n+=' '),n+="
"},e.AddMidiPlayerToPage=function(t,n,a){var o=document.getElementById(t);o&&(o.innerHTML=e.HTMLForMidiPlayer(a));var r=e.getBrowserInfo(),s=!1;"MSIE"==r.browser&&r.version<12&&(s=!0),(o=document.getElementById("tempoInput"+e.grooveUtilsUniqueIndex))&&(s?o.addEventListener("click",e.tempoUpdateFromSlider,!1):o.addEventListener("input",e.tempoUpdateFromSlider,!1)),(o=document.getElementById("tempoTextField"+e.grooveUtilsUniqueIndex))&&o.addEventListener("change",e.tempoUpdateFromTextField,!1),(o=document.getElementById("swingInput"+e.grooveUtilsUniqueIndex))&&(s?o.addEventListener("click",e.swingUpdateEvent,!1):o.addEventListener("input",e.swingUpdateEvent,!1)),(o=document.getElementById("midiRepeatImage"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.repeatMIDI_playback,!1),(o=document.getElementById("midiExpandImage"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.expandOrRetractMIDI_playback,!1),(o=document.getElementById("midiGSLogo"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.loadFullScreenGrooveScribe,!1),(o=document.getElementById("midiMetronomeMenu"+e.grooveUtilsUniqueIndex))&&o.addEventListener("click",e.metronomeMiniMenuClick,!1),e.swingEnabled(e.doesDivisionSupportSwing(n))}} \ No newline at end of file diff --git a/render.html b/render.html index 6ee9f46..7e2c1e6 100644 --- a/render.html +++ b/render.html @@ -17,34 +17,68 @@ - +
+ + +
+ \ No newline at end of file