Voided.to Logo Voided.to Vto.

Spoon's Beeper

0
124

Thread

#1
Spoon's Beeper - Beep Tone Generator Application

This application generates a variety of beep tones whenever a key is pressed.
It uses the "keyboard" library to detect key presses and the winsound module to generate beep tones.

Prerequisites
Before running the application, ensure you have Python installed on your system.
You can download Python from python.org.

Installation
Install the keyboard library:
Open your terminal or command prompt and run the following command to install the
 
Code:
pip install keyboard
The winsound module is part of Python's standard library, so you don't need to install it separately. However, it is only available on Windows.

Source Code (Python3)
Here is the code for the Beep Tone Generator Application:
 
Code:
import winsound
import random
import time
import sys
import keyboard  # For detecting key pressesa

# Function to generate a variety of beep tones on Windows
def fancy_beep_notification():
    for _ in range(5):
        frequency = random.randint(300, 2000)
        duration = random.randint(100, 500)
        winsound.Beep(frequency, duration)
        time.sleep(0.1)

# Function to handle key press events
def on_key_press(event):
    fancy_beep_notification()

# Main function to start the application
def main():
    print("Press any key to generate beep tones. Press 'esc' to exit.")
    keyboard.on_press(on_key_press)
    keyboard.wait('esc')  # Wait for the 'esc' key to exit

if __name__ == "__main__":
    main()


The application will run until the 'esc' key is pressed.

This code will generate a beep tone whenever any key is pressed.
You can customize the frequency and duration of the beep tones as to your liking.
[Image: rrKEfOM.gif]
Reply
Task