Lines Matching +defs:d +defs:t

62 function ToAudio(){return{add:function(first,voice_tb,cfmt){var toaud=this,C=abc2svg.C,p_time=0,abc_time=0,play_fac=C.BLEN/4*120/60,i,n,dt,d,v,c,s=first,rst=s,rst_fac,rsk,b_tim,b_typ,instr=[],chn=[]
122 function gen_grace(s){var g,i,n,t,d,s2,next=s.next
123 if(s.sappo){d=C.BLEN/16}else if((!next||next.type!=C.NOTE)&&s.prev&&s.prev.type==C.NOTE){d=s.prev.dur/2}else{d=next.dur/12
124 if(!(d&(d-1)))
125 d=next.dur/2
127 d=next.dur/3
128 next.time+=d
129 next.dur-=d}
133 d/=n*play_fac
134 t=p_time
135 for(g=s.extra;g;g=g.next){g.ptim=t
136 g.pdur=d
139 t+=d}}
140 function set_tempo(s){var i,d=0,n=s.tempo_notes.length
142 d+=s.tempo_notes[i]
143 return d*s.tempo/60}
144 function set_variant(rsk,n,s){var d
146 while(1){d=n.shift()
147 if(!d)
149 if(d[1]=='-')
150 for(i=d[0];i<=d[2];i++)
152 else if(d>='1'&&d<='9')
153 rsk[Number(d)]=s
154 else if(d!=',')
206 dt=d/2
210 case C.REST:case C.NOTE:d=s.dur
215 dt=d/2
217 d-=dt}
218 d/=play_fac
219 s.pdur=d
236 abc2svg.play_next=function(po){function do_tie(s,midi,d){var i,note,C=abc2svg.C,v=s.v,end_time=s.time+s.dur
239 return d
243 return d
249 return d
255 d+=s.pdur/po.conf.speed
256 return note.tie_ty?do_tie(s,midi,d):d}}
257 return d}
258 function set_ctrl(po,s2,t){var i,p_v=s2.p_v,tim=s2.time,s={subtype:"midictl",p_v:p_v,v:p_v.v,chn:p_v.chn}
261 po.midi_ctrl(po,s,t)}
263 po.midi_ctrl(po,s,t)}
265 function play_cont(po){var d,i,st,m,note,g,s2,t,maxt,C=abc2svg.C,s=po.s_cur
273 t=po.stim+s.ptim/po.conf.speed
274 if(po.conf.new_speed){d=po.get_time(po)
275 po.stim=d-(d-po.stim)*po.conf.speed/po.conf.new_speed
278 t=po.stim+s.ptim/po.conf.speed}
279 maxt=t+po.tgen
282 set_ctrl(po,s,t)
288 t=po.stim+s.ptim/po.conf.speed
295 t=po.stim+s.ptim/po.conf.speed
307 t=po.stim+s.ptim/po.conf.speed}else{s=po.s_end}}
310 po.midi_ctrl(po,s,t)
312 case C.GRACE:for(g=s.extra;g;g=g.next){d=g.pdur/po.conf.speed
314 po.note_run(po,g,note.midi,t+g.ptim-s.ptim,d)}}
316 case C.NOTE:d=s.pdur/po.conf.speed
320 po.note_run(po,s,note.midi,t,note.tie_ty?do_tie(s,note.midi,d):d)}
321 case C.REST:d=s.pdur/po.conf.speed
323 st=(t-po.get_time(po))*1000
325 setTimeout(po.onnote,st+d*1000,i,false)}
328 setTimeout(po.onend,(t-po.get_time(po)+d)*1000,po.repv)
334 t=po.stim+s.ptim/po.conf.speed
335 if(t>maxt)
338 po.timouts.push(setTimeout(play_cont,(t-po.get_time(po))*1000
364 function b64dcod(s){var i,t,dl,a,l=s.length,j=0
371 for(i=0;i<l;i+=4){t=(b64d[s[i]]<<18)+
375 a[j++]=(t>>16)&0xff
376 a[j++]=(t>>8)&0xff
377 a[j++]=t&0xff}
378 if(l!=s.length){t=(b64d[s[i]]<<18)+
382 a[j++]=(t>>16)&0xff
384 a[j++]=(t>>8)&0xff}
429 function midi_ctrl(po,s,t){if(s.ctrl==7)
431 function note_run(po,s,key,t,d){var g,st,instr=s.instr,k=key|0
444 if(parm.hold<0.002){g.gain.setValueAtTime(v,t)}else{if(parm.attack<0.002){g.gain.setValueAtTime(v,t)}else{g.gain.setValueAtTime(0,t)
445 g.gain.linearRampToValueAtTime(v,t+parm.attack)}
446 g.gain.setValueAtTime(v,t+parm.hold)}
447 g.gain.exponentialRampToValueAtTime(parm.sustain*v,t+parm.decay)
450 o.start(t)
451 o.stop(t+d)}
522 function note_run(po,s,k,t,d){var j,a=(k*100)%100,i=s.instr,c=s.chn
524 t*=1000
525 d*=1000
531 if(a&&Midi5.ma.sysexEnabled){po.op.send(new Uint8Array([0xf0,0x7f,0x7f,0x08,0x02,i&0x7f,0x01,k,k,a/.78125,0,0xf7]),t)}
532 po.op.send(new Uint8Array([0x90+c,k,127]),t)
533 po.op.send(new Uint8Array([0x80+c,k,0]),t+d-20)}
534 function midi_ctrl(po,s,t){po.op.send(new Uint8Array([0xb0+s.chn,s.ctrl,s.val]),t*1000)}
555 if(0){op.send(new Uint8Array([0xf0,0x7f,0x7f,0x08,0x02,0x00,0x01,0x69,0x69,0x00,0,0xf7]),t)}