Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Is there any way to track volume with the web audio api

I'd like to be able to track how loud the song gets in realtime, returning a number to represent the current volume of the song. The source is from a sample that plays when you click it. Ive seen tutorials on making a volume meter, but all I want is a number to measure this. here is my starting code.


const audioContext = new AudioContext();

const samplebutton = document.createElement('button')
samplebutton.innerText = 'sample'
samplebutton.addEventListener('click', async () => {
    let volume = 0
    const response = await fetch('testsong.wav')
    const soundBuffer = await response.arrayBuffer()
    const sampleBuffer = await audioContext.decodeAudioData(soundBuffer)
    const sampleSource = audioContext.createBufferSource()
    sampleSource.buffer = sampleBuffer

    sampleSource.connect(audioContext.destination)
    sampleSource.start() 
    
function TrackVolume(){
}



about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!