32

I'm looking for the smallest type of audio file for some javascript to work smoother.

JUDE DAILY
  • 132
  • 9
Tony
  • 981
  • 5
  • 16
  • 30

5 Answers5

30

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).

keyboardP
  • 68,824
  • 13
  • 156
  • 205
  • That's my conclusion after comparing two files where one had a large audio file. Before removal of audio, javascript was executing extremely and caused my computer to overhead. After removal, javascript ran just perfectly without overheating my computer. – Tony Jan 14 '12 at 01:38
12

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

mp3

ogg

wav

Browser support: mp3, ogg, wav

evilReiko
  • 19,501
  • 24
  • 86
  • 102
  • can any one give me smallest mp3 file? – Bhavin Thummar Apr 07 '20 at 05:37
  • Apple and Microsoft don't want competition so of course they didn't support open source codecs and thus those browsers simply don't support the HTML5 `audio` and `video` elements. – John Aug 12 '22 at 01:10
7

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.

Community
  • 1
  • 1
Lalin
  • 141
  • 1
  • 5
  • 1
    indeed, and Vorbis I is a forward-adaptive monolithic transform codec based on the modified discrete cosine transform (MDCT).[36] Vorbis uses the modified discrete cosine transform for converting sound data from the time domain to the frequency domain. The resulting frequency-domain data is broken into noise floor and residue components, and then quantized and entropy coded using a codebook-based vector quantization algorithm. Xiph.Org now considers Speex obsolete; its successor is the more modern Opus codec, which surpasses its performance in all areas. Opus data can be encapsulated in Ogg. – bandybabboon Dec 13 '14 at 04:11
4

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.

octern
  • 4,825
  • 21
  • 38
  • 6
    not true. .wav is merely a container format. It's the codec used that determines actual file size. – Marc B Jan 14 '12 at 01:35
  • 3
    Actually there are more browsers supporting Ogg Vorbis than MP3: https://developer.mozilla.org/en-US/docs/HTML/Supported_media_formats – aaaaaa Mar 29 '13 at 10:12
0

IMHO - 48kb/s MP3

The best answer might be a balance between

  1. size of file ( kind on bandwidth to the user )

  2. how expensive it is to run ( better for lower powered machines )

  3. quality ( how it is perceived by the user )

I suspect in your case, because you are concerned about other code running, you want the format that uses up the least processing power.

The 2 variables at play here are bit rate and bit depth, however mp3 doesnt really take bit depth into account.

Here's what I understand to be true:

  1. The most widely used/known audio format is mp3
  2. Even though the possible audio spectrum is 20 - 20,000Hz, most people can't really hear above 13,000Hz
  3. Choosing a lower bit rate (playback) means the computer will not have to work as hard to playback (decode)

So my recommendation for general purpose sound would be to choose mp3 and a lower bit rate 48 kbs.

Not that it will make a lot of difference, most websites are accessed via phones that are mono anyway. Mono WAV files take up less space than stereo and lower bit depths take up less. Also Audacity is a software that can convert between audio types.

My professional view as a sound engineer is that mastering audio properly gives the best results, but that's another topic in another forum.

Mark N Hopgood
  • 843
  • 8
  • 14