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

202
Views
Implementación de múltiples búferes en WebAudio (súper básico)

Ciertamente estoy implementando esto incorrectamente. Quiero una instancia simple de dos o más sonidos reproducidos de forma independiente a través de WebAudio con un botón para cada sonido. Reproducir1() funciona; play5() no lo hace. Cualquier orientación sería muy apreciada. Gracias.

 <button onclick="play1()">I</button> <script> let faked = true; if (!window.AudioContext && window.webkitAudioContext) { window.AudioContext = window.webkitAudioContext; faked = false; } const audioContext = new AudioContext(); let sample; function play1() { if (!faked) { faked = true; const buffer = audioContext.createBuffer(1, 1, audioContext.sampleRate); sample = audioContext.createBufferSource(); sample.buffer = buffer; sample.connect(audioContext.destination); sample.start(); } fetch('major/one.mp3') .then(response => response.arrayBuffer()) .then(arrayBuffer => { if (audioContext.decodeAudioData.length === 2) { // Safari return new Promise(resolve => { audioContext.decodeAudioData(arrayBuffer, buffer => { resolve(buffer); }); }); } else { return audioContext.decodeAudioData(arrayBuffer); } }) .then(audioBuffer => { sample = audioContext.createBufferSource(); sample.buffer = audioBuffer; sample.connect(audioContext.destination); sample.start(); }) .catch(e => console.error('uff', e)); } function stop() { sample.stop(); } <!--2nd sound --> <button onclick="play5()">V</button>

El script de arriba se copia con la función play5()

Una vez más, se agradece cualquier orientación.

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!