Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Playing Audio Using Keystrokes: Is It Possible?

Annabelle5893

Gold Coder
I'm wondering, how would I make an app that plays audio files using the keys on the number pad? Specifically, I want to make an app that triggers "Rotary Pulse 1" by pressing 1 on the numeric keypad, all the way up to "Rotary Pulse 0" on the 0 key. A dial tone will be toggled on by pressing the spacebar, which will begin with a "receiver pickup" noise. The dial tone turns off when digits are dialed via the numeric keypad. If you press the spacebar either when the dial tone is on, or after dialing a number, a "Receiver Hang Up" noise will be triggered. With the rotary dial sounds, the dial turning to the fingerhole is triggered at key down, and the release of the dial returning to the resting position will be triggered by releasing of the number corresponding to the fingerhole (1, 2, 3, 4, 5, 6, 7, 8, 9, 0). This will be accompanied by the internal sound of the dial pulses as heard in a telephone. What is the code I would use to make this audio app using HTML?
 
Hmmm. Let me see on my end if there are any errors that pop up when pressing keys. I didn't test that out. I think it may be that your file paths may be erroring out.
Out of curiosity, how would I loop a piece of audio? For example, if I want the ringing tone to loop until someone "answers" the phone by pressing a key, what would I write?
 
Out of curiosity, how would I loop a piece of audio? For example, if I want the ringing tone to loop until someone "answers" the phone by pressing a key, what would I write?
I do believe there is a 'loop' attribute for audio. If not, what you could do is use setInterval and have a condition check if your variable hasTelephoneBeenAnswered is set to true
 
I do believe there is a 'loop' attribute for audio. If not, what you could do is use setInterval and have a condition check if your variable hasTelephoneBeenAnswered is set to true
For example, the ringing tone would play in a continuous loop until you "answer the phone" by pressing Spacebar, which would toggle your computer's microphone so you can talk as though you're talking on the phone to someone.
 
Any updates?
Hi Annabelle,
I do apologize for the late reply. Been having some personal and family issues recently. I do have an update for you. I've managed to get through getting the ringtones to work properly. I only thing to do is to make sure they work with the appropriate buttons. I truly appreciate your patience. I will post the solution soon.
 
Hi Annabelle,
I do apologize for the late reply. Been having some personal and family issues recently. I do have an update for you. I've managed to get through getting the ringtones to work properly. I only thing to do is to make sure they work with the appropriate buttons. I truly appreciate your patience. I will post the solution soon.
Have you found the solution to make the keystrokes work?
 
Back
Top Bottom