The 3-Part Audio Element

If you have your own audio files, the audio element allows you to add a functioning player to your website.

The 3 attributes the audio element should include are:

  1. The tags themselves.
  2. The source attribute.
  3. Other attributes that define how users interact with the media.

As there are two ways to approach this, the following pages will showcase both:

Single-Source

Use this setup if you only have one version of the audio file, like an MP3.

mp3 icon

song.mp3

Multiple-Source

Use this setup if you have multiple versions of the audio file, such as MP3, WAV, OGG, etc.

mp3 icon

song.mp3

wav icon

song.wav

ogg icon

song.ogg