It sounds like you want to create or get a simple HTML-based chiptune tracker with these specific features:
Piano roll or keyboard input
BPM control
Rows per track
Patterns and rows per pattern
Multiple tracks/instruments with synths
Custom oscillator per instrument
Volume, detune, ADSR envelope, filter, noise controls
Ability to share/export songs (e.g. URL hash /#)
Keyboard shortcuts
Loop function
Lightweight, no demo song on load
I can help you with a simple prototype or guide you to existing solutions or libraries that support these features.
Option 1: Use/Extend Existing Open Source Chiptune Tracker in JS
There are a few open source HTML/JS trackers that are quite close to what you want:
FamiTracker in Web / derived projects
SunVox Web (heavy, but powerful)
BeepBox (https://www.beepbox.co/ ) - online chiptune tracker
jsfxr / pcg-player
BeepBox is very close to your needs:
Pattern-based tracker
Multiple instruments with synths + custom oscillators
Adjustable parameters: volume, detune, ADSR, filter, noise
BPM and rows per pattern control
Export/share via URL
Keyboard shortcuts
Loop playback
It also has a minimal UI, no demo that auto plays (you can start with empty)
You can fork or embed parts from BeepBox open source at https://github.com/juhana/beepbox
Option 2: Build a Minimal HTML Chiptune Tracker Prototype
If you want a minimal working example from scratch that covers most:
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Chiptune Tracker</title>
<style>
body { font-family: monospace; background: #222; color: #eee; }
#tracker { display: flex; flex-direction: column; max-width: 600px; margin: 0 auto; }
.row { display: flex; }
.cell { border: 1px solid #555; width: 25px; height: 25px; text-align: center; line-height: 25px; cursor: pointer; }
.cell.active { background: #0f0; }
</style>
</head>
<body>
<h1>Chiptune Tracker</h1>
<label>BPM: <input type="number" id="bpm" value="120" min="30" max="300" /></label>
<label>Rows per Pattern: <input type="number" id="rowsPerPattern" value="16" min="4" max="64" /></label>
<div id="tracker"></div>
<button id="playBtn">Play</button>
<button id="stopBtn">Stop</button>
<button id="shareBtn">Share URL</button>
<script>
// Basic setup
const rowsPerPatternInput = document.getElementById('rowsPerPattern');
const bpmInput = document.getElementById('bpm');
const trackerDiv = document.getElementById('tracker');
const playBtn = document.getElementById('playBtn');
const stopBtn = document.getElementById('stopBtn');
const shareBtn = document.getElementById('shareBtn');
let rowsPerPattern = +rowsPerPatternInput.value;
let bpm = +bpmInput.value;
const notes = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
const octave = 4;
// Single instrument with simple square oscillator for simplicity
let song = new Array(rowsPerPattern).fill(null); // Each row is a note or null
function createTracker() {
trackerDiv.innerHTML = '';
for(let i=0; i<rowsPerPattern; i++) {
const rowDiv = document.createElement('div');
rowDiv.classList.add('row');
const cell = document.createElement('div');
cell.classList.add('cell');
cell.textContent = song[i] || '-';
cell.dataset.row = i;
cell.addEventListener('click', () => {
// Cycle through notes
let currentNote = song[i];
let nextIndex = 0;
if(currentNote) {
let idx = notes.indexOf(currentNote);
nextIndex = (idx + 1) % notes.length;
}
song[i] = notes[nextIndex];
cell.textContent = song[i];
cell.classList.toggle('active', !!song[i]);
});
rowDiv.appendChild(cell);
trackerDiv.appendChild(rowDiv);
}
}
// Audio context and play logic
const AudioContext = window.AudioContext || window.webkitAudioContext;
const audioCtx = new AudioContext();
function playNote(note, duration=0.3) {
if(!note) return;
let freq = 440 * Math.pow(2, (notes.indexOf(note) + (octave - 4) * 12 - 9) / 12); // A4=440 tuned
const osc = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
osc.type = 'square';
osc.frequency.setValueAtTime(freq, audioCtx.currentTime);
gainNode.gain.setValueAtTime(0.2, audioCtx.currentTime);
osc.connect(gainNode).connect(audioCtx.destination);
osc.start();
osc.stop(audioCtx.currentTime + duration);
}
let playing = false;
let currentRow = 0;
let timer;
function step() {
if (!playing) return;
playNote(song[currentRow]);
highlightRow(currentRow);
currentRow = (currentRow + 1) % rowsPerPattern;
let interval = (60 / bpm);
timer = setTimeout(step, interval * 1000);
}
function highlightRow(row) {
const cells = trackerDiv.querySelectorAll('.cell');
cells.forEach(c => c.style.background = '');
if(cells[row]) cells[row].style.background = '#444';
}
playBtn.addEventListener('click', () => {
if(audioCtx.state === 'suspended') {
audioCtx.resume();
}
if(!playing) {
playing = true;
step();
}
});
stopBtn.addEventListener('click', () => {
playing = false;
clearTimeout(timer);
highlightRow(-1);
currentRow = 0;
});
bpmInput.addEventListener('change', () => {
bpm = +bpmInput.value;
});
rowsPerPatternInput.addEventListener('change', () => {
rowsPerPattern = +rowsPerPatternInput.value;
song = new Array(rowsPerPattern).fill(null);
createTracker();
});
shareBtn.addEventListener('click', () => {
// Save song in URL hash simple encoding, e.g. notes as letters separated by commas
const songStr = song.map(n => n || '-').join(',');
const url = location.origin + location.pathname + '#song=' + encodeURIComponent(songStr) + '&bpm=' + bpm + '&rows=' + rowsPerPattern;
prompt('Shareable URL:', url);
});
// Load from URL
function loadFromURL() {
let hash = location.hash.substring(1);
if(!hash) return;
let params = new URLSearchParams(hash);
if(params.has('song')) {
let s = decodeURIComponent(params.get('song'));
let arr = s.split(',');
rowsPerPattern = +params.get('rows') || arr.length;
bpm = +params.get('bpm') || 120;
bpmInput.value = bpm;
rowsPerPatternInput.value = rowsPerPattern;
song = arr.map(x => (notes.includes(x) ? x : null));
createTracker();
}
}
createTracker();
loadFromURL();
</script>
</body>
</html>
How this simple tracker matches your list:
Piano / notes: Click rows to cycle the note (you can extend to add piano keyboard input)
BPM: Adjustable by input
Rows per pattern: Adjustable by input, recreates the grid
Patterns: Only 1 pattern in this simple example (extend needed)
Synth per instrument: Only one instrument with square oscillator
Custom osc: Hardcoded square, extendable in code
Volume/detune/ADSR/filter/noise: Not implemented (would require more UI + WebAudio settings)
Share song: via URL hash `/#
Keyboard shortcuts: Not yet implemented
Loop: Pattern loops automatically
No demo: Initially empty grid
Possible extensions
Add multiple instruments / tracks
Add pattern list, multiple patterns
Add real piano keyboard input to insert notes via keys
Add ADSR and filters with WebAudio param nodes
Add noise oscillator
Add keyboard shortcuts to start/stop, add notes, switch instruments etc.
If you want, I can help build those extensions or integrate something more powerful! Let me know.