posted July 08, 2000 07:48 PM
Hi,I am needing some help finishing a site ASAP and am looking for a way to create sequential timed functions. I hope someone here can give me some assistance!
I'm trying to write a Javascript function that will play a succession of notes using Beatnik. The pitch of the notes is computed from variable (pc) passed to the function as arguments. My problem is timing the notes. In my current version (see below) the notes play simultaneously. I tried nesting a function call for the playNote statement as the first argument to the setTimeout functions, but then notes still play
all together.
So what I want to do is play each note in succession with a specific delay in between notes.
function playline (pc1, pc2, pc3) {
pitch1 = pc1 + 60
pitch2 = pc2 + 60
pitch3 = pc3 + 60
notePlayer.playNote (1,0,24,pitch1,127,1000)
setTimeout("",1000)
notePlayer.playNote (1,0,24,pitch2,127,1000)
setTimeout("",2000)
notePlayer.playNote (1,0,24,pitch3,127,1000)
;
}
i appreciate any help you can give me. Thank you!