★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum3/HTML/000421.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  JavaScript
  How to create sequential timed functions?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   How to create sequential timed functions?
DuckyMoon
Junior Member
posted July 08, 2000 07:48 PM     Click Here to See the Profile for DuckyMoon     Edit/Delete Message Reply w/Quote
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!

Argrajoca
Member
posted July 09, 2000 11:32 AM     Click Here to See the Profile for Argrajoca   Click Here to Email Argrajoca     Edit/Delete Message Reply w/Quote
why don't try this:

setTimeout("notePlayer.playNote (1,0,24,pitch1,127,1000)",1000)

DuckyMoon
Junior Member
posted July 10, 2000 07:45 AM     Click Here to See the Profile for DuckyMoon     Edit/Delete Message Reply w/Quote
Thank you so much for your suggestion. I'll give it a try today. I appreciate your help!

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.