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