Created
August 26, 2022 13:10
-
-
Save megahomyak/147cb030e85fb204b07a1a1f8c8dfa3d to your computer and use it in GitHub Desktop.
A tiny soundboard written in three minutes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from readchar import readchar | |
from playsound import playsound | |
import os | |
sound_names = os.listdir("sounds") | |
letters_to_names = dict(zip("abcdefghijklmnopqrstuvwxyz1234567890", sound_names)) | |
for letter, name in letters_to_names.items(): | |
print(f"{letter} - {name}") | |
while True: | |
try: | |
playsound(os.path.join("sounds", letters_to_names[readchar()]), block=False) | |
except KeyError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment