It sounds like you're asking about—or requesting—a web-based HTML chiptune tracker tool with the following features:
- BPM (tempo) control
- Patterns and rows per pattern
- Synth per instrument with:
- Custom oscillators
- Volume, detune, ADSR envelope, filter, noise control
- Ability to share songs
- Keyboard shortcuts for:
- Duplicate (dupe)
- Delete
- Loop
- Use of "/#" in URLs (likely for routing or state persistence)
- No demo (maybe you want a tool without a demo feature or want a code example without demo content)
Are you asking for:
- An existing open-source HTML chiptune tracker with these features?
- A code snippet or mini implementation of such a tracker?
- Recommendations on tools or libraries to build one?
- How to implement these features in your own project?
Since the request is broad, here’s a useful overview & starting points:
1. Existing Projects
Web-based chiptune trackers:
2. Building Your Own Simple HTML Chiptune Tracker (Approach outline)
To build a minimal one from scratch or extend an existing example, key concepts:
- Use the Web Audio API for synth sound generation.
- Have a UI grid showing patterns & rows per pattern.
- Define instruments having synth parameters:
- Oscillator type (sine, square, sawtooth, custom waveform)
- Volume + detune
- ADSR envelopes (attack, decay, sustain, release)
- Filters (e.g. lowpass)
- Noise (can simulate via buffer source or noise oscillator)
- BPM controls tempo and playback speed.
- User can edit rows in patterns to set notes and instrument.
- Provide keyboard shortcuts:
Ctrl+D for duplicate pattern/row
Del or Backspace for delete
L for loop toggle
- Use URL hash (
/#) to encode/share song state.
- No demo mode means start fresh or empty pattern.
3. Minimal example for custom oscillator + ADSR + basic tracker UI
Below is a very basic skeleton to get you started:
<!DOCTYPE html>
<html>
<head>
<title>Simple HTML Chiptune Tracker</title>
<style>
body { font-family: monospace; }
table { border-collapse: collapse; }
td, th { border: 1px solid #888; text-align: center; padding: 4px; width: 30px; }
.selected { background-color: #ccc; }
#controls { margin-top: 10px; }
</style>
</head>
<body>
<h1>Simple Chiptune Tracker</h1>
<table id="pattern">
<!-- pattern grid here -->
</table>
<div id="controls">
BPM: <input type="number" id="bpm" min="30" max="300" value="120">
<button id="play">Play</button>
<button id="stop">Stop</button>
</div>
<script>
const AudioCtx = window.AudioContext || window.webkitAudioContext;
const audioCtx = new AudioCtx();
// Tracker parameters
const rowsPerPattern = 16;
const bpmInput = document.getElementById('bpm');
const patternTable = document.getElementById('pattern');
let playInterval;
let currentRow = 0;
// Simple instrument with custom oscillator settings
const instrument = {
oscillatorType: 'square',
volume: 0.2,
detune: 0,
adsr: { attack: 0.01, decay: 0.1, sustain: 0.6, release: 0.3 },
filterFrequency: 1000,
noiseLevel: 0
};
// Simple note frequencies for one octave (C4-B4)
const noteFreqs = {
C4: 261.63, D4: 293.66, E4: 329.63, F4: 349.23, G4: 392.00, A4: 440.00, B4: 493.88,
'': 0
};
// Create the pattern table UI with empty notes
function createPatternTable() {
patternTable.innerHTML = '';
// Header row for note names
const header = document.createElement('tr');
header.appendChild(document.createElement('th')); // empty top-left cell
['C4','D4','E4','F4','G4','A4','B4'].forEach(note => {
const th = document.createElement('th');
th.textContent = note;
header.appendChild(th);
});
patternTable.appendChild(header);
for(let i=0; i<rowsPerPattern; i++) {
const tr = document.createElement('tr');
const th = document.createElement('th');
th.textContent = i+1;
tr.appendChild(th);
['C4','D4','E4','F4','G4','A4','B4'].forEach(() => {
const td = document.createElement('td');
td.textContent = ''; // empty note by default
td.contentEditable = true;
td.addEventListener('click', () => {
selectCell(td);
});
tr.appendChild(td);
});
patternTable.appendChild(tr);
}
}
// Currently selected cell
let selectedCell = null;
function selectCell(td) {
if(selectedCell) selectedCell.classList.remove('selected');
selectedCell = td;
td.classList.add('selected');
}
// Play a note with ADSR envelope
function playNote(freq, instrument) {
if(freq === 0) return;
const osc = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
const filter = audioCtx.createBiquadFilter();
const now = audioCtx.currentTime;
osc.type = instrument.oscillatorType;
osc.frequency.value = freq;
osc.detune.value = instrument.detune;
filter.type = "lowpass";
filter.frequency.setValueAtTime(instrument.filterFrequency, now);
osc.connect(filter).connect(gainNode).connect(audioCtx.destination);
// ADSR envelope
gainNode.gain.setValueAtTime(0, now);
gainNode.gain.linearRampToValueAtTime(instrument.volume, now + instrument.adsr.attack);
gainNode.gain.linearRampToValueAtTime(instrument.volume * instrument.adsr.sustain, now + instrument.adsr.attack + instrument.adsr.decay);
osc.start(now);
// Schedule release
gainNode.gain.setTargetAtTime(0, now + 0.3, instrument.adsr.release);
osc.stop(now + 1);
osc.onended = () => {
osc.disconnect();
gainNode.disconnect();
filter.disconnect();
};
}
// Play current row notes concurrently
function playRow(row) {
const cells = patternTable.rows[row + 1].cells;
// skip first th cell
for(let i=1; i < cells.length; i++) {
const noteName = patternTable.rows[0].cells[i].textContent;
const cell = cells[i];
const content = cell.textContent.trim().toUpperCase();
if(content === 'X') { // Mark 'X' means play this note
playNote(noteFreqs[noteName], instrument);
}
}
}
// Playback loop
function playPattern() {
if(playInterval) clearInterval(playInterval);
const interval = 60000 / (bpmInput.value * 4); // quarter notes, 4 rows = 1 beat
currentRow = 0;
playInterval = setInterval(() => {
playRow(currentRow);
currentRow++;
if(currentRow >= rowsPerPattern) {
currentRow = 0;
}
}, interval);
}
document.getElementById('play').onclick = () => {
if(audioCtx.state === 'suspended') audioCtx.resume();
playPattern();
};
document.getElementById('stop').onclick = () => {
clearInterval(playInterval);
playInterval = null;
};
// Initialize UI
createPatternTable();
// Keyboard shortcuts: example - duplicate row (Ctrl+D)
window.addEventListener('keydown', e => {
if(!selectedCell) return;
const row = selectedCell.parentElement.rowIndex -1;
switch(e.key.toLowerCase()) {
case 'd':
if(e.ctrlKey) {
// Duplicate row
const rowToCopy = patternTable.rows[row + 1];
const newRow = [];
for(let i=1; i < rowToCopy.cells.length; i++) {
newRow.push(rowToCopy.cells[i].textContent);
}
// Insert a new row below
const tr = document.createElement('tr');
const th = document.createElement('th');
th.textContent = rowsPerPattern + 1;
tr.appendChild(th);
newRow.forEach(text => {
const td = document.createElement('td');
td.textContent = text;
td.contentEditable = true;
tr.appendChild(td);
});
patternTable.appendChild(tr);
alert('Row duplicated at bottom (simple implementation)');
}
break;
case 'delete':
// Delete note in currently selected cell
selectedCell.textContent = '';
break;
// Add more shortcuts here like loop set toggle
}
});
</script>
</body>
</html>
How to use:
- Click cells to select, type "X" to mark a note to play at that pattern/row/note column.
- Press Play to hear notes playing according to BPM and pattern rows.
- Use Ctrl+D to duplicate the selected row (simplified: adds a new row at end with same notes).
- Delete key empties current cell.
4. Next steps & improvements
- Add multiple instruments with individual synth configs.
- Implement pattern management (multiple patterns, chain).
- Implement noise generation (white noise node or buffer).
- Save/load songs to URL hash (
/#) JSON serialized and URL encoded.
- Add UI for ADSR, filter, detune, volume controls per instrument.
- Add loop toggling when playing patterns.
- Enhance keyboard shortcuts to select rows, patterns.
- Add UI for synth waveform customization (custom oscillator).
- Style improvements for clarity.
If you want, I can also help you build or find a more advanced full-featured open-source HTML tracker or discuss how to implement specific features like filter or custom waveforms.
Would you like me to provide:
- A minimal working chiptune tracker implementation in HTML/JS?
- A list of open source projects?
- Guidance on implementing specific features?
- Something else?