1// abc2svg - ABC to SVG translator 2// @source: https://chiselapp.com/user/moinejf/repository/abc2svg 3// Copyright (C) 2014-2020 Jean-Francois Moine - LGPL3+ 4//temper.js-module to define the temperament 5abc2svg.temper={set_fmt:function(of,cmd,param){if(cmd=="temperament"){var i,tb,tb40=new Float32Array(40),ls=new Float32Array(param.split(/ +/)) 6for(i=0;i<ls.length;i++){if(isNaN(ls[i])) 7break 8ls[i]=i+ls[i]/100} 9switch(i){case 12:tb=[10,11,0,1,2,0,0,1,2,3,4,0,2,3,4,5,6,3,4,5,6,7,0,5,6,7,8,9,0,7,8,9,10,11,0,9,10,11,0,1] 10break 11default:this.syntax(1,this.errs.bad_val,"%%temperament") 12return} 13for(i=0;i<40;i++) 14tb40[i]=ls[tb[i]] 15this.cfmt().temper=tb40 16return} 17of(cmd,param)},set_hooks:function(abc){abc.set_format=abc2svg.temper.set_fmt.bind(abc,abc.set_format)}} 18abc2svg.modules.hooks.push(abc2svg.temper.set_hooks);abc2svg.modules.temperament.loaded=true 19