ArticleslgStudy

science

HTML audio

HTML audio is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand HTML audio rather than just read about it. In short: HTML audio is a subject of the HTML specification, incorporating audio, including speech to text, all in the browser. <audio> element The <audio> element represents a sound, or an audio stream. It is commonly used to play back a single audio file within a web page, showing a GUI widget with play/pause/volume controls.

Key takeaways

  • HTML audio belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect HTML audio to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of HTML audio from memory before moving on to harder problems.

Reference excerpt

HTML audio is a subject of the HTML specification, incorporating audio, including speech to text, all in the browser.

<audio> element The <audio> element represents a sound, or an audio stream. It is commonly used to play back a single audio file within a web page, showing a GUI widget with play/pause/volume controls. The <audio> element has these attributes: the music

global attributes (accesskey; class; contenteditable; contextmenu; dir; draggable; dropzone; hidden; id; lang; spellcheck; style; tabindex; title; translate) autoplay = "autoplay" or "" (empty string) or emptyInstructs the User-Agent to automatically begin playback of the audio stream as soon as it can do so without stopping. preload = "none" or "metadata" or "auto" or "" (empty string) or emptyRepresents a hint to the User-Agent about whether optimistic downloading of the audio stream itself or its metadata is considered worthwhile. "none": Hints to the User-Agent that the user is not expected to need the audio stream, or that minimizing unnecessary traffic is desirable. "metadata": Hints to the User-Agent that the user is not expected to need the audio stream, but that fetching its metadata (duration and so on) is desirable. "auto": Hints to the User-Agent that optimistically downloading the entire audio stream is considered desirable. controls = "controls" or "" (empty string) or emptyInstructs the User-Agent to expose a user interface for controlling playback of the audio stream. loop = "loop" or "" (empty string) or emptyInstructs the User-Agent to seek back to the start of the audio stream upon reaching the end. mediagroup = stringInstructs the User-Agent to link multiple videos and/or audio streams together. muted = "muted" or "" (empty string) or emptyRepresents the default state of the audio stream, potentially overriding user preferences. src = non-empty [URL] potentially surrounded by spacesThe URL for the audio stream. Example:

Supported audio coding formats The adoption of HTML audio, as with HTML video, has become polarized between proponents of free and patent-encumbered formats. In 2007, the recommendation to use Vorbis was retracted from the HTML5 specification by the W3C together with that to use Ogg Theora, citing the lack of a format accepted by all the major browser vendors. Apple and Microsoft support the ISO/IEC-defined formats AAC and the older MP3. Mozilla and Opera support the free and open, royalty-free Vorbis format in Ogg and WebM containers, and criticize the patent-encumbered nature of MP3 and AAC, which are guaranteed to be “non-free”. Google has so far provided support for all common formats. Most AAC files with finite length are wrapped in an MPEG-4 container (.mp4, .m4a), which is supported natively in Internet Explorer, Safari, and Chrome, and supported by the OS in Firefox and Opera. Most AAC live streams with infinite length are wrapped in an Audio Data Transport Stream container (.aac, .adts), which is supported by Chrome, Safari, Firefox and Edge. Many browsers also support uncompressed PCM audio in a WAVE container. In 2012, the free and open royalty-free Opus format was released and standardized by IETF. It is supported by Mozilla, Google, Opera and Edge. This table documents the current support for audio coding formats by the <audio> element.

Web Audio API and MediaStream Processing API The Web Audio API specification developed by W3C describes a high-level JavaScript API for processing and synthesizing audio in web applications. The primary paradigm is of an audio routing graph, where a number of AudioNode objects are connected together to define the overall audio rendering. The actual processing will primarily take place in the underlying implementation (typically optimized Assembly / C / C++ code), but direct JavaScript processing and synthesis is also supported. Mozilla's Firefox browser implements a similar Audio Data API extension since version 4, implemented in 2010 and released in 2011, but Mozilla warns it is non-standard and deprecated, and recommends the Web Audio API instead. Some JavaScript audio processing and synthesis libraries such as Audiolet Archived 2013-01-28 at the Wayback Machine support both APIs. The W3C Audio Working Group is also considering the MediaStream Processing API specification developed by Mozilla. In addition to audio mixing and processing, it covers more general media streaming, including synchronization with HTML elements, capture of audio and video streams, and peer-to-peer routing of such media streams.

Supporting browsers On PC:

Google Chrome 10 (Enabled by default since 14) Firefox 23 (Enabled by default since 25) Opera 15 Safari 6 Microsoft Edge 12 Opera GX 36 On mobile devices:

Google Chrome for Android 28 (Enabled by default since 29) and Apple iPads Safari 6 (Has restrictions on use (Muted unless user called)) Firefox 23 (Enabled by default since 25) Tizen

Web Speech API The Web Speech API aims to provide an alternative input method for web applications (without using a keyboard). With this API, developers can give web apps the ability to transcribe voice to text, from the computer's microphone. The recorded audio is sent to speech servers for transcription, after which the text is typed out for the user. The API itself is agnostic of the underlying speech recognition implementation and can support both server based as well as embedded recognizers. The HTML Speech Incubator group has proposed the implementation of audio-speech technology in browsers in the form of uniform, cross-platform APIs. The API contains both:

Speech Input API Text to Speech API Google integrated this feature into Google Chrome in March 2011. Letting its users search the web with their voice with code like:

See also HTML video Use of Ogg formats in HTML5

Notes

References

External links HTML5 audio element – W3C Web Audio API – W3C MediaStream Processing API – W3C Web Speech API – W3C Web Audio DAW – GitHub Mozilla's Web Audio API

Worked examples

Example 1 — a first encounter with HTML audio

Start with the simplest possible case. Write down what HTML audio claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to HTML audio before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about HTML audio ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of HTML audio

In research
HTML audio appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses HTML audio in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
HTML audio is common in secondary-school and first-year university syllabi. It links to neighbouring topics Digital audio, HTML5, Web programming, so understanding it makes those chapters shorter.
In everyday life
Look for HTML audio outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “HTML audio” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study HTML audio in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what HTML audio means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain HTML audio out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is HTML audio in simple terms?

HTML audio is a subject of the HTML specification, incorporating audio, including speech to text, all in the browser. <audio> element The <audio> element represents a sound, or an audio stream. It is commonly used to play back a single audio file within a web page, showing a GUI widget with play/pa…

Why does HTML audio matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study HTML audio?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on HTML audio.

Tags

  • Digital audio
  • HTML5
  • Web programming
  • Web standards

Keep exploring