You want to create or find an HTML-based chiptune tracker with specific features:
- BPM controls
- Rows per track
- Patterns and rows per pattern
- Synth per instrument with custom oscillator
- Volume, detune, ADSR envelope, filter, noise controls
- Ability to share compositions (via URL hash
/# or similar)
- Keyboard shortcuts and loop playback
- No demo or audio samples (pure synth)
Given this, here are some possible paths and suggestions:
1. Existing Project Recommendations
There are a few open-source or web-based trackers that come close to this:
-
BeepBox
- Very popular chiptune tracker in-browser
- Full control over patterns, instruments with custom oscillators
- ADSR, volume, detune, filters, noise available
- BPM, rows per pattern control
- Keyboard shortcuts & looping
- Shareable URLs (
/# with song data)
- Pure synthesis, no sample playback
- Source code is open on GitHub: https://github.com/johnfactotum/beepbox
-
JSFXR or fxgls
- Synth-only sound effect and small sequences tools, more limited tracker functionality though
- Focus on custom oscillator and noise controls
- Less of a full tracker, more sound design
-
Squinky Tracker
- More advanced with synth controls and pattern editing
- Synth params with ADSR, filter, detune
- Looping, shortcuts
- No samples, pure synth
- Share via URL
2. Build Your Own Minimal Chiptune Tracker in HTML/JS
If you want a simple proof of concept or a starting point for your own tracker with those features, here’s a rough outline:
- Use Web Audio API for synthesis
- Create a grid UI for patterns and tracks (rows per pattern)
- Allow BPM to control playback timer
- Define instruments with oscillator types (
sine, square, triangle, sawtooth) and noise
- Controls per instrument: volume, detune, ADSR envelope, filter (lowpass)
- Keyboard shortcuts for navigation and editing
- Encode song data in JSON and serialize it into URL hash (
location.hash = ...) for easy sharing
- Playback loop over patterns and tracks
This will be a moderately complex JS project — not trivial, but doable.
3. Minimal Example Snippet (Concept)
Below is a very minimal snippet illustrating how to start with synth instrumentation and a pattern data structure:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Mini Chiptune Tracker</title>
<style>
body { font-family: monospace; background:#222; color:#eee; }
table { border-collapse: collapse; }
td { border: 1px solid #555; padding: 5px; width: 20px; text-align: center; }
</style>
</head>
<body>
<h1>Mini Chiptune Tracker</h1>
<p>BPM: <input id="bpm" type="number" value="120" min="30" max="300" /></p>
<button id="play">▶ Play/Stop</button>
<table id="pattern"></table>
<script>
const ROWS_PER_PATTERN = 16;
const TRACKS = 3;
// Simple pattern: array of tracks, each track is array of notes (frequency or null)
let pattern = [];
for(let t=0; t<TRACKS; t++){
pattern[t] = [];
for(let r=0; r<ROWS_PER_PATTERN; r++) pattern[t][r] = null;
}
// Fill in some demo notes (C4=261.63Hz), here just placing a C note on row 0 for all tracks
pattern[0][0] = 261.63;
pattern[1][4] = 329.63; // E4
pattern[2][8] = 392.00; // G4
const table = document.getElementById('pattern');
function renderPattern(){
table.innerHTML = '';
for(let r=0; r<ROWS_PER_PATTERN; r++){
const tr = document.createElement('tr');
for(let t=0; t<TRACKS; t++){
const td = document.createElement('td');
td.textContent = pattern[t][r] ? '♪' : '.';
tr.appendChild(td);
}
table.appendChild(tr);
}
}
renderPattern();
// Web Audio setup
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
// Simple instrument settings
const instrument = {
type: 'square',
volume: 0.2,
detune: 0,
adsr: { attack:0.01, decay:0.1, sustain:0.3, release:0.5 },
filterFreq: 1000,
noise: false
};
function playNote(freq, duration=0.5){
const now = audioCtx.currentTime;
const osc = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
const filter = audioCtx.createBiquadFilter();
filter.type = 'lowpass';
filter.frequency.setValueAtTime(instrument.filterFreq, now);
osc.type = instrument.type;
osc.frequency.setValueAtTime(freq, now);
osc.detune.setValueAtTime(instrument.detune, now);
osc.connect(filter);
filter.connect(gainNode);
gainNode.connect(audioCtx.destination);
// ADSR envelope
const { attack, decay, sustain, release } = instrument.adsr;
gainNode.gain.setValueAtTime(0, now);
gainNode.gain.linearRampToValueAtTime(instrument.volume, now + attack);
gainNode.gain.linearRampToValueAtTime(instrument.volume * sustain, now + attack + decay);
gainNode.gain.setValueAtTime(instrument.volume * sustain, now + duration);
gainNode.gain.linearRampToValueAtTime(0, now + duration + release);
osc.start(now);
osc.stop(now + duration + release + 0.1);
}
// Playback loop
let playing = false;
let currentRow = 0;
let timerId;
document.getElementById('play').onclick = () => {
if(playing){
clearInterval(timerId);
playing = false;
currentRow = 0;
} else {
const bpmInput = document.getElementById('bpm');
const bpm = Number(bpmInput.value) || 120;
const interval = (60 / bpm) / 4 * 1000; // 16th notes assuming 4 rows = quarter note
playing = true;
timerId = setInterval(() => {
for(let t=0; t<TRACKS; t++){
const freq = pattern[t][currentRow];
if(freq) playNote(freq, interval / 1000);
}
currentRow = (currentRow+1) % ROWS_PER_PATTERN;
}, interval);
}
}
</script>
</body>
</html>
This is a minimal starting point showing pattern rows, a simple instrument with ADSR and filter, and timed playback at custom BPM. It can be extended with UI elements to edit patterns, more instruments, detune, noise, sharing state via URL etc.
4. Tips for Sharing Data in URL Hash
- Serialize your song object via JSON + base64 encoding to keep it compact
- Store in
location.hash = "#data=..."
- On load, parse
location.hash to restore the song and UI state
- Example libraries for base64:
btoa and atob built in browsers
Summary
-
For full-featured web tracker chiptune apps, highly recommend BeepBox or Squinky Tracker
-
For custom development, build around Web Audio API with instruments supporting oscillator and noise nodes, ADSR envelopes, filters etc, store pattern data in JS arrays
-
Use URL hash sharing after JSON+base64 encoding
-
Keyboard shortcuts & loop control handled in JS event handlers
If you want, I can help build a more full-featured demo or walk through adding a specific feature! Just ask.