Update final/main4emaj.py

This commit is contained in:
2025-10-10 20:27:18 +00:00
parent 8ea7cd55f3
commit 75e64da4b0

View File

@@ -85,10 +85,10 @@ class CelebrationSound:
async def play_victory_fanfare(): async def play_victory_fanfare():
"""Classic victory fanfare""" """Classic victory fanfare"""
notes = [ notes = [
(262, 200), # C4 (330, 200), # E4
(262, 200), # C4 (330, 100), # E4
(262, 200), # C4 (330, 100), # E4
(349, 600), # F4 (440, 600), # A4
] ]
for freq, duration in notes: for freq, duration in notes:
@@ -97,14 +97,22 @@ async def play_victory_fanfare():
async def play_level_up(): async def play_level_up():
"""Upward scale for level completion""" """Upward scale for level completion"""
notes = [ notes = [
(262, 100), # C4 (277, 100),
(294, 100), # D4 (330, 100),
(330, 100), # E4 (277, 100),
(349, 100), # F4 (554, 100),
(392, 100), # G4 (277, 100),
(440, 100), # A4 (413, 100),
(494, 100), # B4 (330, 100),
(523, 300), # C5 (277, 100),
(413, 100),
(277, 100),
(554, 100),
(413, 100),
(277, 100),
(413, 100),
(554, 100),
(413, 100)
] ]
for freq, duration in notes: for freq, duration in notes:
@@ -113,9 +121,9 @@ async def play_level_up():
async def play_success_chime(): async def play_success_chime():
"""Simple success notification""" """Simple success notification"""
notes = [ notes = [
(523, 150), # C5
(659, 150), # E5 (659, 150), # E5
(784, 300), # G5 (830, 150), # G5
(987, 300), # B♭5
] ]
for freq, duration in notes: for freq, duration in notes:
@@ -124,8 +132,8 @@ async def play_success_chime():
async def play_ta_da(): async def play_ta_da():
"""Classic "ta-da!" sound""" """Classic "ta-da!" sound"""
notes = [ notes = [
(392, 200), # G4 (494, 200), # B♭4
(523, 400), # C5 (659, 400), # E5
] ]
for freq, duration in notes: for freq, duration in notes:
@@ -141,11 +149,12 @@ async def play_rickroll_inspired():
"""Fun 80s-style dance beat inspired sound""" """Fun 80s-style dance beat inspired sound"""
# Upbeat bouncy rhythm # Upbeat bouncy rhythm
pattern = [ pattern = [
(392, 200), (440, 200), (494, 200), (523, 200), (494, 200), (554, 200), (622, 200), (659, 200),
(440, 200), (392, 200), (349, 200), (392, 300), (554, 200), (494, 200), (439, 200), (494, 300),
(440, 200), (392, 200), (349, 200), (330, 400), (554, 200), (494, 200), (439, 200), (416, 400),
] ]
for freq, duration in pattern: for freq, duration in pattern:
await hub.speaker.beep(freq, duration) await hub.speaker.beep(freq, duration)
await wait(50) await wait(50)