Fizz player

Host a Fizz player on your website.

Your Fizz score, playable on any page. One script tag.

Quick start

Load the script once, then put the element where the music goes.

index.html
<script src="https://fizz.fm/player.js"></script>

<!-- a published track, by its slug -->
<fizz-player track="tidal-arpeggio"></fizz-player>

<!-- or your own Fizz score -->
<fizz-player name="My first beat" color="#4FE0BE">
  <script type="text/fizz">
    fizz score v0
    bpm 120
    key C minor

    section "Loop" bars=1
      chords: i
        kick 909_bd : x... x... x... x...
        hat 909_hh gain=0.3 : x.x. x.x. x.x. x.x.
        bass gm_synth_bass_1 : 1... .... 1... 3...
  </script>
</fizz-player>

Audio starts on the first tap; browsers don’t let a page autoplay.

Older embeds use the legacy <hyperjam-player> tag. It still works the same way.

Attributes

track
A Fizz FM track slug (slug= works too). Loads its name, author, colour, cover and Fizz score.
score
A Fizz score, as JSON or text, inline or in a child <script type="text/fizz">.
code
Legacy: Strudel code, inline or in <script type="text/strudel">. Read into a Fizz score; what can’t be read doesn’t play.
name, author
The title and byline.
color, cover
Track colour, and a cover image the vinyl takes its colour from.
theme
dark (default), light, or auto to follow the viewer’s system.
pads
Show the track’s pads, as the iPhone app does: Loop (tap a pad and it takes over on the next bar) and, when the track has a saved song, Song (the same pads, played in song order). pads or pads="loop" opens on Loop, pads="song" on Song. Needs track, or pads handed to setTrack().
size
No size: Full at 560px and wider, Phone under. compact: one row (with pads, four mini pads). pads: no record, no score. square: a 360px tile. tall: a 320 × 600 sidebar.
hide
Space-separated parts to leave out: author, jam-link, cover, code.

Theming

Match your site: set these CSS variables on the element, or on any parent. Anything you leave out keeps its default.

styles.css
fizz-player {
  --hj-accent: #7C5CFF;     /* Play key and meter */
  --hj-accent-text: #fff;
  --hj-bg: #0E1726;
  --hj-text: #E6EDF7;
  --hj-radius: 8px;
  --hj-font: "Inter", system-ui, sans-serif;
}
--hj-bg, --hj-text, --hj-muted
Card, text and byline.
--hj-accent, --hj-accent-text
The Play key and meter, and the text on the key.
--hj-code-bg, --hj-focus
Behind the code, and keyboard focus rings.
--hj-drums, --hj-bass, --hj-chords, --hj-melody
Score lines as they light up, by part.
--hj-radius
The card’s corners.
--hj-font, --hj-title-font, --hj-code-font
Fonts. With your own, add fonts="none".

Embedding with an iframe? Add ?theme=auto or ?accent=7C5CFF to its address.

JavaScript

script.js
const player = document.querySelector("fizz-player");
await player.play();         // from a click or tap
await player.setScore(next); // a Fizz score; crossfades in on beat 1
player.addEventListener("hap", (e) => light(e.detail.lane));
player.addEventListener("padchange", (e) => (caption.textContent = e.detail.name));

// a track you hold yourself: its pads and song, and newer versions while it plays
player.setTrack({ name: "My beat", score, pads: [{ id: "a", name: "Verse", bars: 4, score }], song: ["a"] });
player.versions = [{ id: "v1", title: "First take" }, { id: "v2", title: "Darker and slower", detail: "Minor key, half-time drums", meta: "92 bpm · F minor" }];
player.version = "v2";
player.addEventListener("versionchange", (e) => showVersion(e.detail.id)); // answer with setTrack and version
play, pause
When it starts and stops.
padchange
{ id, name, index, mode } when a pad starts sounding (with pads).
load
{ track } when a track slug has loaded, or setTrack() handed one over.
versionchange
{ id } when the viewer asks for another version (undo, redo, or a row in the versions drawer). Answer with setTrack() and version.
hap
{ starts, at, dur, lane } for every sound, as it is scheduled.
error
{ message, cause }.

Style the inside with ::part(): card, title, author, play, jam-link, code, mode, pads, pad, song, versions, versions-drawer.

Embed without code

Paste a fizz.fm track link in Notion, Ghost, Medium or Discourse. Elsewhere, use a track page’s Embed button.

Licence

Free to use on any page: load it from fizz.fm and it plays on Fizz FM’s own engine, with its sounds served from fizz.fm too.

Sign in in the app

needs a Fizz FM account, and for now accounts live in the iPhone app. Sign in there to follow makers, love tracks, post remixes and fill your Following feed. Signing in on the web is coming.

Come play with us

Good things start with hello.

Fizz FM is in a free beta on iPhone through Apple’s TestFlight. Leave your email and we’ll send you an invite.

We use your email to send the invite, and news only if you tick the box. Ask us to delete it any time. See our Privacy policy.