Got it! You're looking for an HTML-based chiptune tracker tool with the following features:
- BPM control
- Multiple patterns with customizable rows per pattern
- Multiple instruments, each with:
- A synth capable of custom waveform selection (oscillator)
- Volume and detune control
- ADSR envelope
- Filter and noise controls
- Ability to share song data via URL hash (
/#)
- Keyboard shortcuts for common actions like duplicate, delete, loop
- No demo or sound autoplay on load
Solution Approach
Since you want a full tracker experience in-browser, I'd recommend building or using an existing minimal chiptune tracker framework and extend it to meet your specs, or build a custom one.
Option 1: Use an existing lightweight JS library + UI scaffold
- Use Tone.js for the synth & audio engine — supports oscillators, filters, envelopes, noise, detune, volume
- Build a pattern editor UI in HTML/JS
- Implement data model: instruments, patterns, rows
- Serialize song state as JSON, encode as base64 URI component in the URL hash (after
/#) for sharing
- Keyboard shortcuts with JS event listeners
- No autoplay (only play on user interaction)
Example minimal skeleton code & explanation
Here’s a simplified example outline of how it could be laid out, demonstrating key parts:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>HTML Chiptune Tracker</title>
<style>
body { font-family: monospace; background: #222; color: #ccc; }
#tracker { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
textarea { width: 100%; height: 200px; background: #111; color: #0f0; font-family: monospace; }
button { margin-top: 1rem; }
input, select { width: 100%; margin: 0.25rem 0;}
.instrument, .pattern { border: 1px solid #444; padding: 0.5rem; }
</style>
</head>
<body>
<h1>HTML Chiptune Tracker</h1>
<div>
BPM: <input id="bpm" type="number" value="140" min="30" max="300" />
Rows per pattern: <input id="rows" type="number" value="16" min="4" max="64" />
<button id="playpause">Play</button>
</div>
<div id="tracker">
<div id="patterns" class="pattern">
<h2>Patterns</h2>
<textarea id="patternData"># Example pattern data, e.g. notes per row</textarea>
<button id="duplicatePattern">Duplicate</button>
<button id="deletePattern">Delete</button>
<button id="loopPattern">Toggle Loop</button>
</div>
<div id="instruments" class="instrument">
<h2>Instruments</h2>
<label>Waveform
<select id="waveform">
<option>sine</option>
<option>square</option>
<option>sawtooth</option>
<option>triangle</option>
<option>custom</option>
</select>
</label>
<label>Volume <input type="range" id="volume" min="0" max="1" step="0.01" value="0.8" /></label>
<label>Detune <input type="range" id="detune" min="-50" max="50" step="1" value="0" /></label>
<fieldset>
<legend>ADSR Envelope</legend>
<label>Attack <input type="number" id="attack" min="0" max="2" step="0.01" value="0.1" /></label>
<label>Decay <input type="number" id="decay" min="0" max="2" step="0.01" value="0.1" /></label>
<label>Sustain <input type="number" id="sustain" min="0" max="1" step="0.01" value="0.8" /></label>
<label>Release <input type="number" id="release" min="0" max="3" step="0.01" value="0.3" /></label>
</fieldset>
<label>Filter Frequency <input type="number" id="filterFreq" min="100" max="10000" step="1" value="1000" /></label>
<label>Noise Level <input type="range" id="noise" min="0" max="1" step="0.01" value="0" /></label>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/tone@14.7.77/build/Tone.min.js"></script>
<script>
// Global state
let isPlaying = false;
let currentPattern = 0;
let rowsPerPattern = parseInt(document.getElementById('rows').value);
let bpm = parseInt(document.getElementById('bpm').value);
// Simple song data
let song = {
bpm,
rowsPerPattern,
instruments: [
{
waveform: 'square',
volume: 0.8,
detune: 0,
envelope: { attack: 0.1, decay: 0.1, sustain: 0.8, release: 0.3 },
filterFreq: 1000,
noiseLevel: 0
}
],
patterns: [
Array(rowsPerPattern).fill('C4') // Example: 'C4' note on each row
],
loopPattern: false
};
// Synth setup using Tone.js
const synth = new Tone.MonoSynth({
oscillator: { type: song.instruments[0].waveform },
envelope: song.instruments[0].envelope,
filter: { frequency: song.instruments[0].filterFreq },
volume: Tone.gainToDb(song.instruments[0].volume)
}).toDestination();
// Noise generator if needed (not shown for brevity)
// Update synth when instrument changes
function updateSynth() {
const inst = song.instruments[0];
synth.oscillator.type = inst.waveform;
synth.volume.value = Tone.gainToDb(inst.volume);
synth.detune.value = inst.detune;
synth.envelope.attack = inst.envelope.attack;
synth.envelope.decay = inst.envelope.decay;
synth.envelope.sustain = inst.envelope.sustain;
synth.envelope.release = inst.envelope.release;
synth.filter.frequency.value = inst.filterFreq;
// apply noise as separate node if implemented
}
// Playback loop
let currentRow = 0;
function playStep(time) {
if (!isPlaying) return;
const pattern = song.patterns[currentPattern];
const note = pattern[currentRow];
if (note && note !== '-') {
synth.triggerAttackRelease(note, '8n', time);
}
currentRow++;
if (currentRow >= song.rowsPerPattern) {
if (song.loopPattern) {
currentRow = 0;
} else {
isPlaying = false;
Tone.Transport.stop();
currentRow = 0;
}
}
}
// Start/stop playback
document.getElementById('playpause').addEventListener('click', async () => {
if (!isPlaying) {
await Tone.start(); // user interaction required
Tone.Transport.bpm.value = song.bpm;
currentRow = 0;
Tone.Transport.scheduleRepeat(playStep, `4n`); // quarter notes at bpm
Tone.Transport.start();
isPlaying = true;
document.getElementById('playpause').textContent = 'Pause';
} else {
Tone.Transport.stop();
isPlaying = false;
document.getElementById('playpause').textContent = 'Play';
}
});
// Update state handlers for inputs, pattern management, shortcuts...
// Share song via URL hash
function shareSong() {
const json = JSON.stringify(song);
const encoded = btoa(unescape(encodeURIComponent(json))); // base64 encode
history.replaceState(null, '', `/#${encoded}`);
}
// Load song from URL hash on load
window.addEventListener('load', () => {
if (location.hash.startsWith('#')) {
try {
const decoded = decodeURIComponent(escape(atob(location.hash.slice(1))));
const loaded = JSON.parse(decoded);
Object.assign(song, loaded);
// Update UI accordingly
document.getElementById('bpm').value = song.bpm;
document.getElementById('rows').value = song.rowsPerPattern;
document.getElementById('patternData').value = song.patterns[0].join('\n');
const inst = song.instruments[0];
document.getElementById('waveform').value = inst.waveform;
document.getElementById('volume').value = inst.volume;
document.getElementById('detune').value = inst.detune;
document.getElementById('attack').value = inst.envelope.attack;
document.getElementById('decay').value = inst.envelope.decay;
document.getElementById('sustain').value = inst.envelope.sustain;
document.getElementById('release').value = inst.envelope.release;
document.getElementById('filterFreq').value = inst.filterFreq;
document.getElementById('noise').value = inst.noiseLevel;
updateSynth();
} catch(e) {
console.warn('Failed to load song from URL hash:', e);
}
}
});
// Keyboard shortcuts example
window.addEventListener('keydown', e => {
if (e.ctrlKey) {
switch(e.key.toLowerCase()) {
case 'd': // Ctrl+D duplicate pattern
alert('Duplicate pattern (not implemented)');
break;
case 'x': // Ctrl+X delete pattern
alert('Delete pattern (not implemented)');
break;
case 'l': // Ctrl+L toggle loop pattern
song.loopPattern = !song.loopPattern;
alert(`Loop pattern ${song.loopPattern ? 'enabled' : 'disabled'}`);
break;
}
}
});
</script>
</body>
</html>
What this demo shows:
- Controls for BPM and rows per pattern (you’d update your song model accordingly)
- Basic pattern data editing as text (you'd create a nicer grid UI in a real app)
- Instrument parameters: waveform, volume, detune, ADSR envelope, filter freq, noise (noise not implemented in this snippet, but Tone.js supports noise with a noise synth)
- Playing pattern rows sequentially using Tone.js scheduling, with simple loop logic
- Sharing song via URL hash (encoded JSON base64 for compactness)
- Keyboard shortcuts for common pattern operations (placeholders)
- No autoplay sound — user must click play
What’s missing / next steps to complete:
- Pattern editor with note input UI instead of a textarea
- Multiple instruments & pattern management UI
- Custom waveform support (Tone.js supports custom waveforms via PeriodicWave, but needs extra UI + code)
- Sample accurate scheduler handling pattern changes, groove timing
- Noise oscillator setup and integration into instrument audio chain
- Save/load song buttons / export options
- Enhanced shortcuts for all required functions
Summary
This scaffold serves as a foundation for your tracker with all requested features architected in:
- BPM, rows per pattern, multiple instruments with synth properties
- URL sharing with
/## hash
- Keyboard shortcuts (expandable)
- No autoplay audio
You can build upon this by enhancing UI and feature completeness. If you'd like, I can help with more detailed implementations for each part!