Real-time Audio Analyzer

This prompt requests a single HTML file for a real-time audio analysis web app. It must visualize sound levels, track noise exposure, and graph levels over time, with responsive design and error handling.

CodeAudio

Prompt

Create a single HTML file for a real-time audio analysis web application. The application should have the following features and requirements:

Use the Web Audio API for audio analysis.
Access the user's microphone and analyze the sound level.
Perform real-time analysis of the sound level.
Show a visual meter that displays the current sound level, with color indicators:

Green for low sound level (< 30%)
Yellow for medium sound level (30% - 70%)
Red for high sound level (> 70%)

Display the noise level based on the sound level (Quiet, Normal, Busy).
Provide an indication of the risk of hearing damage (Low, Moderate, High).
Show a graph that displays the sound level over time.
Keep a time record of the different sound levels (low, medium, high).
Show a table with the total time and the percentage of the total time for each sound level.
Add error handling for microphone access.
Style the application for a clean, modern look with responsive design.
Include all necessary HTML, CSS, and JavaScript in a single, standalone file that can be executed by opening it in a web browser.

Provide the complete, executable HTML file that meets all of these requirements.