Creating a link to play a sound file in HTML

Inserting the sound file in a A HREF statement allows the browser to open and play the midi file if the viewer of your web page has properly configured the browser.

<A HREF="">Click here to play sound</a>


<audio src="example.midi" preload="auto" autoplay="autoplay"></audio>


<embed src="" align="baseline" border="0" width="145" height="60" autostart="false" loop="true">

Note: Using the embed method requires that the user has a browser that has a supported plugin such as QuickTime that supports the ability to play MIDI files. Most browsers today do not have browser plugins that support MIDI files. Instead of playing MIDI files we suggest using MP3 files.


Using the first section of HTML code in the above solution gives you the link shown below.

Click here to play sound

Using the second section of HTML code gives you the example below.

Additional information

  • See our sound definition for further information and related links on this term.