Optimizing your audio files is important for improving performance of your website or application. Compression techniques used on audio files reduce the size of files, speed up download times and reduce the amount of bandwidth required.
This guide focuses on pure audio files. For information on addressing audio components of video files, see the Video optimization guide.
Some audio formats use more compression than others, and some use no compression at all. The quality of compressed audio may not be as perfect as the uncompressed equivalent, but for many purposes it is acceptable and the difference is not perceivable by most people.
You can change the format of an audio file that you've uploaded to Cloudinary by changing the delivery URL extension to one of the audio formats that is supported for delivery by Cloudinary.
Note
Audio files are uploaded to Cloudinary as videoasset types.
For example, the asset in the demo product environment with public ID docs/fireflywav is a WAV file (not compressed). You can deliver it as an MP3 file (compressed) by using the .mp3 extension in the delivery URL:
The main audio formats supported by web browsers are AAC, OGG, WAV and MP3.
AAC, OGG and MP3 are compressed formats, so they download faster and use less bandwidth than WAV files. WAV files provide the highest quality, but depending on your application, the sound quality of ACC, OGG and MP3 are likely to be sufficient.
This table shows the file size of the fireflywav audio snippet when delivered in each of the different formats:
Format
File Size
AAC
126 KB
OGG
145 KB
MP3
163 KB
WAV
889 KB
If you use the <audio> tag on your site, you can set the src in each of the <source> tags to different formats in your preferred order. The browser picks the first one that it supports. Therefore, to prioritize optimization over quality, design your <audio> tag as follows:
Copy to clipboard
<audiocontrols><sourcesrc="https://res.cloudinary.com/demo/video/upload/docs/fireflywav.aac"type="audio/aac"><sourcesrc="https://res.cloudinary.com/demo/video/upload/docs/fireflywav.ogg"type="audio/ogg"><sourcesrc="https://res.cloudinary.com/demo/video/upload/docs/fireflywav.mp3"type="audio/mpeg"><sourcesrc="https://res.cloudinary.com/demo/video/upload/docs/fireflywav.wav"type="audio/wav">
Your browser does not support the audio element.
</audio>
// This SDK requires imports from @cloudinary/url-gen. Learn more in the SDK docs.new CloudinaryVideo("docs/fireflywav.mp3").transcode(bitRate("50k"));
// This SDK requires imports from @cloudinary/url-gen. Learn more in the SDK docs.new CloudinaryVideo("docs/fireflywav.mp3").transcode(bitRate("50k"));
// This SDK requires imports from @cloudinary/url-gen. Learn more in the SDK docs.new CloudinaryVideo("docs/fireflywav.mp3").transcode(bitRate("50k"));
// This SDK requires imports from @cloudinary/url-gen. Learn more in the SDK docs.new CloudinaryVideo("docs/fireflywav.mp3").transcode(bitRate("50k"));