HTML Xylophone - Sounds are generated with the Web Audio API using frequency

Colorful HTML Xylophone

HTML Xylophone

Click or press a key to play a note. Keys light up when struck. Sounds are generated with the Web Audio API using frequency parameters for a simple, realistic timbre.

How to play:
  • Click a colored key to play a note.
  • Alternatively, press 1-7 on your keyboard to trigger notes C4–B4.
  • Each key lights up briefly when struck to show feedback.
```
--- ## How to use - Open the HTML file in any modern browser. - Click any colored key to hear the corresponding note. - Use keyboard numbers 1–7 to play C4–B4. - Observe the key lighting up briefly when struck. --- ## Notes and considerations - The Web Audio API is used to synthesize simple pluck-like notes with a sine wave and exponential decay to simulate a melodic xylophone timbre. - Visual feedback is implemented by toggling the active class on each key during interaction. - The layout uses a rainbow-like color scheme for visual appeal and clear affordance. - If you want to expand, you can add more octaves, a sustain slider, or a dedicated release envelope for more realism.

Posting Komentar

0 Komentar