Draw sound on the web.
SonicFrame draws a sound on a canvas, follows it while it plays, and lets people seek with a click, a drag or the keyboard. No dependencies, any framework, a strict Content-Security-Policy.
Sponsor Buy me a coffee SonicFrame is free, and built by one person. Support keeps it growing, accessible to everyone.
Loading the music…
Install
One package, nothing else to install. Use the player from JavaScript, or write it as a tag.
npm install sonicframe
In JavaScript
import { createPlayer } from 'sonicframe/player';
createPlayer({
container: document.querySelector('#voice'),
src: '/voice.mp3',
theme: 'bubble',
});
As an HTML tag
<sonic-player src="/voice.mp3" theme="bubble">
</sonic-player>
<script type="module">
import { defineSonicPlayer } from 'sonicframe/player';
defineSonicPlayer();
</script>
This player is the tag above, on this page.
How to use these docs
The pages are in four kinds, in the sidebar's order:
- Learn (Getting started and The basics): new to SonicFrame? Start with the Quickstart and read on in order.
- Features (The player, Accessibility, Long sounds, Plugins): one page per feature, each with a live example, its options and its accessibility notes.
- Guides: whole use cases, such as a podcast player or a chat voice note.
- Reference: every option, method, event and attribute, in tables.
Press Ctrl + K (or ⌘ + K) on any page to search.
What helps to know
These docs assume some HTML, CSS and JavaScript. No framework is needed: SonicFrame works in plain pages and inside any framework, because it only asks for an element to draw in.
Accessible from the start
Every wave is a keyboard slider that says its position in words, every control is a real button, and less motion is respected. The extras, such as the sound described in words, are one option away. See Accessibility.
Where next
- Quickstart: a working player in five steps.
- Themes and palettes: a whole look in one word.
- Zoom and scroll: get close to a word, or across an hour.
- Plugins: regions, markers, a ruler, a spectrogram and more.
Sponsors
Your company's logo and link can be here and in the README, seen by the developers who choose an audio player. Become a sponsor.