Skip to content

chernistry/underconstruction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare Worker: Interactive MIDI Sampler

Sampler Screenshot

A minimalist Cloudflare Worker to display an interactive synthesizer during maintenance. Just copy the contents of underconstruction.js into a new Worker and you're good to go.

  • 9 Pads: Play any chords from your MIDI file (example uses Crystal Waters' "She's Homeless").
  • Browser-Based: Playback and synthesis happen directly in the browser with no dependencies.
  • Mobile Friendly: Works on mobile devices.

Quick Start

  1. Create a new Cloudflare Worker.
  2. Paste the code from underconstruction.js.
  3. (Optional) Use your own MIDI file: a. Upload your .mid file to a service like a CDN, an R2 bucket, or any public web server. b. In underconstruction.js, update the MIDI_URL constant with the link to your file. The default URL is just a nice-sounding example.
    const MIDI_URL = 'https://your-midi-file.mid';
  4. Route your traffic to this worker during maintenance periods:
    export default {
      async fetch(request) {
        const handler = new UnderConstructionHandler();
        return handler.handle(request);
      }
    }

Local Development

To run this worker locally for development:

npm install -g @cloudflare/wrangler
wrangler dev --local

⚠️ Requires a browser that supports the Web Audio API.

About

Interactive MIDI sampler for Cloudflare Worker as Under construction page

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published