It looks like you want to create (or have a reference to) a chiptune tracker/sequencer implemented in HTML/CSS/JS with fairly advanced features, including:
Sequencer playback with BPM control
Song structure with chords
Adjustable pattern size and rows per pattern
Multiple instruments with synth options and custom waveforms/oscillators
Volume, detune, ADSR envelopes, filters, noise options
Song sharing (possibly via URL hash or similar)
Keyboard shortcuts for editing (dupe, delete, copy, paste pattern)
Looping over patterns
No demo or sample tracks included (or no demo mode)
Since this is a complex project, I can provide a starter template outlining the architecture and key features, or point you to existing libraries/projects with source code so you can extend or customize them.
1. Existing DJ/Tracker Projects To Reference or Fork
BeepBox : Chiptune music creation tool with a web-based tracker, extensive controls, sharing via URL, and nice UI/UX. Open source on GitHub.
JummBox : Web-based chiptune tracker.
FamiTracker : Popular tracker but native Windows app, not web.
JSynthLib : JavaScript synth library.
2. Basic Plan for Your Tracker Tool
Technologies:
HTML: UI layout grid (pattern, instruments, controls)
CSS: Styling, responsive grid, dark/light UI
JavaScript:
Web Audio API for synth, oscillators, ADSR, filters, noise
State management: song → patterns → rows → notes/chords
Playback loop driven by BPM timer
Keyboard shortcuts for editing
Share via encoded song serialized in URL hash (e.g., base64 JSON)
3. Starter Example Snippet
Here is a simplified outline focusing on the core loop, multiple instruments with an oscillator, and pattern editing basics.
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Chiptune Tracker</title>
<style>
body { font-family: monospace; background: #222; color: #ccc; margin: 0; }
#patternGrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; max-width: 600px; margin: auto; }
.cell { border: 1px solid #444; padding: 5px; text-align: center; cursor: pointer; user-select:none; }
.cell.active { background: #0f0; color: black; }
#controls { margin: 1em auto; max-width: 600px; text-align: center; }
</style>
</head>
<body>
<h1 style="text-align:center;">Chiptune Tracker</h1>
<div id="patternGrid"></div>
<div id="controls">
BPM: <input id="bpm" type="number" value="120" min="30" max="300" step="1" style="width:60px" />
<button id="playPause">Play</button>
<button id="clearPattern">Clear</button>
</div>
<script>
// Setup state:
const ROWS = 16;
const CHANNELS = 4; // number of instruments
let bpm = 120;
const notes = ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5'];
const waveformTypes = ['square', 'sawtooth', 'triangle', 'sine'];
// Pattern data: [rows][channels] = note or null
let pattern = Array.from({ length: ROWS }, () => Array(CHANNELS).fill(null));
const patternGrid = document.getElementById('patternGrid');
// Create grid cells (rows * channels)
function renderPattern() {
patternGrid.innerHTML = '';
for(let r = 0; r < ROWS; r++) {
for(let c = 0; c < CHANNELS; c++) {
const cell = document.createElement('div');
cell.classList.add('cell');
let note = pattern[r][c];
cell.textContent = note ?? '-';
if(note) cell.classList.add('active');
cell.dataset.row = r;
cell.dataset.channel = c;
cell.onclick = () => {
// Cycle note on click
let idx = notes.indexOf(pattern[r][c]);
idx = (idx + 1) % (notes.length + 1);
pattern[r][c] = idx < notes.length ? notes[idx] : null;
renderPattern();
}
patternGrid.appendChild(cell);
}
}
}
renderPattern();
// Web Audio Setup
const AudioContext = window.AudioContext || window.webkitAudioContext;
const audioCtx = new AudioContext();
function playNote(freq, duration = 0.3, channel = 0) {
if(audioCtx.state === 'suspended') audioCtx.resume();
const osc = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
// You can customize the waveform, detune, ADSR here
osc.type = waveformTypes[channel % waveformTypes.length];
osc.frequency.value = freq;
// ADSR simple envelope
gainNode.gain.setValueAtTime(0, audioCtx.currentTime);
gainNode.gain.linearRampToValueAtTime(0.3, audioCtx.currentTime + 0.01);
gainNode.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + duration);
osc.connect(gainNode).connect(audioCtx.destination);
osc.start();
osc.stop(audioCtx.currentTime + duration);
}
// Note to frequency conversion (simple)
function noteToFreq(note) {
const noteFreqMap = {
'C4': 261.63, 'D4': 293.66, 'E4': 329.63, 'F4': 349.23,
'G4': 392.00, 'A4': 440.00, 'B4': 493.88, 'C5': 523.25
};
return noteFreqMap[note] || 440;
}
// Sequencer play loop
let playInterval = null;
let currentRow = 0;
function playStep() {
for(let ch = 0; ch < CHANNELS; ch++) {
let note = pattern[currentRow][ch];
if(note) playNote(noteToFreq(note), 0.25, ch);
}
highlightRow(currentRow);
currentRow = (currentRow + 1) % ROWS;
}
function highlightRow(row) {
// Remove highlight from all row cells
[...patternGrid.children].forEach(cell => cell.style.backgroundColor = '');
// Highlight current row
for(let c = 0; c < CHANNELS; c++) {
const idx = row * CHANNELS + c;
patternGrid.children[idx].style.backgroundColor = '#222';
}
}
const playPauseBtn = document.getElementById('playPause');
const bpmInput = document.getElementById('bpm');
playPauseBtn.onclick = () => {
if(playInterval === null) {
// Start playing
bpm = parseInt(bpmInput.value) || 120;
const intervalMs = (60000 / bpm) / 4; // 16th notes (4 rows per beat)
currentRow = 0;
playStep();
playInterval = setInterval(playStep, intervalMs);
playPauseBtn.textContent = 'Pause';
} else {
// Stop playing
clearInterval(playInterval);
playInterval = null;
highlightRow(-1);
playPauseBtn.textContent = 'Play';
}
};
bpmInput.onchange = () => {
if(playInterval !== null) {
clearInterval(playInterval);
bpm = parseInt(bpmInput.value) || 120;
const intervalMs = (60000 / bpm) / 4;
playInterval = setInterval(playStep, intervalMs);
}
};
// Clear pattern button
document.getElementById('clearPattern').onclick = () => {
pattern = Array.from({ length: ROWS }, () => Array(CHANNELS).fill(null));
renderPattern();
if(playInterval !== null) {
highlightRow(-1);
}
};
// TODO: Add share via URL, pattern copy/paste, ADSR, detune, filters, noise, multiple waveforms, and chords
</script>
</body>
</html>
4. Next Steps
To get to your full spec, you’ll want to add:
Chords and multiple notes per channel per row (array of notes instead of one)
Instrument settings panel featuring:
Waveform selector with custom waveform options
ADSR envelope controls (attack, decay, sustain, release)
Filter types and cutoffs
Noise generator toggles
Volume and detune sliders
Song structure consisting of multiple patterns linked in a sequence
Pattern editing commands :
Duplicate, delete, copy, and paste
Keyboard shortcuts (using keydown event)
Loop and play range selection
Save/load song functionality and share via URL hash (serialize your song data as JSON, then encodeBase64URI it, place after # in URL)
If you want, I can help you build out any of these features step by step or help with code for specific parts such as ADSR in WebAudio, pattern serialization, or UI design. Just ask!