//~ Revision: 400, Copyright (C) 2016-2020: Willem Vree, contributions Stéphane David, Pedro Martínez.
//~ 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. <http://www.gnu.org/licenses/gpl.html>.
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(b){var e=0;return function(){return e<b.length?{done:!1,value:b[e++]}:{done:!0}}};$jscomp.arrayIterator=function(b){return{next:$jscomp.arrayIteratorImpl(b)}};$jscomp.makeIterator=function(b){var e="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return e?e.call(b):$jscomp.arrayIterator(b)};
$jscomp.getGlobal=function(b){b=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,b];for(var e=0;e<b.length;++e){var h=b[e];if(h&&h.Math==Math)return h}return globalThis};$jscomp.global=$jscomp.getGlobal(this);$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,e,h){b!=Array.prototype&&b!=Object.prototype&&(b[e]=h.value)};$jscomp.polyfill=function(b,e,h,p){if(e){h=$jscomp.global;b=b.split(".");for(p=0;p<b.length-1;p++){var m=b[p];m in h||(h[m]={});h=h[m]}b=b[b.length-1];p=h[b];e=e(p);e!=p&&null!=e&&$jscomp.defineProperty(h,b,{configurable:!0,writable:!0,value:e})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(b){function e(){this.batch_=null}function h(b){return b instanceof m?b:new m(function(e,C){e(b)})}if(b&&!$jscomp.FORCE_POLYFILL_PROMISE)return b;e.prototype.asyncExecute=function(b){if(null==this.batch_){this.batch_=[];var e=this;this.asyncExecuteFunction(function(){e.executeBatch_()})}this.batch_.push(b)};var p=$jscomp.global.setTimeout;e.prototype.asyncExecuteFunction=function(b){p(b,0)};e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var b=
this.batch_;this.batch_=[];for(var e=0;e<b.length;++e){var h=b[e];b[e]=null;try{h()}catch(wa){this.asyncThrow_(wa)}}}this.batch_=null};e.prototype.asyncThrow_=function(b){this.asyncExecuteFunction(function(){throw b;})};var m=function(b){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var e=this.createResolveAndReject_();try{b(e.resolve,e.reject)}catch(bb){e.reject(bb)}};m.prototype.createResolveAndReject_=function(){function b(b){return function(C){h||(h=!0,b.call(e,C))}}var e=this,
h=!1;return{resolve:b(this.resolveTo_),reject:b(this.reject_)}};m.prototype.resolveTo_=function(b){if(b===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(b instanceof m)this.settleSameAsPromise_(b);else{a:switch(typeof b){case "object":var e=null!=b;break a;case "function":e=!0;break a;default:e=!1}e?this.resolveToNonPromiseObj_(b):this.fulfill_(b)}};m.prototype.resolveToNonPromiseObj_=function(b){var e=void 0;try{e=b.then}catch(bb){this.reject_(bb);return}"function"==
typeof e?this.settleSameAsThenable_(e,b):this.fulfill_(b)};m.prototype.reject_=function(b){this.settle_(2,b)};m.prototype.fulfill_=function(b){this.settle_(1,b)};m.prototype.settle_=function(b,e){if(0!=this.state_)throw Error("Cannot settle("+b+", "+e+"): Promise already settled in state"+this.state_);this.state_=b;this.result_=e;this.executeOnSettledCallbacks_()};m.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var b=0;b<this.onSettledCallbacks_.length;++b)x.asyncExecute(this.onSettledCallbacks_[b]);
this.onSettledCallbacks_=null}};var x=new e;m.prototype.settleSameAsPromise_=function(b){var e=this.createResolveAndReject_();b.callWhenSettled_(e.resolve,e.reject)};m.prototype.settleSameAsThenable_=function(b,e){var h=this.createResolveAndReject_();try{b.call(e,h.resolve,h.reject)}catch(wa){h.reject(wa)}};m.prototype.then=function(b,e){function h(b,e){return"function"==typeof b?function(e){try{p(b(e))}catch(ub){C(ub)}}:e}var p,C,x=new m(function(b,e){p=b;C=e});this.callWhenSettled_(h(b,p),h(e,C));
return x};m.prototype.catch=function(b){return this.then(void 0,b)};m.prototype.callWhenSettled_=function(b,e){function h(){switch(m.state_){case 1:b(m.result_);break;case 2:e(m.result_);break;default:throw Error("Unexpected state: "+m.state_);}}var m=this;null==this.onSettledCallbacks_?x.asyncExecute(h):this.onSettledCallbacks_.push(h)};m.resolve=h;m.reject=function(b){return new m(function(e,h){h(b)})};m.race=function(b){return new m(function(e,m){for(var p=$jscomp.makeIterator(b),x=p.next();!x.done;x=
p.next())h(x.value).callWhenSettled_(e,m)})};m.all=function(b){var e=$jscomp.makeIterator(b),p=e.next();return p.done?h([]):new m(function(b,m){function x(e){return function(h){C[e]=h;O--;0==O&&b(C)}}var C=[],O=0;do C.push(void 0),O++,h(p.value).callWhenSettled_(x(C.length-1),m),p=e.next();while(!p.done)})};return m},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(b,e){this.$jscomp$symbol$id_=b;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:e})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function b(h){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(h||"")+"_"+e++,h)}var e=0;return b}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.asyncIterator;b||(b=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(b){$jscomp.initSymbolIterator();b={next:b};b[$jscomp.global.Symbol.iterator]=function(){return this};return b};$jscomp.underscoreProtoCanBeSet=function(){var b={a:!0},e={};try{return e.__proto__=b,e.a}catch(h){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(b,e){b.__proto__=e;if(b.__proto__!==e)throw new TypeError(b+" is not extensible");return b}:null;$jscomp.generator={};$jscomp.generator.ensureIteratorResultIsObject_=function(b){if(!(b instanceof Object))throw new TypeError("Iterator result "+b+" is not an object");};
$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};
$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(b){this.yieldResult=b};$jscomp.generator.Context.prototype.throw_=function(b){this.abruptCompletion_={exception:b,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(b){this.abruptCompletion_={return:b};this.nextAddress=this.finallyAddress_};
$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(b){this.abruptCompletion_={jumpTo:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(b,e){this.nextAddress=e;return{value:b}};$jscomp.generator.Context.prototype.yieldAll=function(b,e){b=$jscomp.makeIterator(b);var h=b.next();$jscomp.generator.ensureIteratorResultIsObject_(h);if(h.done)this.yieldResult=h.value,this.nextAddress=e;else return this.yieldAllIterator_=b,this.yield(h.value,e)};
$jscomp.generator.Context.prototype.jumpTo=function(b){this.nextAddress=b};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(b,e){this.catchAddress_=b;void 0!=e&&(this.finallyAddress_=e)};$jscomp.generator.Context.prototype.setFinallyBlock=function(b){this.catchAddress_=0;this.finallyAddress_=b||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(b,e){this.nextAddress=b;this.catchAddress_=e||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(b){this.catchAddress_=b||0;b=this.abruptCompletion_.exception;this.abruptCompletion_=null;return b};$jscomp.generator.Context.prototype.enterFinallyBlock=function(b,e,h){h?this.finallyContexts_[h]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=b||0;this.finallyAddress_=e||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(b,e){e=this.finallyContexts_.splice(e||0)[0];if(e=this.abruptCompletion_=this.abruptCompletion_||e){if(e.isException)return this.jumpToErrorHandler_();void 0!=e.jumpTo&&this.finallyAddress_<e.jumpTo?(this.nextAddress=e.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=b};$jscomp.generator.Context.prototype.forIn=function(b){return new $jscomp.generator.Context.PropertyIterator(b)};
$jscomp.generator.Context.PropertyIterator=function(b){this.object_=b;this.properties_=[];for(var e in b)this.properties_.push(e);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var b=this.properties_.pop();if(b in this.object_)return b}return null};$jscomp.generator.Engine_=function(b){this.context_=new $jscomp.generator.Context;this.program_=b};
$jscomp.generator.Engine_.prototype.next_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,b,this.context_.next_);this.context_.next_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(b){this.context_.start_();var e=this.context_.yieldAllIterator_;if(e)return this.yieldAllStep_("return"in e?e["return"]:function(b){return{value:b,done:!0}},b,this.context_.return);this.context_.return(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],b,this.context_.next_);this.context_.throw_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(b,e,h){try{var p=b.call(this.context_.yieldAllIterator_,e);$jscomp.generator.ensureIteratorResultIsObject_(p);if(!p.done)return this.context_.stop_(),p;var m=p.value}catch(x){return this.context_.yieldAllIterator_=null,this.context_.throw_(x),this.nextStep_()}this.context_.yieldAllIterator_=null;h.call(this.context_,m);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var b=this.program_(this.context_);if(b)return this.context_.stop_(),{value:b.value,done:!1}}catch(e){this.context_.yieldResult=void 0,this.context_.throw_(e)}this.context_.stop_();if(this.context_.abruptCompletion_){b=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(b.isException)throw b.exception;return{value:b.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(b){this.next=function(e){return b.next_(e)};this.throw=function(e){return b.throw_(e)};this.return=function(e){return b.return_(e)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(b,e){e=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(e));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(e,b.prototype);return e};
$jscomp.asyncExecutePromiseGenerator=function(b){function e(e){return b.next(e)}function h(e){return b.throw(e)}return new Promise(function(p,m){function x(b){b.done?p(b.value):Promise.resolve(b.value).then(e,h).then(x,m)}x(b.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(b){return $jscomp.asyncExecutePromiseGenerator(b())};$jscomp.asyncExecutePromiseGeneratorProgram=function(b){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(b)))};
$jscomp.polyfill("globalThis",function(b){return b||$jscomp.global},"es_next","es3");$jscomp.iteratorFromArray=function(b,e){$jscomp.initSymbolIterator();b instanceof String&&(b+="");var h=0,p={next:function(){if(h<b.length){var m=h++;return{value:e(m,b[m]),done:!1}}p.next=function(){return{done:!0,value:void 0}};return p.next()}};p[Symbol.iterator]=function(){return p};return p};
$jscomp.polyfill("Array.prototype.keys",function(b){return b?b:function(){return $jscomp.iteratorFromArray(this,function(b){return b})}},"es6","es3");$jscomp.checkStringArgs=function(b,e,h){if(null==b)throw new TypeError("The 'this' value for String.prototype."+h+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+h+" must not be a regular expression");return b+""};
$jscomp.polyfill("String.prototype.endsWith",function(b){return b?b:function(b,h){var e=$jscomp.checkStringArgs(this,b,"endsWith");b+="";void 0===h&&(h=e.length);h=Math.max(0,Math.min(h|0,e.length));for(var m=b.length;0<m&&0<h;)if(e[--h]!=b[--m])return!1;return 0>=m}},"es6","es3");
$jscomp.polyfill("Array.from",function(b){return b?b:function(b,h,p){h=null!=h?h:function(b){return b};var e=[],x="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];if("function"==typeof x){b=x.call(b);for(var C=0;!(x=b.next()).done;)e.push(h.call(p,x.value,C++))}else for(x=b.length,C=0;C<x;C++)e.push(h.call(p,b[C],C));return e}},"es6","es3");
$jscomp.findInternal=function(b,e,h){b instanceof String&&(b=String(b));for(var p=b.length,m=0;m<p;m++){var x=b[m];if(e.call(h,x,m,b))return{i:m,v:x}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,h){return $jscomp.findInternal(this,b,h).v}},"es6","es3");$jscomp.polyfill("Math.log10",function(b){return b?b:function(b){return Math.log(b)/Math.LN10}},"es6","es3");
var follow_VERSION=400,pre_opt={},abc_arr,demoDlg,media_file,abc_enc,offset_js,times_arr,opt,lpRec,maat_duren;
(function(){function b(a,c,d){var f=F.createBufferSource();f.buffer=Yc[a];var b=F.createGain();b.gain.setValueAtTime(1E-5,d);c=cc*c/150;0==c&&(c=1E-5);b.gain.exponentialRampToValueAtTime(c,d+.003);f.connect(b);b.connect(F.destination);f.start(d,.025);dc[a]=[f,b,c];delete vb[a]}function e(a,c){var d=dc[a];if(d)if(ec)vb[a]=1;else{var f=$jscomp.makeIterator(d);d=f.next().value;var b=f.next().value;f=f.next().value;b.gain.setValueAtTime(f,c);b.gain.exponentialRampToValueAtTime(1E-5,c+.1);d.stop(c+.1);
dc[a]=void 0}}function h(a){var c="C Db D Eb E F Gb G Ab A Bb B".split(" "),d=a.shift();d?(c=MIDI.Soundfont.acoustic_grand_piano[c[d%12]+(Math.floor(d/12)-1)])?(c=c.split(",")[1],Zc(c,function(c){Yc[d]=c;$("#comp").append(", "+d);fc.push(""+d);$c[d]=1;h(a)})):h(a):(cb=1,y("midi nrs: "+fc.join(",")),$("#comp").toggle(!1))}function p(a){cb=0;a=Object.keys(a).filter(function(a){return!(a in $c)});0==aa&&(a=[]);a.length?($("#comp").toggle(!0),fc=[],h(a)):cb=1}function m(a){var c,d,f,b,r,g,e,w,h;return $jscomp.asyncExecutePromiseGeneratorProgram(function(q){switch(q.nextAddress){case 1:c=
a[0].link;d=c.split(".com/")[1];f=$jscomp.makeIterator(d.split("?"));b=f.next().value;r=f.next().value;g=r.split("&")[0];c="https://dl.dropboxusercontent.com/"+b+"?"+g;if(0<b.search(/\.(mp3|ogg)$/))return media_file=c,gc(),y("audio file, dbx: "+b+", key: "+g),B.addEventListener("loadedmetadata",function(a){y("audio duration: "+B.duration+" seconds")}),q.return();pre_opt={};wb();Q("#wait",1);y("dbx: "+b+", key: "+g);q.setCatchFinallyBlocks(2);return q.yield(fetch(c),4);case 4:return e=q.yieldResult,
q.yield(e.text(),5);case 5:w=q.yieldResult;y("preload: "+w.length+" bytes");x(w);Q("#wait",0);q.leaveTryBlock(0);break;case 2:h=q.enterCatchBlock(),$("#wait").append("\npreload failed: "+h),q.jumpToEnd()}})}function x(a){var c=a.slice(0,4E3);if(0<=c.indexOf("abc_arr = [")||0<=c.indexOf("import {"))a=encodeURIComponent(a),xb+=1,ad("data:text/javascript;charset=utf-8,"+a);else if(0<=c.indexOf("X:"))O(a),hc();else if(-1==c.indexOf("<?xml "))alert("not an xml file nor an abc file");else{a=$.parseXML(a);
c={p:"f",t:1,u:0,v:3,m:2,mnum:0};if(g.nbrk||l.nbrk)c.x=1;a=vertaal(a,c);a[1]&&y(a[1]);O(a[0]);hc()}}function C(){var a=new FileReader;a.onload=function(c){x(a.result);Q("#wait",0)};var c=$("#fknp").prop("files")[0];if(c){var d=c.name.toLowerCase();Q("#wait",1);d.endsWith(".ogg")||d.endsWith(".mp3")?(media_file=window.URL.createObjectURL(c),gc(),Q("#wait",0)):(pre_opt={},wb(),a.readAsText(c))}}function O(a,c){function d(a){var c,f={},d={};a=a.split("\n");for(c=0;c<a.length;++c){var b=a[c];if(0<=b.indexOf("%%map")){var q=
b.match(/%%map *(\S+) *(\S+).*midi=(\d+)/);b=b.match(/%%map *(\S+) /);if(q){b=q[1];var r=q[2];q=q[3];f[b+r]=parseInt(q)}else b&&(b=b[1],d[b]=1)}}return[d,f]}function f(a){var c={diamond:1,triangle:1,square:1,normal:1},f=b,d,q="default",r={"default":[]},g={"default":[]};var e=a.split("\n");for(d=0;d<e.length;++d){var k=e[d];if(0<=k.indexOf("I:percmap")){k=k.split(/\s+/).map(function(a){return a.trim()});if(5>k.length)return a;var w=k[4];w in c&&(w=w+"+,"+w);k="%%map perc"+q+" "+k[1]+" print="+k[2]+
" midi="+k[3]+" heads="+w;r[q].push(k)}0<=k.indexOf("%%MIDI")&&g[q].push(k);0<=k.indexOf("V:")&&(w=k.match(/V:\s*(\S+)/))&&(q=w[1],q in r||(r[q]=[],g[q]=[]))}a=Object.keys(r).sort();for(d=0;d<a.length;++d)f=f.concat(r[a[d]]);q="default";for(d=0;d<e.length;++d)k=e[d],0<=k.indexOf("I:percmap")||0<=k.indexOf("%%MIDI")||(0<=k.indexOf("V:")||0<=k.indexOf("K:")?((w=k.match(/V:\s*(\S+)/))&&(q=w[1]),f.push(k),q in g&&g[q].length&&(f=f.concat(g[q]),delete g[q]),0<=k.indexOf("perc")&&-1==k.indexOf("map=")&&
(k+=" map=perc"),0<=k.indexOf("map=perc")&&0<r[q].length&&f.push("%%voicemap perc"+q),0<=k.indexOf("map=off")&&f.push("%%voicemap")):f.push(k));return f.join("\n")}var b='%%beginsvg\n<defs>,<text id="x" x="-3" y="0">&#xe263;</text>,<text id="x-" x="-3" y="0">&#xe263;</text>,<text id="x+" x="-3" y="0">&#xe263;</text>,<text id="normal" x="-3.7" y="0">&#xe0a3;</text>,<text id="normal-" x="-3.7" y="0">&#xe0a3;</text>,<text id="normal+" x="-3.7" y="0">&#xe0a4;</text>,<g id="circle-x"><text x="-3" y="0">&#xe263;</text><circle r="4" class="stroke"></circle></g>,<g id="circle-x-"><text x="-3" y="0">&#xe263;</text><circle r="4" class="stroke"></circle></g>,<path id="triangle" d="m-4 -3.2l4 6.4 4 -6.4z" class="stroke" style="stroke-width:1.4"></path>,<path id="triangle-" d="m-4 -3.2l4 6.4 4 -6.4z" class="stroke" style="stroke-width:1.4"></path>,<path id="triangle+" d="m-4 -3.2l4 6.4 4 -6.4z" class="stroke" style="fill:#000"></path>,<path id="square" d="m-3.5 3l0 -6.2 7.2 0 0 6.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="square-" d="m-3.5 3l0 -6.2 7.2 0 0 6.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="square+" d="m-3.5 3l0 -6.2 7.2 0 0 6.2z" class="stroke" style="fill:#000"></path>,<path id="diamond" d="m0 -3l4.2 3.2 -4.2 3.2 -4.2 -3.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="diamond-" d="m0 -3l4.2 3.2 -4.2 3.2 -4.2 -3.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="diamond+" d="m0 -3l4.2 3.2 -4.2 3.2 -4.2 -3.2z" class="stroke" style="fill:#000"></path>,</defs>\n%%endsvg'.split(",");
null!=a.match(new RegExp(/V:\w+\s*tab.*voicemap/,"s"))?delete abc2svg.mhooks.strtab:ic&&(abc2svg.mhooks.strtab=ic);D=a;a=a.split("\n");g.nolyr&&a.splice(1,0,"%%writefields w "+!g.nolyr);0<g.hrz?a.splice(0,0,"%%singleline 1","%%maxshrink "+g.shrnk):a.splice(0,0,"%%measurenb 0");if(g.pw||g.hrz){var r=[],e;for(e=0;e<a.length;++e){var k=a[e];0<=k.indexOf("$")&&(k=k.replace(/\$/g,""));0==k.indexOf("I:linebreak")&&(k=a[e]);0==k.indexOf("V:")&&(k=k.replace(/snm="[^"]*"/,""));0!=k.indexOf("%%page")&&0!=k.indexOf("%%left")&&
0!=k.indexOf("%%right")&&(0==k.indexOf("%%scale")&&g.hrz||r.push(k))}a=r;g.hrz?a.splice(1,0,"%%scale "+g.scl):(r=g.pw,e=(.03*r).toFixed(1),k=(.01*r).toFixed(1),a.splice(1,0,"%%pagewidth "+r+"cm","%%leftmargin "+e+"cm","%%rightmargin "+k+"cm"))}a=a.join("\n");0<=a.indexOf("percmap")&&(a=f(a));if(0<=a.indexOf("%%map")){r=$jscomp.makeIterator(d(a));var w=r.next().value;r.next()}r=Ja=a;for(var h in w)w="%%voicemap "+h,e=w.replace("%voicemap","_________"),r=r.replaceAll(w,e);bb(r);wa(a,c)}function bb(a){function c(a){var c=
[];a.forEach(function(a,d){c[a.st]?c[a.st].push(d):c[a.st]=[d];a.clef.clef_octave&&(zb[d]=a.clef.clef_octave);db[a.st]=6*(a.stafflines||"|||||").length*(a.staffscale||1)});return c}var d="",f=[3,0,4,1,5,2,6],b=[0,2,4,5,7,9,11];ja=[];zb=[];var r=new Abc({img_out:null,errmsg:function(a,c,f){d+=a+"\n"},read_file:function(a){return""},anno_start:null,get_abcmodel:function(a,d,q){function r(a,c){e[a]=[0,0,0,0,0,0,0];k[a]={};w[a]=c;var d=0<=c;(d?f.slice(0,c):f.slice(c)).forEach(function(c){e[a][c]+=d?1:
-1})}var e={};q={"-2":-2,"-1":-1,0:0,1:1,2:2,3:0};var k={},w={},P={},h,n=d[0].meter.a_meter,l=60,m=384;n=n.length?n[0]:{top:"4",bot:4};for(h=0;h<d.length;++h)r(h,d[h].key.k_sf),P[h]={};Ab=d.length;V=c(d);d=0;for(var v=a;v;v=v.ts_next){var u=[];switch(v.type){case 14:m=v.tempo_notes.reduce(function(a,c){return a+c});l=v.tempo*m/384;0==v.time&&(d=1);break;case 10:d||0!=v.time||(pre_opt.tempo&&(l=pre_opt.tempo),pre_opt.tempo||times_arr||maat_duren||(pre_opt.tempo=l));var p={t:v.time,nt:-1,dur:v.dur,
nm:"",ntkb:-1};u.push(p);ja.push({t:v.time,ix:v.istart,v:v.v,dur:v.dur,ns:u,tmp:l,mtr:n,met:m,st:v.st});break;case 8:d||0!=v.time||(pre_opt.tempo&&(l=pre_opt.tempo),pre_opt.tempo||times_arr||maat_duren||(pre_opt.tempo=l));for(a=0;a<v.notes.length;++a){var x=v.notes[a];var y=x.pit+19;h=v.v;zb[h]&&(y+=zb[h]);p=Math.floor(y/7);var A=y%7;void 0!=x.acc&&(k[h][y]=q[x.acc]);var B=y in k[h]?k[h][y]:e[h][A];var C=[A,B];var z=12*p+b[A]+B;jc[z]=1;p={t:v.time,nt:z,dur:v.dur,nm:C,ntkb:z};y in P[h]?(P[h][y].dur+=
v.dur,x.tie_ty||delete P[h][y],p.nt=-1):x.tie_ty&&(P[h][y]=p);v.ti2&&v.notes.filter(function(a){return a.tie_s&&a.tie_s.midi==z}).length&&(p.nt=-1);u.push(p)}if(0==u.length)break;ja.push({t:v.time,ix:v.istart,v:v.v,dur:v.dur,ns:u,tmp:l,mtr:n,met:m,st:v.st});break;case 5:r(v.v,v.k_sf);break;case 0:r(v.v,w[v.v]);ja.push({t:v.time,ix:v.istart,v:v.v,bt:v.bar_type,tx:v.text});break;case 6:v.a_meter.length&&(n=v.a_meter[0])}}ka.forEach(function(a){var c=a.parentNode;c&&c.removeChild(a)});R=[];for(a=0;a<
Ab;++a)q=1<<a&0?"0":"",P=document.createElementNS("http://www.w3.org/2000/svg","rect"),P.setAttribute("fill",g.kleur[a%g.kleur.length]+q),P.setAttribute("fill-opacity",g.mat),P.setAttribute("width","0"),ka.push(P),R.push(-1),Ka[a]=[]}});r.tosvg("play","%%play");r.tosvg("abc2svg",a);""==d&&(d="no error");y(d)}function wa(a,c){var d="",f="",b=0;u=c||0;R[0]=-1;la=c||0;xa={};La=[];kc={};var r={},e,k,w=1E3,h=0,l=0;if(a){(function(){for(var c=a.split("\n"),d=0;d<c.length&&!(0<=c[d].search(/^%%score/)||
0<=c[d].search(/^I:score/));++d);ba&&d==c.length&&(alert("Staff extraction only works with ABC files that have a %%score declaration"),ba=0);if(ba){Bb=c[d];bd=d;var f="("+V[z].map(function(a){return a+1}).join(" ")+")";if(2==ba&&z+1 in V){var b=V[z+1].map(function(a){return a+1});f="{"+f+"("+b.join(" ")+")}"}c[d]="%%score"+Array(c[d].length-f.length-7+1).join(" ")+f}else Bb&&(c[bd]=Bb);a=c.join("\n")})();c={img_out:function(a){-1!=a.indexOf("<svg")&&(La[b]=Object.keys(r),r={},b+=1,e<w&&(w=e),k>h&&
(h=k),l&&(kc[l]=1),l=0);d+=a},errmsg:function(a,c,d){f+=a+"\n"},read_file:function(a){return""},anno_start:function(a,c,d,f,q,g,w){if("note"==a||"rest"==a)f=t.ax(f).toFixed(2),q=t.ay(q).toFixed(2),w=t.ah(w),xa[c]=[b,f,q,g,w];"bar"==a&&(q=t.ay(q),w=t.ah(w),q=Math.round(q+w),r[q]=1,k=t.ax(f)+g,e=Math.round(t.ax(0)),c in xa||(xa[c]=[b,k.toFixed(2),q,g,w],l=c))},get_abcmodel:null};0==g.hrz&&(c.imagesize='width="100%"');var t=new Abc(c);t.tosvg("abc2svg",a);""==f&&(f="no error");y(f);d&&($("#notation").html('<div id="leeg" style="height:500px">&nbsp;</div>'),
$("#notation").append(d),$("#notation").append('<div id="leeg" style="height:500px">&nbsp;</div>'),$("#leeg").click(function(){ca?ya():J(u)}),L=$("#notation svg"),da=Array(L.length),L.each(function(a,c){var d=c.querySelector(".g");da[a]=d?d:c}),da=$(da),L.children("title").remove(),cd(),dd(),L.click(function(a){var c,d;a.stopPropagation();var f=(a.clientX+G.scrollLeft)*eb;if(f<w+24||f>h)ca?ya():J(u);else{var b=$("#notation").position().top-$("#notation").scrollTop();var q=L.get().indexOf(this);var r=
(a.clientY-b-lc[q])*eb;b=La[q];for(a=0;a<b.length&&!W;a++)if(b[a]>r){a!=z&&Ma(ba?z:a);ma(!0);break}for(a=0;a<Ab;++a)Cb(a);var e=-1,k=-1;for(d=a=0;a<n.length;++a)if(c=n[a].xy)if(b=c[0],r=1*c[1],c=c[3],!(b<q&&0==d)){d=1;if(b>q||a==n.length-1){d=a-1;break}if(b==q&&f<r+c){d=a;break}if(r<k&&b<=e){d=a-1;break}e=b;k=r}g.lus&&W?(f=d,q=null,W==za&&(u==M&&(u=f),M=f,q=za,g.atagTijd=n[f].t,f>=na&&(u=f,g.atagTijd=-1)),W==Na&&(na=f,q=Na,g.btagTijd=n[f].t,f<=M&&(u=f,g.atagTijd=-1)),null!=q&&(q.classList.remove("tagselect"),
W=null,ac())):J(d);Oa()}}),Ma(z))}}function Xc(a){a.stopPropagation();a=a.currentTarget;if(W&&(W.classList.remove("tagselect"),a==W)){W=null;return}W=a;a.classList.add("tagselect")}function bc(a){g.lus&&(a<M||a>na)&&(a=M);u=la=a;for(Pa=0;Pa<=u;++Pa)Db(n[Pa],0);ma(!0)}function ac(a){function c(){var a=Object.keys(Qa).sort(function(a,c){return a-c}).map(function(a){return 1*a});a.unshift(0);for(var c=0,d=0;c<a.length&&a[c]<=n[u].t;)c+=1;for(;d<n.length&&n[d].t<a[c];)d+=1;return[n[u].t,n[d-1].t]}function d(a){for(var c=
0;c<n.length&&n[c].t!=a;++c)if(n[c].t>a)return c-1;return c}function f(a,c){var d=$("#chkmod").val(),f=$jscomp.makeIterator(n[c].xy);c=f.next().value;var b=f.next().value;f.next();var q=f.next().value;f.next();f=La[c];var g=ba||4==d?0:z,r=g,e=f.length-1;3==d&&(r=Math.min(r+1,e));4==d&&(r=e);b=a==za?b-12:1*b+q;a.setAttribute("x",b);a.setAttribute("y",f[g]-db[g]);a.setAttribute("width",12);a.setAttribute("height",f[r]-f[g]+db[g]);a.style.display="initial";da.eq(c).append(a);a.removeEventListener("click",
Xc);a.addEventListener("click",Xc)}a=void 0===a?1:a;if(!(0==n.length||u>n.length)){if(g.lus){if(0>g.atagTijd){var b=$jscomp.makeIterator(c());g.atagTijd=b.next().value;g.btagTijd=b.next().value}M=d(g.atagTijd);na=d(g.btagTijd);f(za,M);f(Na,na);ub(M,na+1);a&&S(0)}else za.remove(),Na.remove(),ub(0,n.length-1);Oa(1)}}function Yd(){times_arr&&(maat_duren=times_arr.reduce(function(a,c){return a.concat(c.slice(1))}).map(function(a,c,d){return 0==c?0:Math.round(100*(a-d[c-1]))/100}));var a=Object.keys(Qa).sort(function(a,
c){return a-c}).map(function(a){return 1*a});a.unshift(0);var c,d=0;for(c=1;c<maat_duren.length;++c){var f=a[c]-a[c-1];f=f/384*60/maat_duren[c];for(f=Math.round(100*f)/100;n[d].t<a[c]&&d<n.length;)n[d].tmp=f,d+=1}}function Zd(a){function c(a){Qa[t.t+m]=1;(t.ix in kc||"r"==a||"v"==a)&&N.push({t:t.t+m,xy:xa[t.ix],bt:a})}var d=0<u&&u<n.length?n[u].t:0;n=[];Qa={};N=[];oa=0;var f=$("#chkmod").val(),b=ja.filter(function(c){return!c.bt&&c.v in a}),r=ja.filter(function(c){return c.bt&&c.v in a}),e=b.map(function(a){return a.t});
e.push(r[r.length-1].t+1);var k=e.shift(),w=[];b=[];var h=[],l=[];for(r=0;r<ja.length;++r){var t=ja[r];if(t.t==k){for(;t.t==k;)k=e.shift();h.push(l);l=[]}t.t<k&&l.push(t)}h.push(l);k=1;var m=0,p=1,x=0,yb=0,y=0,A={};for(r=0;r<h.length;++r)for(l=h[r],b=w,w=[],e=0;e<l.length;++e){t=l[e];if(t.bt&&0==t.v){":"==t.bt[0]&&1==A[t.t]&&(k=1,A[t.t]=2);if(":"==t.bt[0]&&!A[t.t]){c("r");A[t.t]=1;r=p-1;k=2;m+=t.t-x;w=b;break}":"==t.bt[t.bt.length-1]&&(p=r,x=t.t);yb&&(t.tx||"|"!=t.bt)&&(yb=0,m-=t.t-y);2==k&&"1"==
t.tx&&(c("v"),yb=1,y=t.t)}if(yb){w=b;break}if(t.bt)c("l");else if(t.v in a||4==f){var v={};var B={};t.ns.sort(function(a,c){return c.nt-a.nt});if(1==f){w=w.concat(t.ns.slice(1));var z=t.ns[0];v[z.nt]=z.nm;B[z.ntkb]=z.nm;z=z.dur}else t.ns.forEach(function(a){v[a.nt]=a.nm;B[a.ntkb]=a.nm}),z=Math.max.apply(Math,t.ns.map(function(a){return a.dur}));1<Object.keys(v).length&&delete v[-1];n.push({t:t.t+m,xy:xa[t.ix],ptc:v,dur:z,ptckb:B,rst:b,tmp:t.tmp,vce:t.v,mtr:t.mtr,met:t.met,st:t.st});b=w}else t.ns.forEach(function(a){w.push({t:a.t+
m,nt:a.nt,dur:a.dur})})}$d(w);r=g.lat/1E3;g.syncon&&(times_arr||maat_duren)&&(Yd(r),r+=offset_js);fb=[];f=r;h=n[0].t;l=n[0].tmp;for(r=1;r<n.length;++r)fb.push(f),b=n[r].t,f+=60/l*(b-h)/384,h=b,l=n[r].tmp;for(u=0;u<n.length&&!(n[u].t>=d);++u);u==n.length&&--u;la=u;S(0);Aa()}function ub(a,c){for(gb=0;a<c;++a){var d=n[a];-1 in d.ptc||(gb+=Object.keys(d.ptc).length)}}function $d(a){var c,d=[];mc={};for(c=0;c<n.length;++c){var f=n[c];var b=Object.keys(f.ptc);var g=Object.keys(f.ptckb);b=b.filter(function(a){return-1!=
a});g=g.filter(function(a){return-1!=a});var e=b.map(function(a){return{mn:a,dur:f.dur,st:f.st,nm:f.ptc[a]}});if(k&&k.t==f.t)b.forEach(function(a){-1 in k.ptc&&delete k.ptc[-1];k.ptc[a]=f.ptc[a]}),g.forEach(function(a){-1 in k.ptckb&&delete k.ptckb[-1];k.ptckb[a]=f.ptckb[a]}),k.vxy[f.vce]=f.xy,k.xy||(k.xy=f.xy),f.xy&&1*f.xy[1]<1*k.xy[1]&&(k.xy=f.xy),k.pbk=k.pbk.concat(e),e.forEach(function(a){return k.durs[a.mn]=a.dur}),b.forEach(function(a){k.vcs[a]=f.vce}),k.vms[f.vce]=b,k.vmskb[f.vce]=g,k.nns=
Object.keys(k.vcs).length;else{f.pbk=e;f.durs={};e.forEach(function(a){return f.durs[a.mn]=a.dur});f.vxy={};f.vxy[f.vce]=f.xy;f.vcs={};b.forEach(function(a){f.vcs[a]=f.vce});f.vms={};f.vms[f.vce]=b;f.vmskb={};f.vmskb[f.vce]=g;f.nns=Object.keys(f.vcs).length;var k=f;d.push(f);mc[f.t]=d.length-1}}n=d;c=n[n.length-1];n.push({t:c.t+c.dur,xy:c.xy,ptc:c.ptc,dur:c.dur,rst:a,tmp:c.tmp});ka.forEach(function(a){a.setAttribute("width",0);a.setAttribute("height",0)});if(0<Ra)for(a=0;a<Ab;++a)Cb(a);(function(){for(var a=
[],c=0,d=0;c<n.length&&d<N.length;)n[c].t<N[d].t?(a.push({t:n[c].t,xy:n[c].xy,bt:""}),c+=1):(a.push(N[d]),d+=1);N=a})();n.forEach(function(a,c){return a.iseq=c})}function cd(){if(0!=L.length){var a=$("#notation").position().top-$("#notation").scrollTop();lc=L.map(function(c,d){return $(d).position().top-a}).get()}}function dd(){if(0!=L.length){var a=L.length-1,c=L.get(a);var d=c.getBoundingClientRect().width;try{var f=c.viewBox.baseVal.width}catch(q){f=d}0==f&&(f=d);a=da.get(a).transform.baseVal;
a=a.numberOfItems?a.getItem(0).matrix.a:1;eb=f/a/d}}function ma(a){if(!(0==R.length||0>R[Eb])){var c=$("#rollijn").offset().top+30-$("#notation").offset().top,d=ba?0:z;c=Math.round(lc[R[Eb]]+(La[R[Eb]][d]-db[d])/eb-c);c!=G.scrollTop&&(0<g.hrz?(hb&&(G.style["scroll-behavior"]="auto"),G.scrollTop=c):(hb&&(G.style["scroll-behavior"]=a?"smooth":"auto"),hb||!a?G.scrollTop=c:$(G).animate({scrollTop:c})))}}function ae(a){var c=a.split(",");a=parseInt(c[0]);a=mc[a];if(0<=a){H=c=c[1];var d=156.25/c,f=n[a];
Db(f);(g.lncur||g.hrz)&&ea(f.t+.1,d);if(0<aa){var b=pa();Object.keys(f.ptc).forEach(function(a){ib(b,a,f.dur*d)});n[a+1].rst.forEach(function(a){ib(b+(a.t-f.t)*d,a.nt,a.dur*d)})}}}function Db(a,c){c=void 0===c?!0:c;var d,f,b,e;Eb=a.vce;for(e in a.vxy){var h=ka[e];if(d=a.vxy[e]){var k=d[0];var l=d[1];var n=d[2];var m=d[3];d=d[4];var t=R[e];k!=t&&((t=h.parentNode)&&t.removeChild(h),da.eq(k).prepend(h),R[e]=k,c&&ma(!0));Fb=1;fa[e]||(fa[e]=g.kleur[e%g.kleur.length]);h.setAttribute("x",l);h.setAttribute("y",
n);h.setAttribute("width",m);h.setAttribute("height",d);h.setAttribute("fill",fa[e])}else h.setAttribute("width",0),h.setAttribute("height",0)}nc.value=Math.round(a.tmp*qa/(a.met/384));if(0<Ra){for(e in a.vmskb)Cb(e);for(e in a.vmskb)a.vmskb[e].forEach(function(c){f=document.getElementById(ed[c]);b=document.getElementById(fd[c]);Ka[e].push([f,b,c]);f.style.fill=g.kleur[e%g.kleur.length];var d=$jscomp.makeIterator(a.ptckb[c]);c=d.next().value;d=d.next().value;b.innerHTML=oc[c]+gd[d+2]})}}function pc(a,
c){a.t!=qc&&T.send(a.t+","+c);qc=a.t}function pa(){return 1==aa?1E3*F.currentTime:(new Date).getTime()-performance.timing.navigationStart}function Gb(a,c){if(0!=aa){if(1==aa&&cb){var d=a[0]&240,f=a[2],q=a[1];c/=1E3;128==d&&e(q,c);144==d&&(0<f?b(q,f,c):e(q,c));176==d&&64==q&&(64<=f?ec=1:(ec=0,Object.keys(vb).forEach(function(a){e(a,c)}),vb={}))}2==aa&&Hb&&Hb.send(a,c)}}function ib(a,c,d){-1!=c&&(c=[144,c,70],Gb(c,a),c[2]=0,Gb(c,a+d))}function hd(){if(0>ra&&(J(-1),!g.nocnt))return;var a=U,c=156.25/
H,d=pa();if(a.pbk){a.pbk.forEach(function(a){if(-1!=a.mn){var f=[144,a.mn,110];Ba({data:f});f[2]=0;Gb(f,d+a.dur*c-1)}});for(var f in a.vcs)if(-1!=f){var b=a.vcs[f];fa[b]=g.ntGoed;ka[b].setAttribute("fill",g.ntGoed)}}}function Oa(a,c){if(a){Ca=[];rc=Ib=Jb=sc=0;Aa();for(var d in ha)ha[d].remove();ha={};Sa={};id()}c||(ra=-1)}function be(a){a=Ca.map(function(a,c){return[c,a.laat]});var c=Ca.map(function(a,c){return[c+.2,a.duur[0]]}),d=Ca.map(function(a,c){return[c+.4,a.duur[1]||null]}),f=Ca.map(function(a,
c){return[c+.6,a.duur[2]||null]});Ta.style.display="block";$.plot("#flot",[{label:"timing",color:"rgba(0,128,0,0.5)",data:a,bars:{show:!0,barWidth:.5,align:"left"},yaxis:1},{label:"duration",color:"#a0522d",data:c,bars:{show:!0,barWidth:.1,align:"left"},yaxis:2},{label:"",color:"#a0522d",data:d,bars:{show:!0,barWidth:.1,align:"left"},yaxis:2},{label:"",color:"#a0522d",data:f,bars:{show:!0,barWidth:.1,align:"left"},yaxis:2}],{yaxes:[{position:"left",font:{color:"rgba(0,128,0,1)"},min:-500,max:500},
{position:"right",font:{color:"#602010"},min:-100,max:100}]})}function ea(a,c,d){function f(a,c){var d=N[oa];a<d.t&&(oa=0,d=N[0]);for(;a>=d.t;)oa+=1,d=N[oa];if(c>=d.t){h=1;if(d.t>n[u].t)return c=ea(n[u].t+.1,0,1);if(N[oa+1]&&N[oa+1].xy[1]<1*d.xy[1])return c=ea(d.t+.1,0,1)}c=N[oa-1];var f=(a-c.t)/(d.t-c.t);c=c.xy;a=c[0];var b=1*c[1];var q=1*d.xy[1];q<b&&(q=b+c[3],d.xy[1]=q);c=b+(q-b)*f;f=e;d=c;g.lncur||g.hrz?(a!=f&&((l=I.parentNode)&&l.removeChild(I),da.eq(a).prepend(I)),b=La[a],f=b[0]-db[0],b=b[b.length-
1]-f,q=g.oneclr?g.ntWacht:fa[0],I.setAttribute("x",d),I.setAttribute("y",f-6),I.setAttribute("width",2),I.setAttribute("height",b+12),q&&I.setAttribute("fill",q),I.setAttribute("fill-opacity",g.lncur?g.mat:0),g.hide2cur&&g.nocur&&I.setAttribute("fill-opacity",0)):((l=I.parentNode)&&l.removeChild(I),cancelAnimationFrame(Ua));e=a;0<g.hrz&&(a=c/eb-G.scrollLeft,G.scrollLeft+=a-G.clientWidth/3)}function b(d){0==m&&(m=d);a+=(d-m)/c;k=a+25/c;f(a,k);m=d;h&&6!=g.volgmod?cancelAnimationFrame(Ua):Ua=requestAnimationFrame(b)}
var e=-1,h=0,k,l;cancelAnimationFrame(Ua);var m=0;d?f(a):Ua=requestAnimationFrame(b)}function S(a,c,d){u+=a;0>u&&(u=0);E=0<u&&!d?n[u-1]:n[u];var f=n[u],b=pa(),e=H;tc=H;d=(b-uc)/vc;a&&!wc&&Va&&d<jb&&d>xc&&(e=Math.round(e/(1<=d?1+.5*(d-1):1-.5*(1-d))),H=e=kb>e?kb:e,qa=e/E.tmp,Kb());var h=156.25/e,k=jd=h,m=E.t,p=(f.t-m)*h;E.tmp!=f.tmp&&(H=f.tmp*qa,k=156.25/H);var x=f.dur*k;d=1;var t=p;if(a&&X&&!B.ended){B.paused&&Lb(-1);var y=B.currentTime-fb[u-1];l.lat&&$("#deb").html((1E3*y).toFixed(0)+" msec");!Va&&
g.syncon&&(p-=1E3*y,0>p&&(p=0),d=p/t,.3>d&&(d=.3));clearTimeout(kd);kd=setTimeout(function(){B.pause()},p+g.tmo)}var z=-1;!a&&!c||g.rstmute||f.rst.forEach(function(a){var c=(a.t-m)*h;ib(b+c,a.nt,a.dur*h);Wa&&c!=z&&(z=c,setTimeout(function(){pc(a,e)},c))});if(u==n.length-1)ld=setTimeout(function(){for(var a in K)yc(U,a,K[a]);J(-1)},p),(g.lncur||g.hrz)&&ea(m,h*d);else{if(g.lus&&(u>na||u<M)){if(g.lusstop&&a){setTimeout(function(){J(-1)},p);return}M<n.length&&(u=la=M,f=n[u],setTimeout(function(){Oa(1,
1);X&&lb&&Lb()},p))}wc=1==a&&-1 in f.ptc;mb||wc?(g.mute||f.pbk.forEach(function(a){ib(b+p,a.mn,a.dur*k)}),clearTimeout(nb),nb=setTimeout(function(){S(1)},p)):Mb&&a&&(c=(f.t-m)*ce,clearTimeout(nb),nb=setTimeout(function(){S(1)},c));c=p>x?.5*x:.5*p;g.exact&&Nb&&(c=0);c=p-c;var A=md?p-c:0;0==a?(sa={},K={},U=f,fa={},ob||(ia={}),bc(u),X&&(B.currentTime=fb[u]),E=f,(g.lncur||g.hrz)&&ea(f.t+.1,h,1),Wa&&(pc(f,e),qc=-1)):((g.lncur||g.hrz)&&ea(m,h*d),nd=setTimeout(function(){if(mb)for(var a in U.vcs)a in sa||
-1==a||(K[U.vcs[a]]=1);for(var c in K)yc(U,c,K[c]);K={};sa={};U=f;fa={};Fb=0;ra=b+p;clearTimeout(zc);zc=setTimeout(function(){Db(f);for(var a in ia)Ac(a,1);ia={}},A)},c),Wa&&(od=setTimeout(function(){pc(f,e)},p)));uc=b;vc=p;Da&&(m in Qa||0==m)&&Bc(1)}}function pd(){clearTimeout(nb);clearTimeout(nd);clearTimeout(zc);clearTimeout(od);clearTimeout(ld);cancelAnimationFrame(Ua)}function Lb(a){B.currentTime=fb[u+(void 0===a?0:a)];return B.play()}function de(a,c){function d(a,d){a.stopPropagation();if(" "==
d||"Enter"==d||"Escape"==d)c(),f.close()}var f=document.getElementById("errDlg"),b=document.createElement("button");f.innerHTML=a;f.append(b);b.append("Ok");b.addEventListener("keydown",function(a){return d(a,a.key)});b.addEventListener("click",function(a){return d(a,"Enter")});f.showModal()}function J(a,c){function d(a){Q("#unlkDlg",0);X=0;de("<p>Audio file could not be loaded.</p>",function(a){Ob=0;$("#btrk").toggle(!1);$("#spkr").toggle(!1);media_file="";ta.value="start"})}c=void 0===c?!0:c;n.length&&
("stop"==ta.value||0<=a?(ta.value="start",lb=0,qd(),mb=0,pd(),ra=-1,la=u=0<=a?a:la,S(0,0,1),g.ftyp&&rd(),0>a&&window.parent.postMessage(sd.innerHTML,"*")):(ta.value="stop",tc=H=E.tmp*qa,"running"!=F.state&&F.resume().then(function(){y("audio context now running")}),Ob&&0==X?(ra=0,Q("#unlkDlg",1),Lb().then(function(a){Q("#unlkDlg",0);X=1;td(c)}).catch(function(a){d(a)})):td(c)))}function ud(a){for(var c=n[u].t,d=u;d<n.length&&0<=d;d+=a){var f=n[d].t;if(f!=c&&(f in Qa||0==f)){bc(d);g.lncur&&ea(n[d].t+
.1,0,1);break}}}function vd(a){var c,d=Infinity;for(c=u;c<n.length&&0<=c;c+=a)if(n[c].xy)if(e){var f=$jscomp.makeIterator(n[c].xy);var b=f.next().value;f=f.next().value;b==h+a&&Math.abs(e-f)<d&&(d=Math.abs(e-f),u=c);if(1==a&&b>h+a)break;if(-1==a&&b<h+a)break}else{var e=$jscomp.makeIterator(n[c].xy);var h=e.next().value;e=e.next().value}bc(u);g.lncur&&ea(n[u].t+.1,0,1)}function ee(a){var c=a.key;"Escape"==c&&("block"==Ta.style.display?Ta.style.display="none":ya());if(!(ca&&"m"!=c||a.altKey||a.ctrlKey)&&
("m"==c&&$("#mbar").click(),D)){var d=1;switch(c){case "ArrowLeft":case "Left":a.shiftKey?S(-1):ud(-1);break;case "ArrowUp":case "Up":a.shiftKey?wd(-1):vd(-1);break;case "ArrowRight":case "Right":a.shiftKey?hd():ud(1);break;case "ArrowDown":case "Down":a.shiftKey?wd(1):vd(1);break;case "c":case " ":a.shiftKey?hd():J(-1);break;default:d=0}d&&a.preventDefault()}}function fe(a){var c=a.key;if(" "==c||"Enter"==c)a.stopPropagation(),a={mbar:1,mbar2:2,mbar3:3,mbar4:4},c=document.activeElement.id,c in a&&
pb(a[c])}function ge(){function a(a){if("#"!=a[0])return a;var c=parseInt(a[1]+a[1],16),f=parseInt(a[2]+a[2],16);a=parseInt(a[3]+a[3],16);return"rgba("+c+","+f+","+a+","+g.mat+")"}Ea={};g.ntKleur.forEach(function(a,d){Ea[d+1]=a});Cc=document.getElementById("sgd");Dc=document.getElementById("se1");Ec=document.getElementById("se2");Fc=document.getElementById("se3");Gc=document.getElementById("pct");xd=document.getElementById("stot");Dc.style.background=a(Ea[1]);Ec.style.background=a(Ea[2]);Fc.style.background=
a(Ea[4]);Aa()}function Aa(){if(gb&&Cc){var a=rc*g.pnlerr,c=Jb*g.pnltim,d=sc*g.pnlkrt,f=100*(Ib-a-(g.tmng?c:0)-(g.tmng2?d:0))/gb;0>f&&(f=0);var b=$jscomp.makeIterator(["rgba(255,0,0,0.3)","rgba(0,191,255,0.5)","rgba(0,255,0,0.5)"]),e=b.next().value,h=b.next().value;b=b.next().value;var k=f.toFixed(0);g.scal&&(Cc.innerHTML=Ib,Dc.innerHTML=a,Ec.innerHTML=c,Fc.innerHTML=d,xd.innerHTML=gb);Gc.innerHTML=k;Gc.style.background=50>f?e:85>f?h:b;g.lus?localStorage.setItem("loopscore",k):localStorage.setItem("score",
k)}}function he(a){var c=Hc[a]-ra,d=Math.abs(c);g.tmng&&d>g.late1&&(Jb+=1,d>g.late2&&(Jb+=1),a=U.vcs[a],K[a]=(K[a]||0)|2);Ca[U.iseq]={laat:c,duur:[]}}function Ac(a,c){var d=U;if(d){c||(Hc[a]=pa());Object.keys(d.ptc);if(0>ra&&(60==a||a in d.ptc)){if(1==Y){ia[a]=1;return}J(-1,60==a);if(!g.nocnt&&60==a||-1 in d.ptc)return}if(lb)if(a==g.stopat)J(-1);else if(Object.keys(sa).length==d.nns||-1 in d.ptc)ia[a]=1;else{if(a in d.vcs)sa[a]=1,Pb[a]=d,c=d.vcs[a],d.vms[c].every(function(a){return a in sa})&&(fa[c]=
g.ntGoed,Fb&&ka[c].setAttribute("fill",g.ntGoed),he(a));else{rc+=1;Aa();for(var f in d.vcs)f in sa||-1==f||(c=d.vcs[f],fa[c]=g.ntFout,K[c]=(K[c]||0)|1,Fb&&ka[c].setAttribute("fill",g.ntFout))}Object.keys(sa).length==d.nns&&(Ib+=d.pbk.length,Aa(),mb||S(1))}}}function yd(a){if(g.tmng2&&Pb[a]){var c=Pb[a],d=c.durs[a]*jd,f=Hc[a]+d-pa();d=100*f/d;delete Pb[a];if((0>d?-d:d)>g.kort&&(0>f?-f:f)>g.minkort)if(sc+=1,Aa(),a=c.vcs[a],c.iseq==U.iseq)K[a]=(K[a]||0)|4;else{f=c.iseq+","+a;var b=ha[f];b?(Sa[f]|=4,
b.setAttribute("fill",Ea[Sa[f]])):yc(c,a,4)}(c=Ca[c.iseq])&&c.duur.push(d)}}function yc(a,c,d){if(-1 in a.ptc)console.log("rust fout",a.iseq,c,d);else{var f=a.iseq+","+c,b=a.vxy[c];if(b){a=b[0];c=b[1];var e=b[2],h=b[3];b=b[4];var k=document.createElementNS("http://www.w3.org/2000/svg","rect");k.setAttribute("x",c);k.setAttribute("y",e);k.setAttribute("width",h);k.setAttribute("height",b);k.setAttribute("fill",Ea[d]);k.setAttribute("fill-opacity",g.metmrk?g.mat:0);da.eq(a).prepend(k);ha[f]=k;Sa[f]=
d}}}function rd(){for(var a in ha){var c=Sa[a],d=ha[a],f=$jscomp.makeIterator(a.split(",")),b=f.next().value;f=f.next().value;var e=$jscomp.makeIterator(n[b].vxy[f].map(function(a){return 1*a}));e.next();b=e.next().value;f=e.next().value;var g=e.next().value,h=e.next().value;e=document.createElementNS("http://www.w3.org/2000/svg","text");e.setAttribute("x",b+g);e.setAttribute("y",f+h);e.setAttribute("font-size","12");e.setAttribute("class","tfout");c=document.createTextNode(c);e.appendChild(c);d.parentElement.append(e)}}
function id(){var a=document.getElementsByClassName("tfout");Array.from(a).forEach(function(a){return a.remove()})}function zd(){for(var a=pa(),c=0;3>c;++c)ib(a,60+2*c,300),a+=310}function Ba(a){var c=a.data[0],d=a.data[1],f=a.data[2];254!=c&&(c&=240,128==c&&(delete ia[d],yd(d)),144==c&&(0<f?Ac(d):(delete ia[d],yd(d))),g.echo&&Gb(a.data,pa()))}function ie(a){y("MIDI ready! Listening to following input ports:");var c=0;a.inputs.forEach(function(a){a.onmidimessage=Ba;y(c+": "+a.name+', "'+a.manufacturer+
'"');c++});y("The following output ports are present:");var d=$("#portsel");a=a.outputs;c=0;a.forEach(function(a){y(c+": "+a.name+', "'+a.manufacturer+'"');d.append('<option value="'+c+'">'+a.name+"</option>");Ad.push(a);Hb=a;c++})}function je(a){y("Failed to get MIDI access - "+a)}function ke(a){var c=$("#portsel").val();"synth"==c?(aa=1,a&&p(jc)):"nosound"==c?aa=0:(aa=2,a=parseInt(c),Hb=Ad[a]);zd()}function le(){var a,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){if(1==d.nextAddress)return"requestMIDIAccess"in
navigator?navigator.requestMIDIAccess().then(ie,je):(a="Web MIDI API is not supported in this browser: try Chrome or Opera",a+=" (on iOS you can try the ",a+='<a href="https://apps.apple.com/us/app/web-midi-browser/id953846217">',a+="Web Midi Browser</a>)",$("#notation").append("<br>"+a),y(a)),$("#ble").prop("disabled",!("bluetooth"in navigator)),d.yield(me(),2);c=d.yieldResult;""==c&&hc();d.jumpToEnd()})}function Ma(a){a in V||(a=0);pd();var c={};V[a].forEach(function(a){c[a]=1});if(3==$("#chkmod").val()){var d=
a;a+1 in V?d=a+1:a-1 in V&&(a=d=a-1);V[d].forEach(function(a){c[a]=1})}R.forEach(function(a,c,d){d[c]=-1});g.lus&&(M=0,na=Infinity);Ja&&Zd(c);z=a;ac(0)}function wd(a){z+=a;0>z&&(z=0);z>=V.length&&(z=0);Ma(z)}function ya(){ca=0;$(".hfd").toggle(!1);$(".down").toggleClass("down",!1)}function pb(a){ca==a?ya():(ya(),ca=a,$(".hfd").eq(a-1).toggle(!0),$(".mknop").eq(a-1).toggleClass("down",!0))}function Bd(){Ic.style.fill="none";if(Da||Y)Qb=setTimeout(Bc,Jc)}function qd(){Y=0;ob=Da=!1;clearTimeout(Qb);
$("#countin").toggle(!1);Bd();X&&B.pause()}function td(a){var c={"2/2":2,"3/2":3,"4/2":4,"2/4":2,"3/4":3,"4/4":4,"5/4":5,"3/8":3,"6/8":2,"7/8":3,"9/8":3,"11/8":4,"12/8":4};$("#start").blur();if(Da||Y)qd();else{Oa(1);Kb();var d=E.mtr.top+"/"+E.mtr.bot;Y=a&&!g.nocnt?c[d]+1:1;ob=6==g.volgmod;$("#countin").html("<b>"+Y+"</b>").toggle(!0);Bc()}}function Bc(a){Ic.style.fill="red";var c=F.createBufferSource();c.buffer=Cd;var d=F.createGain();d.gain.setValueAtTime(a?3:1,0);c.connect(d);d.connect(F.destination);
c.start(0,.06,.16);Jc=3E4/tc*(E.met/384);clearTimeout(Qb);Qb=setTimeout(Bd,Jc);if(0<Y&&(--Y,$("#countin").html("<b>"+Y+"</b>"),0==Y)){$("#countin").toggle(!1);lb=1;Da=g.metro;uc=ra=pa();ob?(mb=1,X&&Lb(),S(0,0,1),ob=0):g.eenvoor?S(0,1):(vc=0,-1 in n[u].ptc&&S(1));for(var b in ia)Ac(b,1);ia={}}}function Zc(a,c){a=atob(a);for(var d=new ArrayBuffer(a.length),b=new Uint8Array(d),e=0;e<a.length;e++)b[e]=a.charCodeAt(e);F.decodeAudioData(d,function(a){c(a)},function(a){console.log("decode error: "+a);cb=
0})}function Dd(){g.syncon=Kc.checked;lb&&J(-1);D&&Ma(z);E&&(H=qa*E.tmp)}function Rb(a){$("#spkron").toggle(!a);$("#spkrof").toggle(a);$("#spkron2").toggle(!a);$("#spkrof2").toggle(a);a?(Ed=g.vol1,g.vol1=0):g.vol1=Ed||100;ua.value=g.vol1;B.volume=g.vol1/100;B.muted=a}function me(){var a,c,d,b,e,g,h,k,m,n,p,t,u,z,A;return $jscomp.asyncExecutePromiseGeneratorProgram(function(f){switch(f.nextAddress){case 1:t=k=d=c="";a=window.location.href.replace("?dl=0","").split("?");if(b=a[0].match(/:\/\/([^/:]+)/))m=
b[1];if(!(1<a.length)){f.jumpTo(2);break}g=a[1].split("&");for(h=0;h<g.length;h++)e=g[h].replace(/d:(\w{15}\/[^.]+\.)/,"https://dl.dropboxusercontent.com/s/$1"),(b=e.match(/tmp=([\d.]*)/))?l.tempo=parseFloat(b[1]):(b=e.match(/stf=(\d+)/))?l.staff=parseInt(b[1]):(b=e.match(/mod=(\d+)/))?l.chkmod=parseInt(b[1]):(b=e.match(/fmd=(\d+)/))?l.volgmod=parseInt(b[1]):(b=e.match(/opa=(\d)/))?l.kbopa=parseInt(b[1]):(b=e.match(/line=(\d+)/))?l.line=parseInt(b[1]):(b=e.match(/pw=(\d+)/))?l.pw=parseInt(b[1]):(b=
e.match(/scl=([\d.]*)/))?l.scl=parseFloat(b[1]):(b=e.match(/hrz=(\d+)/))?l.hrz=parseInt(b[1]):(b=e.match(/tb=([\d.]*)/))?l.btime=parseFloat(b[1]):(b=e.match(/te=([\d.]*)/))?l.etime=parseFloat(b[1]):(b=e.match(/begin=([\d]+)/))?l.begin=parseInt(b[1]):(b=e.match(/shrnk=([\d.]*)/))?l.shrnk=parseFloat(b[1]):(b=e.match(/lat=([+-]?[\d]+)/))?l.lat=parseInt(b[1]):(b=e.match(/vol=([\d]*)/))?l.vol=parseInt(b[1]):(b=e.match(/pnlerr=([\d.]*)/))?l.pnlerr=parseFloat(b[1]):(b=e.match(/pnltim=([\d.]*)/))?l.pnltim=
parseFloat(b[1]):(b=e.match(/pnlkrt=([\d.]*)/))?l.pnlkrt=parseFloat(b[1]):(b=e.match(/late1=([\d]*)/))?l.late1=parseInt(b[1]):(b=e.match(/late2=([\d]*)/))?l.late2=parseInt(b[1]):(b=e.match(/kort=([\d]*)/))?l.kort=parseInt(b[1]):(b=e.match(/minkort=([\d]*)/))?l.minkort=parseInt(b[1]):(b=e.match(/stopat=([\d]*)/))?l.stopat=parseInt(b[1]):(b=e.match(/hinfo=(\d+)/))?l.hinfo=parseInt(b[1]):(b=e.match(/mat=([\d.]+)/))?l.mat=parseFloat(b[1]):(b=e.match(/kleur=([#\dabcdef,]+)/))?l.kleur=b[1].split(","):(b=
e.match(/tmo=(\d+)/))?l.tmo=parseInt(b[1]):(b=e.match(/d:(\w{21}\/[\w.]+)/))?n="https://dl.dropboxusercontent.com/scl/fi/"+b[1]:(b=e.match(/rlkey=(\w+)/))?t=n+"?rlkey="+b[1]:"ip"==e&&m?l.ipadr=m:"ipm"==e&&m?(l.ipadr=m,l.mstr=1):"metro"==e?l.metro=1:"nocnt"==e?l.nocnt=1:"nodel"==e?l.delay=0:"keyb"==e?l.keys=1:"ksh"==e?l.mark=1:"nosnd"==e?l.portsel="nosound":"nobar"==e?l.nobar=1:"nomenu"==e?l.nomenu=1:"extr"==e?l.extract=2:"extrg"==e?l.extract=3:"nocur"==e?l.nocur=1:"mute"==e?l.mute=1:"rstmute"==e?
l.rstmute=1:"nosm"==e?hb=!1:"tmng"==e?l.tmng=1:"tmng2"==e?l.tmng2=1:"lncur"==e?l.lncur=1:"oneclr"==e?l.oneclr=1:"nolyr"==e?l.nolyr=1:"hide2cur"==e?l.hide2cur=1:"metmrk"==e?l.metmrk=1:"ftyp"==e?l.ftyp=1:"scal"==e?l.scal=1:"noecho"==e?l.echo=0:"nbrk"==e?l.nbrk=1:t=e,p=t.split("?")[0],/(\.xml$)|(\.abc$)/.test(p)?c=t:/(\.mp3$)|(\.mp4$)|(\.ogg$)|(\.webm$)/.test(p)?k=t:d=t;k&&(media_file=decodeURIComponent(k).replace("www.dropbox","dl.dropboxusercontent"));(d||c)&&Q("#wait",1);if(c)return f.setCatchFinallyBlocks(7),
f.yield(fetch(c),9);if(!d){f.jumpTo(2);break}return f.yield(ad(d),2);case 9:return u=f.yieldResult,f.yield(u.text(),10);case 10:z=f.yieldResult;y("preload: "+z.length+" bytes");x(z);Q("#wait",0);f.leaveTryBlock(2);break;case 7:A=f.enterCatchBlock(),$("#wait").append("\npreload failed: "+A);case 2:return f.return(d||c)}})}function ad(a){var c,b;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){switch(d.nextAddress){case 1:return 0<=a.indexOf("dropbox.com")&&(a+="?dl=1"),0!=a.indexOf("data:text")&&
-1==a.indexOf("http")&&(a="./"+a),d.setCatchFinallyBlocks(2),d.yield(import(a),4);case 4:c=d.yieldResult;y("preload loaded");var f=c;if(f.pre_opt){media_file=f.media_file;pre_opt=f.pre_opt;abc_arr=f.abc_arr;for(var e in f.defaults)e in pre_opt||(pre_opt[e]=f.defaults[e])}wb();x(abc_arr.join("\n"));Q("#wait",0,!T||l.mstr);d.leaveTryBlock(3);break;case 2:b=d.enterCatchBlock(),$("#wait,#err").append("\npreload failed:\n"+b);case 3:d.jumpToEnd()}})}function Sb(a,c){var b=document.getElementById(a),f=
b?b.type:void 0;void 0!=c&&(g[a]=c);"checkbox"==f&&(b.checked=g[a]);if("number"==f||"select-one"==f)b.value=g[a];void 0!=c&&Fa(a)}function hc(){for(var a in pre_opt)g[a]=pre_opt[a];for(a in l)g[a]=l[a];for(a in Tb)Sb(a);for(a in g)Fa(a,0);Ob=X=0;gc();Xa.addEventListener("input",function(){g.vol=Xa.value;cc=g.vol/25});Xa.addEventListener("change",function(){Xa.blur()});ua.addEventListener("input",function(){g.vol1=ua.value;B.volume=g.vol1/100;0==g.vol1?Rb(!0):B.muted&&Rb(!1)});ua.addEventListener("change",
function(){ua.blur();B.muted||B.volume==g.vol1/100||alert("iOS forbids changing the volume with javascript (Apple policy)")});Xa.value=g.vol;ua.value=g.vol1;B.volume=ua.value/100;cc=g.vol/25;p(jc);Ja&&(g.pw||g.hrz||g.nolyr?O(D,u):wa(Ja,u),Fa("begin",1));l.ipadr&&(ne(l.ipadr),l.mstr||L.off());demoDlg&&($("#demoDlg span").html(demoDlg),$("#demoDlg").toggle(!0),$("#demoDlg button").on("mouseup touchend keydown blur",function(a){a.stopPropagation();$("#demoDlg").toggle(!1);$("#demoDlg button").off("mouseup touchend keydown blur")}).focus());
ge()}function gc(){media_file&&(B.src=media_file,Ob=1,$("#btrk").toggle(!0),$("#spkr").toggle(!0));Fd=media_file||""}function oe(){if(D){var a='media_file = "'+(Fd||"")+'";\n',c="",b="",f=[];if(maat_duren){for(c="offset_js = "+offset_js.toFixed(2)+";\n";maat_duren.length;)f.push(maat_duren.splice(0,10).toString());b="maat_duren = ["+f.join(",\n")+"];\n"}f=D.split("\n").map(function(a){return JSON.stringify(a)});f="abc_arr = ["+f.join(",\n")+"];\n";g.staff=z+1;g.line=Math.round(100*$("#rollijn").position().top/
$("body").height());g.begin=la;for(var e=("pre_opt = "+JSON.stringify(g)+";").split(","),h=[],l="";e.length;){for(;80>l.length&&e.length;)l+=e.splice(0,1)+",";h.push(l);l=""}h=h.join("\n").replace(/,$/,"\n");a=a+c+h+b+f;c="data:text/plain;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(a)));$("#saveDlg pre").text(a);$("#saveDlg").toggle(!0);$("#div3 a").attr("href",c);$("#saveok").focus()}}function pe(a){Mb=!1;kb=0;$("#mtplab").toggle(!1);Va=1;jb=Mb?10:3;xc=1/jb;g.volgmod=$("#volgmod").val();
switch(g.volgmod){case "5":$("#mtplab").toggle(!0);kb=g.mtpo;break;case "6":Va=0;break;case "7":Va=0}a&&Sb("delay",!Va);Oa()}function Kb(){X&&(B.playbackRate=qa)}function qe(a){a.stopPropagation();a.preventDefault();a.target.style.fill="red";a=Lc[a.target.id];Mc[a]=1;Ba({data:[144,a,110]})}function Gd(a){a.stopPropagation();a.preventDefault();var c=Lc[a.target.id];c in Mc&&(delete Mc[c],Ba({data:[144,c,0]}),a.target.style.fill=Nc(c))}function Nc(a){return a%12 in Hd?"black":60==a?"#9cc":"white"}function re(){Hd=
{1:1,3:1,6:1,8:1,10:1};for(var a=[0,2,4,5,7,9,11,1,3,6,8,10],c=[],b=0;8>b;++b)for(var f=0;12>f;++f)c.push(12*b+a[f]+12);a=$("#toetsen rect");for(f=0;f<a.length;++f)b=$(a[f]),Lc[a[f].id]=c[f],ed[c[f]]=a[f].id,b.on("mousedown touchstart",qe),b.on("mouseup touchend",Gd),b.on("mouseleave",Gd),a[f].style.fill=Nc(c[f]);a=$("#toetsen text");for(f=0;f<a.length;++f)fd[c[f]]=a[f].id}function Id(){var a=$("#toetsen")[0].scrollWidth-$("body").width();$("#keyb").scrollLeft(a/2)}function Ga(){var a=Z&&0==Oc?$("#keyb").height():
$("#err").height(),c=$("body").height(),b=$("#info").height();b=Math.round(100*b/c);a=Math.round(100*a/c);$("#notation").css("height",100-b-a+"%")}function Jd(a){var c=$("#toetsen svg"),b=c.width();b=100*b/$("body").width();c.css("width",b+a+"%");Id()}function se(){for(var a=$("#octaaf"),c=0;8>c;++c){var b=a.clone();b.find("rect").each(function(a,b){b.id+="-"+c});b.find("text").each(function(a,b){b.id+="-"+c});$("#toetsen").append(b)}re()}function te(a){if(Z&&"zoom"==a.target.id){a.stopPropagation();
a.preventDefault();var c="touchstart"==a.type,b=$("#zoom"),f=c?a.originalEvent.touches[0].clientX:a.pageX,e=c?a.originalEvent.touches[0].clientY:a.pageY,g=$("#keyb").height(),h=$("#keyb").scrollLeft();b.css("cursor","row-resize").toggleClass("spel",!0);b.on("mousemove touchmove",function(a){a.stopPropagation();a.preventDefault();var b=c?a.originalEvent.touches[0].clientX:a.clientX;a=c?a.originalEvent.touches[0].clientY:a.clientY;Math.abs(a-e)>Math.abs(b-f)?(b=g+e-a,a=$("body").height(),b=Math.floor(100*
b/a),$("#keyb").css("height",b+"%"),$("#zoom").css("bottom",b+"%"),$("#kblft").css("bottom",b+"%"),$("#kbrgt").css("bottom",b+"%")):$("#keyb").scrollLeft(h+f-b)});b.on("mouseup touchend mouseleave",function(a){a.stopPropagation();a.preventDefault();b.css("cursor","initial").toggleClass("spel",!1);b.off("mousemove touchmove mouseup touchend mouseleave");Ga()})}}function ue(a){if("info"==a.target.id||"error"==a.target.id||""==a.target.id){a.stopPropagation();a.preventDefault();var c="touchstart"==a.type,
b=$("#info"),f=c?a.originalEvent.touches[0].clientY:a.pageY,e=b.height();$("#notation").height();b.css("cursor","row-resize").toggleClass("spel",!0);b.on("mousemove touchmove",function(a){a.stopPropagation();a.preventDefault();var d=$("body").height();a=e+(c?a.originalEvent.touches[0].clientY:a.clientY)-f;b.css("height",Math.floor(100*a/d)+"%");g.hinfo=a;Ga()});b.on("mouseup touchend mouseleave",function(a){a.stopPropagation();a.preventDefault();b.css("cursor","initial").toggleClass("spel",!1);b.off("mousemove touchmove mouseup touchend mouseleave");
Ga();ma()})}}function ve(a){gd=["&#9837;&#9837;","&#9837;","","&#9839;","&#9839;&#9839;"].map(function(a){return'<tspan dy="-5">x</tspan>'.replace("x",a)});for(var b=document.querySelectorAll("#toetsen text"),d=0;d<b.length;++d)b[d].setAttribute("dx",2==a?-3:0);1==Ra?oc="CDEFGAB".split(""):2==Ra&&(oc="Do Re Mi Fa So La Ti".split(" "))}function Cb(a){Ka[a]&&(Ka[a].forEach(function(a){var b=$jscomp.makeIterator(a);a=b.next().value;var c=b.next().value;b=b.next().value;a.style.fill=Nc(b);c.innerHTML=
""}),Ka[a]=[])}function Kd(a){function b(){f&&(Jd(d?-1:1),setTimeout(b,200))}var d=0,f=0;a=$(a);a.on("mousedown touchstart",function(a){a.stopPropagation();a.preventDefault();a.currentTarget.children[1].style.fill="red";d="kblft"==a.currentTarget.id;f=1;b()});a.on("mouseup touchend mouseleave",function(a){a.stopPropagation();a.preventDefault();f&&(a.currentTarget.children[1].style.fill="rgba(0,255,0,0.3)",f=0)})}function we(a){a.preventDefault();var b="touchstart"==a.type,d=$("#rollijn");d.css("cursor",
"row-resize").toggleClass("spel",!0);d.on("mousemove touchmove",function(a){$("#notation").offset();a=b?a.originalEvent.touches[0].clientY:a.clientY;$("#rollijn").css("top",a-15+"px");ma()});d.on("mouseup touchend mouseleave",function(a){d.off("mousemove touchmove mouseup touchend mouseleave");d.css("cursor","initial").toggleClass("spel",!1)})}function y(a,b){b||(a+="\n");$("#err").append(a)}function ne(a){T?y("websocket already open"):(T=new WebSocket("ws://"+a+":8091/"),T.onmessage=function(a){a=
a.data;"master"==a?($("#mbar").css("background","rgba(255,0,0,0.2)"),Wa=1):Wa||ae(a)},T.onerror=function(a){y("socket error (server inaccessible?)");T=null},T.onopen=function(a){$("#mbar").css("background","rgba(0,255,0,0.2)");l.mstr&&T.send("master");y("connection opened")},T.onclose=function(a){$("#mbar").css("background","");y("connection closed: "+a.code);T=null;Wa=0})}function wb(){g={};Ja="";for(var a in Tb)g[a]=Tb[a];for(a in Ld)g[a]=Ld[a];for(a in Tb)Sb(a);for(a in g)Fa(a,0)}function Fa(a,
b,d){switch(a){case "tempo":H=g.tempo||(E?E.tmp:60);qa=E?H/E.tmp:1;Kb();break;case "mtpo":kb=g.mtpo;break;case "chkmod":D&&b&&Ma(z);break;case "delay":md=g[a];break;case "exact":Nb=6!=g.volgmod;if(a=document.getElementById("exact"))a.disabled=!Nb;if(a=document.getElementById("delay"))a.disabled=g.exact&&Nb;break;case "volgmod":pe(d);Fa("exact");break;case "portsel":ke(d);break;case "keys":Z=$("#keys").prop("checked");$("#marklbl").toggle(Z);$("#keyb").toggle(Z);$("#zoom").toggle(Z);$("#kblft").toggle(Z);
$("#kbrgt").toggle(Z);$("#rek").toggle(Z);Z?Jd(0):Id();Ga();break;case "mark":Ra=g[a];ve(Ra);for(var c in Ka)Cb(c);n.length&&Db(n[u]);break;case "kbopa":Oc=g[a]/10;$("#keyb").css("opacity",1-Oc);Ga();break;case "hinfo":a=$("body").height();a=Math.floor(100*g.hinfo/a);$("#info").css("height",a+"%");Ga();break;case "pw":g.pw=parseFloat(g[a]);5>g.pw&&(delete g.pw,$("#pw").val(""));D&&b&&O(D);break;case "scl":g.scl=parseFloat(g[a]);if(.1>g.scl||2<g.scl)delete g.scl,$("#scl").val("");D&&b&&O(D);break;
case "nolyr":D&&b&&O(D,u);break;case "lus":b&&ac();$("#stoplbl").toggle(!!g.lus);break;case "metro":Da&&(Da=!1);break;case "extract":ba=g.extract-1;0==ba&&(Bb="");D&&b&&wa(Ja);break;case "micuse":g.micuse?xe():Pc();break;case "syncon":Dd();case "gain":Md();break;case "drempel":ye();break;case "minlev":Nd();case "bass":Ya=$("#bass").prop("checked")?1024:512;Ha&&Od();break;case "staff":z=g.staff-1;D&&b&&Ma(z);break;case "line":$("#rollijn").css("top",g.line+"%");ma();break;case "begin":u=la=g.begin;
D&&b&&S(0);break;case "lncur":D&&g.lncur&&ea(n[u].t+.1,0,1);g.lncur||I.setAttribute("fill-opacity",0);break;case "nocur":ka.forEach(function(a){return a.setAttribute("fill-opacity",g.nocur?0:g.mat)});g.hide2cur&&I.setAttribute("fill-opacity",g.nocur?0:g.lncur?g.mat:0);break;case "metmrk":for(var e in ha)ha[e].setAttribute("fill-opacity",g.metmrk?g.mat:0);break;case "drpuse":ze();break;case "nobar":$("#info").toggle(!1);$("#err").toggle(!1);$("#notation").css("height","100%");ma();break;case "nomenu":$("#menu").toggle(!1);
break;case "hrz":b&&(g.hrz=g.hrz?50:0);$("#pwlbl").toggle(0==g.hrz);$("#scllbl").toggle(0<g.hrz);D&&b&&O(D);break;case "tmng":case "tmng2":case "scal":$("#sgd").parent().toggle(!!g.scal);$("#se2").parent().toggle(!(!g.tmng||!g.scal));$("#se3").parent().toggle(!(!g.tmng2||!g.scal));$("#stot").parent().toggle(!!g.scal);Aa();break;case "ftyp":g.ftyp?rd():id()}}function Qc(a){a=$(this).attr("type")||this.type;var b=$(this).attr("id");"checkbox"==a&&(g[b]=$(this).prop("checked"));if("number"==a||"select-one"==
a||"range"==a)g[b]=$(this).val();Fa(b,1,1)}function ze(){function a(a){$("#drpuse").prop("checked",!a);$("#drpuse").attr("disabled",a);$("#drplbl").css("color",a?"#aaa":"#000")}function b(){var a=$("#drpuse").prop("checked");$(".dropbox-dropin-btn").css("display",a?"inline-block":"none");$("#fknp").css("display",a?"none":"inline-block")}if("undefined"==typeof Dropbox){a(!0);var d;$.ajax({url:"https://www.dropbox.com/static/api/2/dropins.js",dataType:"script",cache:!0}).done(function(){a(!1);Dropbox.init({appKey:"ckknarypgq10318"});
d=Dropbox.createChooseButton({success:m,extensions:[".xml",".abc",".js",".mp3",".ogg"],cancel:function(){},linkType:"preview",multiselect:!1});$("#flbl").append(d);b()})}else b()}function Pd(a){var b,d,e=0,g=-1,h=Math.floor(a.length/2),l=0,k=Infinity;Ia=Array(h);var m=h/2;for(d=3;d<h;d++){var n=0;var p=Math.floor(m-d/2);a[p]>l&&(l=a[p]);for(b=p;b<p+h;b++){var t=a[b]-a[b+d];n+=t*t}e+=n;n*=(d-2)/e;Ia[d]=n;if(n<k)k=n,g=d;else if(.1>k)break}d=Ia[g+1];b=Ia[g];a=Ia[g-1];return{period:g+((a-d)/(d-2*b+a)/
2||0),diff:k,max:l}}function Qd(a){Ha.getFloatTimeDomainData(Za);var b=Pd(Za),d=b.period/a;d=1.06>d&&.94<d;if(b.diff<qb&&0<b.diff&&b.max>Rc||.65>b.diff&&d){var e=F.sampleRate/b.period;d||va||(va=Math.round(69+12*Math.log(e/440)/Math.log(2)),e=[144,va,110],Ba({data:e}),console.log("micNote on:",va,b.max.toFixed(2),b.diff.toFixed(2),d));a=b.period}else va&&(e=[144,va,0],Ba({data:e}),console.log("micNote off",va,b.max.toFixed(2),b.diff.toFixed(2),d),va=0),a=1;Ub=setTimeout(function(){Qd(a)},0)}function Nd(){var a=
parseInt(g.minlev),b=2.5*(40+a),d=$("#mxlvl").width();$("#levmrk").css("width",d*b/100+"px");Rc=Math.pow(10,a/20);$("#mval").html(a)}function ye(){var a=parseFloat(g.drempel);qb=a/10;$("#dval").html(a);Rd()}function Md(){var a=parseFloat(g.gain);rb&&(rb.gain.value=Math.pow(10,(a+1)/2-3));$("#gval").html(a)}function Od(){Ha.fftSize=4*Ya;Za=new Float32Array(Ha.frequencyBinCount)}function Pc(){sb&&(sb.getAudioTracks().forEach(function(a){a.stop()}),Sc.disconnect(),sb=null,cancelAnimationFrame(Vb),clearTimeout(Ub));
$("#micuse").prop("checked",!1);$("#micon").prop("checked",!1);$("#micKnop").css("background","")}function xe(){function a(a){sb=a;Sc=F.createMediaStreamSource(a);rb=F.createGain();Ha=F.createAnalyser();Od();Sc.connect(rb);rb.connect(Ha);Md();Sd();$("#micKnop").css("background","orange");$("#micon").prop("checked",!0);$("#micuse").prop("checked",!0);Sb("delay",!1)}function b(a){alert("Can not access the microphone!\n"+a.name+": "+a.message);Pc()}if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)navigator.mediaDevices.getUserMedia({audio:!0}).then(a).catch(b);
else{navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia;try{navigator.getUserMedia({audio:!0},a,b)}catch(d){alert("getUserMedia() not supported by your browser -> no microphone\n"+d.name+": "+d.message),Pc()}}}function Ae(){var a=document.getElementById("micon");g.micuse=a.checked;Fa("micuse",0)}function Sd(){sb&&(cancelAnimationFrame(Vb),clearTimeout(Ub),Td?Vb=requestAnimationFrame(function(){Ud(1)}):Ub=setTimeout(function(){Qd(1)},0))}function Vd(a){$("#tuner").toggle(a);
a&&($("#micuse").focus(),Nd());ca&&ya();Td=a;Sd()}function Ud(a){var b=performance.now();Ha.getFloatTimeDomainData(Za);var d=Pd(Za),e=d.period/a;a=1.06>e&&.94<e;e=69+12*Math.log(F.sampleRate/d.period/440)/Math.log(2);b=(performance.now()-b).toFixed(2);if(d.diff<qb&&0<d.diff&&d.max>Rc||.65>d.diff&&a){a=d.period;a=Math.round(e);var g=Be[a%12]+Math.floor(a/12);Wb.innerHTML=g;e=Math.round(100*(e-a));Tc.push(e);$a+=(e-Tc.shift())/30;tb.innerHTML=Math.round($a);0<=$a?(tb.style.width="50%",Xb.style.width=
$a+"%"):(tb.style.width=50+$a+"%",Xb.style.width=-$a+"%");ab.style.background="#cc0";Wb.style.background="#cc0"}else g="---",a=1,ab.style.background="orange",Wb.style.background="none";Rd();A.strokeStyle="green";A.beginPath();A.moveTo(0,256-128*Ia[0]);e=Ya/512;for(a=1;a<Ya;a+=e)A.lineTo(a/e,256-128*Ia[a]);A.stroke();A.beginPath();A.moveTo(d.period/e,256);A.strokeStyle="red";A.lineTo(d.period/e,245);A.stroke();d=20*Math.log10(d.max);Uc=2.5*(40+d);Uc>Yb?(Yb=Uc,ab.innerHTML=d.toFixed(0),Zb=Za.slice()):
--Yb;ab.style.width=Yb+"%";b>Vc&&(Vc=b);20==Wd++&&($b.style.width=Math.min(10*b,100)+"%",$b.innerHTML=b,Wd=Vc=0);if(Zb){A.strokeStyle="grey";A.beginPath();A.moveTo(0,128-32*Zb[0]);e=Ya/512;for(a=1;a<Ya;a+=e)A.lineTo(a/e,128-32*Zb[a]);A.stroke()}Vb=requestAnimationFrame(function(){Ud(1)})}function Rd(){A.clearRect(0,0,512,256);A.beginPath();A.moveTo(0,256-128*qb);A.strokeStyle="blue";A.setLineDash([5,3]);A.lineTo(512,256-128*qb);A.stroke();A.setLineDash([])}function Ce(){var a=document.body,b=a.requestFullscreen||
a.mozRequestFullScreen||a.webkitRequestFullscreen,d=document.exitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen;b&&d&&($("#fscr").prop("checked")?b.call(a):d.call(document))}function De(){var a;navigator.bluetooth.requestDevice({filters:[{services:["03b80e5a-ede8-4b33-a751-6ce34ec4c700"]}]}).then(function(a){var b=a.gatt.connect();y("BLE Connected: "+a.name+", "+a.id.substring(0,5)+"...");return b}).then(function(a){return a.getPrimaryService("03b80e5a-ede8-4b33-a751-6ce34ec4c700")}).then(function(a){return a.getCharacteristic("7772e5db-3868-4112-a1a9-f2669d106bf3")}).then(function(b){a=
b;return a.startNotifications()}).then(function(b){y("Midi notifications started");a.addEventListener("characteristicvaluechanged",Ee)}).catch(function(a){y(a.toString())})}function Ee(a){var b=a.target.value.getUint8(2),d=a.target.value.getUint8(3);a=a.target.value.getUint8(4);Ba({data:[b,d,a]})}function Q(a,b,d){d=void 0===d?1:d;b?($(a).toggle(!0),xb+=1,ta.disabled=!0):($(a).toggle(!1),--xb,0==xb&&d&&(ta.disabled=!1))}var xa={},n=[],u=0,R=-1,lc,eb,Hb,Ad=[],sa={},Ja,aa=0,mb=0,uc,vc,Ab=0,ca,V,la=
0,Ca,md=1,Z=0,G,hb,nb,nd,zc,kd,od,ld,Ua,Wc,ta,lb,ia={},Hc={},ka=[],ha={},Sa={};R=[];var Eb,Xd=$(document.createElementNS("http://www.w3.org/2000/svg","rect"));Xd.attr({id:"loper",fill:"#0dd","fill-opacity":.5,width:"0"});var I=Xd.get(0),za,Na,W=null,M,na,F,Yc=[],dc=[],ec=0,vb={},fc,$c={},jc={};xa={};var kc={},N=[],oa,zb=[],La=[],db=[];var ja=[];var rc,Va=0,Ib,Jb,K={},Cc,Dc,Ec,Fc,Gc,xd,Ta,sd,nc,Ic,H,E,tc,jd,sc,Cd,Y=0,U,ra=0,Fb,fa={},gb,Pb={},Mb=0,kb=0,ce,jb,xc,Oc=0,Lc={},ed={},Mc={},L=[],da=[],Ra=
0,Hd,fd={},ba=0,Bb,bd=0,z=0,wc,T,Wa=0,mc={},qc,ob=0,D,Qa,g,Td=0,Rc,va=0,sb,Sc,Ha,Za,rb,Ia,$b,Vc=0,Wd=0,qb,A;var Ya=512;for(var ab,Uc=0,Yb=-100,Wb,Xb,tb,$a=0,Zb,Ub,Vb,Be="C ;C#;D ;D#;E ;F ;F#;G ;G#;A ;A#;B ".split(";"),oc,gd,Tc=[],Pa=0;30>Pa;Pa++)Tc.push(0);var l={},Tb={delay:1,eenvoor:0,metro:0,keys:0,mark:0,mute:0,volgmod:6,chkmod:2,extract:1,portsel:"synth",tempo:"",kbopa:0,pw:0,scl:1,gain:5,drempel:1,minlev:-18,bass:0,mtpo:20,hrz:0,vol:50,vol1:100,nocur:0,rstmute:0,exact:0,nolyr:0,lus:0,lusstop:1,
lncur:0,tmng:0,tmng2:0,metmrk:0,ftyp:0,nocnt:0,scal:0,echo:1},Ld={staff:1,line:30,begin:0,btime:0,etime:0,shrnk:0,lat:0,pnlerr:.5,pnltim:.5,oneclr:0,late1:150,late2:1E3,pnlkrt:.5,kort:30,minkort:200,nbrk:0,atagTijd:-1,btagTijd:-1,syncon:!0,hide2cur:0,stopat:-1,hinfo:36,mat:.5,tmo:200,kleur:"#f9f #3cf #c99 #f66 #fc0 #cc0 #ccc".split(" "),ntGoed:"#080",ntFout:"#f00",ntWacht:"#0dd",ntKleur:"#f00 #ff0 #f00 #0bb #f00 #aaa #f00".split(" ")},cc=2,cb,xb=0,Ed,B,Xa,ua,Fd,fb,Kc,qa,X,Ob,Ka={},Nb=1,Ea,ic,Jc,Qb=
0,Da;$(document).ready(function(){B=document.getElementById("aud");Xa=document.getElementById("vol")||{addEventListener:function(){}};ua=document.getElementById("vol1")||{addEventListener:function(){}};Kc=document.getElementById("syncon")||{addEventListener:function(){},checked:!0};Ta=document.getElementById("perf");G=document.getElementById("notation");hb=CSS.supports("scroll-behavior","smooth");ta=document.getElementById("start");ic=abc2svg.mhooks.strtab;$("#verlab").html("Version: "+follow_VERSION);
$("body").keydown(ee).click(function(){ca&&ya()});$(".mknop").keydown(fe);$("#perfbtn").click(function(a){a.stopPropagation();Ta.style.display="none"});Ta.addEventListener("click",function(a){a.stopPropagation()});$("#kwart").click(function(){g.metro=1;$("#metro").prop("checked",1);J(-1)});$("#kwart").append($("#mtrsvg"));$("#tempo").change(function(){H=E.met/384*nc.value;g.tempo=H;qa=E?H/E.tmp:1;Kb()});$("#micon").change(Ae);$("#start").click(function(){J(-2)});$("#spkr").append($("#spkron"));$("#spkr").append($("#spkrof").toggle(!1));
$("#spkr").toggle(!1).click(function(a){a.stopPropagation();Rb(!B.muted);Kc.checked=!B.muted;Dd()});var a=document.getElementById("spkron").cloneNode(!0),b=document.getElementById("spkrof").cloneNode(!0);a.id="spkron2";b.id="spkrof2";$("#spkr2").append($(a));$("#spkr2").append($(b).toggle(!1));$("#spkr2").click(function(a){a.stopPropagation();Rb(!B.muted)});$("#btrk").toggle(!1);$(".hfd").toggle(!1);ca=0;$(".hfd").click(function(a){a.stopPropagation()});$("#mbar").click(function(a){a.stopPropagation();
pb(1)});$("#mbar2").click(function(a){a.stopPropagation();pb(2)});$("#mbar3").click(function(a){a.stopPropagation();pb(3)});$("#mbar4").click(function(a){a.stopPropagation();pb(4)});$(".hfd select").change(Qc);$(".hfd input").change(Qc);$("#tuner input").change(Qc);$("#zoom").on("mousedown touchstart",te);$("#rollijn").on("mousedown touchstart",we);$("#info").on("mousedown touchstart",ue);$(window).resize(function(){cd();dd();Ga();ma()});$("#fknp").change(C);$("#testport").on("mousedown",zd);$("#stats").click(function(){be(0)});
$("#save").click(oe);$("#saveok").click(function(){$("#saveDlg").toggle()});$("#micKnop").click(function(){Vd(!0)});$("#ble").click(De);$("#micOk").click(function(){Vd(!1)});ab=document.querySelector("#mxlvl > div");ab.innerHTML="0";Xb=document.querySelector("#cents > div");Xb.innerHTML="&nbsp;";tb=document.querySelector("#cents > span");tb.style.width="50%";Wb=document.getElementById("noot");$b=document.querySelector("#anatijd > div");$b.innerHTML="0";A=document.getElementById("graaf").getContext("2d");
Kd("#kblft");Kd("#kbrgt");sd=$("#error")[0];nc=$("#tempo")[0];Ic=$("#path9868")[0];za=document.getElementById("atag");za.style.display="none";Na=document.getElementById("btag");Na.style.display="none";Oa(1);a=window.AudioContext||window.webkitAudioContext;(F=void 0!=a?new a:null)||alert("Your browser does not support the Web Audio API");Zc(" ",
function(a){Cd=a;console.log("E3 decoded")});jb=Mb?10:3;xc=1/jb;$("#err").text("");wb();le();se();$("#kwart").attr("title","Click here to start and keep the metronome on.\nFlashes and clicks on each beat. First beat extra loud");$("#tempo").attr("title","Tempo of the metronome in beats per minute (bpm)");$("#start").attr("title","Start/stop playing.");$("#micon").attr("title","Switches the microphone on/off.");$("#vol").attr("title","The volume of the internal synthesizer");$("#error").attr("title",
"Shows how correct you have played.\nReaches 100% at the end of a correctly played score.");$("#l0").attr("title","Playback: plays the score and checks notes if you play them.\nConstant tempo: plays the score, but waits until you play the correct notes.\nAdaptive: Adapts the tempo to your playing. It can speed up or slow down (until the given minimum tempo).");$("#l1").attr("title","Select which staves you want to play (and checked while playing).");$("#flbl").attr("title","Load a score file from your local file system. (Or an audio file or a preload file.)");
$("#drplbl").attr("title","Load the score file from your Dropbox.");$("#l2").attr("title","Use internal synthesizer or MIDI interface or no sound at all.");$("#l3").attr("title","Also display a line cursor that\nmoves continuously. (with score time)");$("#l4").attr("title","Hide the normal note cursors.");$("#l5").attr("title","Restrict the play area with two loop marks.\nTo move a mark: first select then click new position");$("#stoplbl").attr("title","When end of loop is reached, stop playing\nand jump to loop begin.");
$("#l6").attr("title","Display the score in one long line.\nThe line scrolls horizontally when playing.");$("#pwlbl").attr("title","Sets the score page width in centimeters.\nZero resets to default.\nUseful to enlarge the score.");$("#scllbl").attr("title","Scale factor for side scrolling score.");$("#l7").attr("title","Keep the metronome ticking after the count-in.");$("#l8").attr("title","When the score has lyrics, hide it");$("#l9").attr("title","Do not synthesize the staff(s) you are playing yourself");
$("#lA").attr("title","Only synthesize the staff(s) you are\nplaying yourself (and mute all others)");$("#lB").attr("title","Show the on-screen keyboard.");$("#marklbl").attr("title","Show names of the notes highlighted by the cursors");$("#lC").attr("title","Only show the selected staff (part) from a concert score");$("#lD").attr("title","Connect to a MIDI device via Bluetooth LE.");$("#lE").attr("title","Show the advanced menu");$("#lF").attr("title","Show a graph of the performance\nThe timing errors of all played notes and a runnung average of 10 notes");
$("#lG").attr("title","Check if notes are held down for the right duration.\nMark notes (orange) played too short (or long)");$("#lH").attr("title","Check if notes are played at the right time.\nMark notes (gold) played too late.");$("#lI").attr("title","Show permanent error marks and timing marks");$("#lJ").attr("title","Start without count-in");$("#").attr("title","");$("#adv, .ext").toggle($("#advanced").prop("checked"));$("#advanced").on("change",function(){return $("#adv, .ext").toggle($("#advanced").prop("checked"))});
$("#fscr").on("change",Ce);$("body").on("fullscreenchange webkitfullscreenchange mozfullscreenchange",function(){var a=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement;$("#fscr").prop("checked",null!=a)});G.addEventListener("touchstart",function(a){Wc=a.touches[0].clientX});G.addEventListener("touchmove",function(a){"stop"==ta.value&&J(u);g.hrz&&(a.stopPropagation(),a.preventDefault(),G.scrollLeft-=a.touches[0].clientX-Wc,Wc=a.touches[0].clientX)})})})();
