Questions tagged [javascript-audio-api]
31 questions
4
votes
5 answers
Why does audio not play in javascript
I want to add background music to my website. I've tried this JS code:
var sound;
function initialAudio() {
'use strict';
sound = new Audio();
sound.src = '../audio/test.mp3';
sound.loop = true;
…

Muntadar Muhammad
- 95
- 1
- 2
- 7
4
votes
1 answer
Can Javascript detect if a mobile device is muted?
My website is currently playing sounds when the user answers a question right/wrong. But I notice that on my tablet (iPad) and mobile (iPhone) it plays the sounds even though I put it in silence mode. And I don't want the phone/tablet to play sounds…

Roel Vermeulen
- 594
- 7
- 15
4
votes
0 answers
Remove silence from audio in JavaScript
I want to make a web app in JavaScript, where the user records voice from a mic and then the app trims the silent parts of the recording, so just the voice is left.
Note that silent parts may not be completely silent, because the sound is recorded…

user3362334
- 1,980
- 3
- 26
- 58
3
votes
0 answers
Web Audio API microphone EQ
Does anyone know if it is possible to add EQ / effects filtering to the live microphone input within a html5 enabled web page?
To be clear I'm not talking about adjusting the sound of a pre-recorded wav/mp3 playing in the HTMl5 player, there are…

user3012857
- 165
- 1
- 10
3
votes
1 answer
Force Audio library in JS to load
I want to get Audio Length without having to play then pause then play again for getting the audio length/duration?
The function called will be: this.createRangeElement
But for some reason it outputs "NaN", so how would I force the Audio to…
user7106750
3
votes
0 answers
Phonegap Cordova record audio get raw data array buffer
I want to record audio on android in phonegap and get an array of floats from -1 to 1.
I've tried the Media plugin but I don't think it gives you access to the raw audio data array.
I've tried recording the audio to file (via media plugin) then…

Curtis
- 2,486
- 5
- 40
- 44
2
votes
1 answer
Split stereo audio file Into AudioNodes for each channel
How can i split a stereo audio file (I'm currently working with a WAV, but I'm interested in how to do it for MP3 as well, if that's different) into left and right channels to feed into two separate Fast Fourier Transforms (FFT) from the P5.sound.js…

Squackattack
- 87
- 9
2
votes
1 answer
User interaction needed to play audio workaround?
Currently I am working on a html5/js music player application. I have many users on mobile devices that have problems with playing the music. According to many websites you need to have user interaction before you can play audio.
Currently this is…

Raymond
- 396
- 4
- 21
2
votes
1 answer
Using AudioBuffer as a source for a HTMLAudioElement?
How one can use decoded AudioBuffer data to be set as a source for HTMLAudioElement?
Let us assume we have an HTMLAudioElement:
let audio = new Audio();
And we also were able to receive and decode audio data:
let context = new AudioContext();
let…

Elias
- 698
- 8
- 23
2
votes
1 answer
Play blob stream from MediaRecorder?
I want to play a stream of audio blobs that came from a MediaRecorder
I have a website containing this piece of javascript angular code:
This is a MediaRecorder of type https://developer.mozilla.org/nl/docs/Web/API/MediaRecorder
This sends the…

ErikBrandsma
- 1,661
- 2
- 20
- 46
1
vote
0 answers
How to define document in javascript blob?
I want to create an audio object in the blob but i couldn't.
const blobCode = () => {
return `
var sound = document.createElement('audio');
sound.id = 'audio-player';
sound.controls = 'controls';
sound.src =…

wejopa5747
- 21
- 1
- 2
1
vote
0 answers
Autoplay sound is getting stopped with print window
Autoplay sound is getting stopped as soon as I'm opening a print window through window.print() and coming back after clicking on cancel. This issue is happening only in Chrome browser whereas in Firefox it is working fine. I don't see any…

Jatin Bansal
- 171
- 2
- 10
1
vote
0 answers
Audio context breaks when switching to a new audio source
I am using chrome and I have an HTML audio element hooked up to an analyzer like this:
var audio = document.getElementById('audio');
audio.src = "http://127.0.0.1:5000/api/getfile/new.wav";
var ctx = new…

dhillo
- 33
- 3
1
vote
0 answers
How to set playBackRate of HTMLAudioElement in combination with a SourceNode and Firefox?
I'm trying to test playing audio using a HTMLAudioElement and a AudioSourceNode. For the later application I need two features:
The pitch must be preserved after the playbackRate changed.
The volume needs to be changed to a value greater than…

julianpoemp
- 1,965
- 3
- 14
- 29
1
vote
1 answer
Looping Through JavaScript Array of Audio Elements
I'm creating a system where JavaScript is listening, on a websocket, for a single click or a double click from an IoT button. When the JavaScript receives the single click, it's supposed to start playing the first song in an array of shuffled audio…

Eliav Hamburger
- 85
- 2
- 12