我想出了这个解决方案:
for(var i=0; i < max; i++){
var note=arrays[i].pitch;
var time=arrays[i].timing;
if(i===0){synth.triggerAttackRelease(note,time,0)}
if(i===1){synth.triggerAttackRelease(note,time,arrays[0].timing)}
if(i===2){synth.triggerAttackRelease(note,time,arrays[1].timing+arrays[0].timing)}
if(i===3){synth.triggerAttackRelease(note,time,arrays[2].timing+arrays[1].timing+arrays[0].timing)}
if(i===4){synth.triggerAttackRelease(note,time,arrays[3].timing+arrays[2].timing+arrays[1].timing+arrays[0].timing)}
if(i===5){synth.triggerAttackRelease(note,time,arrays[4].timing+arrays[3].timing+arrays[2].timing+arrays[1].timing+arrays[0].timing)}
if(i===6){synth.triggerAttackRelease(note,time,arrays[5].timing+arrays[4].timing+arrays[3].timing+arrays[2].timing+arrays[1].timing+arrays[0].timing)}
if(i===7){synth.triggerAttackRelease(note,time,arrays[6].timing+arrays[5].timing+arrays[4].timing+arrays[3].timing+arrays[2].timing+arrays[1].timing+arrays[0].timing)}
}
但是代码太多,只能弹7个音符左右;
是否有一个简单的快捷方式,只需几行?