html5 audio – How to “include” sound (e.g. wav file) in html?

I want to include the base64 version of a .wav file in html.

SVG

I have an .svg file called circ.svg:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="792" height="612">  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow"></circle></svg>

I can embed it in my html file:

<html><body><embed src="circ.svg"></embed></body></html>
I can include it in my html file:
<html><body><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="792" height="612"> <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow"></circle></svg></body></html>

PNG

I also have .png file called htmlimg.png. I can embed it in my html file:

<html><body><embed src="htmlimg.png"></embed></body></html>
 I can convert it to based 64 and include the base64 version in my html file:
<html><body><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAABuC ... deleted stuff ... ASUVORK5CYII=" alt="Base64 encoded image" width="150" height="150"/></body></html>

WAV

I also have a .wav file called Auld_Lang_Syne_-_U.S._Navy_Band.wav. I can embed it in my html file:

<html><body><audio controls><source src="Auld_Lang_Syne_-_U.S._Navy_Band.wav" type="audio/wav"></audio></body></html>

I can convert it to base64. Can I include the base64 version in html?

John

Read more here: Source link