SOUNDBOX WITH RASPBERRY PI
ABSTRACT
SoundBox as we know it is nothing but something that makes various sounds. This soundbox is made to make some interesting game sounds with are fun to listen to. Raspberry Pi offers different means to work on various types of projects. Here is my fun attempt to make use of my Raspberry Pi
SOFTWARE
Raspberry Pi OS (NOOBS) offers a great deal of Python Integrated Development Environments. Thonny IDE is a beginner-friendly python editor that is used to write the code. PyGame is a very reliable module by Python that has different kinds of sounds that can be made used as per the requirement.
Here is the code for the development of this project:
from gpiozero import Button import pygame pygame.init() one = pygame.mixer.Sound("/home/pi/python_games/match0.wav") two = pygame.mixer.Sound("/home/pi/python_games/match1.wav") three = pygame.mixer.Sound("/home/pi/python_games/match2.wav") four = pygame.mixer.Sound("/home/pi/python_games/match3.wav") five = pygame.mixer.Sound("/home/pi/python_games/match4.wav") six = pygame.mixer.Sound("/home/pi/python_games/match5.wav") btn_one = Button (26) btn_two = Button (19) btn_three = Button (13) btn_four = Button (6) btn_five = Button (5) btn_six = Button (11) btn_one.when_pressed = one.play btn_two.when_pressed = two.play btn_three.when_pressed = three.play btn_four.when_pressed = four.play btn_five.when_pressed = five.play btn_six.when_pressed = six.play
Comments
Post a Comment