update code for scooter soundboard

update code for scooter soundboard
This commit is contained in:
Noe Ruiz 2022-04-26 08:41:29 -04:00
parent dbfe115788
commit 196398de84
2 changed files with 6 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2022 John Park for Adafruit Industries
# SPDX-License-Identifier: MIT
# put samples in "/wav" folder
# Convert files to appropriate WAV format (mono, 22050 Hz, 16-bit signed)
import time
import board
@ -15,9 +15,10 @@ time.sleep(3)
# list of (samples to play, mixer gain level)
wav_files = (
('wav/airhorn.wav', 1.0),
('wav/bike-horn.wav', 1.0),
('wav/chime.wav', 1.0)
('wav/airhorn.wav', 1.0), #Honk sound 1
('wav/bike-horn.wav', 1.0), #Honk around 2
('wav/chime.wav', 1.0), #Honk sound 3
('wav/idle.wav', 1.0) #Looping Engine Sound Effect
)
# pins used by keyboard
@ -47,6 +48,7 @@ def handle_mixer(num, pressed):
while True:
mixer.voice[3].level = 1 #Looping Engine Sound Effect
event = km.events.get()
if event:
if event.key_number < len(wav_files):

Binary file not shown.