HTML5 Audio Object - which WAV formats are supported?
I'm using the Audio() object in order to play some sound files in the browser.
var audio = new Audio(file); audio.play()
The sound files can come from 2 different "places" and appear to have slightly differing formats.
The file plays correctly when the wav file being passed to the Audio object has the following properties (from "Get Info" on Mac)...
Sample rate: 8,000 Bits per sample: 16 Duration: 00:17 Audio Channels: 1 File size: 278KB
However, when a file has the properties below, I hear nothing, I don't see the little speaker icon in the tab and have no console errors, it's just like nothing happens.
Sample rate: 8,000 Duration: 00:29 Audio Channels: 1 File size: 31KB
NOTE: The only difference is that the second example doesn't have a "Bits per sample" value? ALSO, note the file sizes, despite the lengths???
Can anyone shed any light on this?
NB: This is not related to this issue... SO Link
Bits per sample is one of the most important factors that is needed to play audio.
More bits per sample gets you better precision, which leads to a more accurate representation of the source signal, which leads to better audio.
A higher value of bits per sample will lead to bigger File sizes.
The one with bits per sample would work without any hassle. You don't hear any sound with the one with no 'bits per sample', as you are not specifying what should the audio be like.
Some references which really help-
Quantization, Sample Rate, and Bits Per Sample