Skip to content

Instantly share code, notes, and snippets.

View adkelley's full-sized avatar

Alex Kelley adkelley

  • San Francsico, CA
View GitHub Profile
@adkelley
adkelley / audiobuffersource.purs
Last active May 29, 2018 00:41
Candidate Solution for AudioBufferSource options
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.Maybe (Maybe(..))
type Secods = Number
@adkelley
adkelley / workflow-build.py
Created November 19, 2017 23:42 — forked from deanishe/workflow-build.py
Build Alfred Workflows into .alfredworkflow (zip) files
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2013 deanishe@deanishe.net.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#

Web Audio Fundamentals

HTML 5

Until recently, web developers had to rely on cross-browser plugins (e.g., Flash) to serve and play back sounds on a web site. This finally changed when all of the major browser manufacturers rallyed around the audio tag, introduced in HTML 5. Its key capabilities include: auto playback, preloading sounds, a controls UI, looping, and a src URL for the audio stream. Unfortunately support for audio codecs varies significantly with each browser. Thus, if you're sound file uses the patent encumbered MP3 or AAC, then you will have to provide an alternate format such as the WAV file format, which is lossless and raw. Its typically a much bigger file, but it is supported by all browsers. Below is an simple example of using the audio tag with attributes controls (the standard HTML controls for audio on a web page), autoplay (audio plays automatically) and loop (auto repeat automatically):

<audio src=“audio.ogg" autoplay controls loop>
<p>Your browser does not suppo