So that I can use the information to coordinate a page animation like making elements brighter as the decibel levels get higher
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This approach will work in Chrome / Safari:
The important stuff happens here:
Basically, you grab the raw PCM data (values from -1 to 1) every 2048 samples and you loop through them, calculating the average signal level over the given period of time.
You can then use that value to do your animations.
Edit:
Updated to use RMS, which as Jason pointed out is a more meaningful measurement.