I\'m looking for the smallest type of audio file for some javascript to work smoother.
Wav files can be 16 bit,8 kHz (i.e 128 k bits per second) while mp3 could be compressed to 16 kbits per second. Typically wav is x10 larger than mpg. This is ratio is highly content specific. Wav is a raw format, while mp3 is a compressed format for audio. ogg is more of wrapper format. it can wrap Speex compressed audio, Speex (www speex org)is a very efficient compression technique based on CELP.
Tips – use audacity (audacity source forge net) to truncate and save the original with smallest size ( 8 kHz 16 bit formatting if possible) convert this output into mp3. Keeping audio in a common format (mp3/wav)is a good idea.
WAV files are very large, and ogg is regrettably not supported universally, so MP3 is probably your best bet. if you want to make sure the file downloads as quickly as possible, you should take a look at the compression options you're using. If you don't have access to compression options, try downloading an audio editing program like Audacity. Open up the file and then re-export it as an MP3. Try saving the sound file with a relatively low bitrate (128k, 64k, or even less) and see if the playback quality is still acceptable.
Of those three, Ogg
would usually be smaller than MP3
. Both would be much smaller than the uncompressed WAV
. Of course, there may be other factors that come into play for your site such as quality (not too much of a noticeable difference for most purposes) and browser support for each type.
The file size will only affect the time it takes to download the file to the user's machine. It won't necessarily determine Javascript execution speed. There may be other things in your code causing the performance drops (unless you've narrowed it down to the file size of the audio files).
2019: mp3
is your friend.
Type | Compression | Browser Support | Quality | Size
---------------------------------------------------------------------------
MP3 | Compressed | Great | Depends on compression | Small
OGG | Compressed | Not so good | Depends on compression | Smallest
WAV | Uncompressed | Good | Best | Large
Browser support: mp3, ogg, wav