Playing Audio Using Keystrokes: Is It Possible?

Annabelle Baradine 0 Reputation points
2025-08-23T17:31:32.7566667+00:00

I'm not sure if these are the right tags for this request, but 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 or Enter key, 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? Or should I use a different coding language? As I'm a sight challenged woman who is a beginner at programming, I'm not sure where to start.

Developer technologies | Small BASIC
Developer technologies | Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
{count} votes

2 answers

Sort by: Most helpful
  1. Danny Nguyen (WICLOUD CORPORATION) 3,500 Reputation points Microsoft External Staff
    2025-09-11T08:40:16.0466667+00:00

    Hi,

    This request is quite broad for a single Q&A, since it involves both designing the app (key handling, audio playback, state management) and writing all the implementation code. A few pointers to help you get started:

    • For a web-based version (HTML/JavaScript):
    • For a desktop app (e.g., Python, C#, Java):
      • Each language has libraries to capture key events and play audio (e.g., pygame in Python, System.Media.SoundPlayer in C#).

    Since you’re just starting out, a practical first step would be to choose one platform (web or desktop) and try a very small example:

    1. Play one audio file on a single key press.
    2. Extend to multiple keys and multiple sounds.
    3. Add the “toggle” logic for dial tone and hang-up.

    If you’d like to stick with the web and HTML/JS, I’d recommend starting with the Web Audio API tutorial.

    Hope this helps.

    1 person found this answer helpful.

  2. Bruce (SqlWork.com) 81,191 Reputation points Volunteer Moderator
    2025-08-24T15:28:08.2333333+00:00

    First you an audio recording of the pulses (google for mp3 samples). You should be able to do this with JavaScript and html. You use the Audio() object to play the sounds. You would use the key down and key up events to trigger the sounds.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.