It looks like you want to create (or use) a HTML-based chiptune tracker with support for:
- Setting BPM
- Defining patterns and rows per pattern
- Multiple instruments with synths and custom oscillators
- Volume, detune, ADSR envelopes, filters, noise controls per instrument
- Ability to share songs possibly via URL hashes (like "/#")
- Keyboard shortcuts and looping support
- Also no demo (possibly you want a tool/library without preloaded demo songs)
What you may want / possible approaches:
1. Use existing open-source HTML5 chiptune trackers
2. Build your own minimal chiptune tracker
If you want a minimal, customizable chiptune tracker embedded in HTML/JS:
- Use the Web Audio API to create oscillators + ADSR envelopes + filters
- Create a grid-based UI for patterns and their rows
- Save/share song state by serializing the patterns & instruments into the URL hash (
/#)
- Add keyboard shortcuts with JS event handlers
- Implement loop playback with JS timers & requestAnimationFrame
See example skeleton:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mini Chiptune Tracker</title>
<style>
/* Add CSS for grid, controls, etc */
</style>
</head>
<body>
<h1>Mini Chiptune Tracker</h1>
<div>
<label>BPM: <input type="number" id="bpm" value="120" min="30" max="300"/></label>
</div>
<div id="patterns"></div>
<!-- Controls for synth params -->
<div>
<label>Oscillator:
<select id="oscType">
<option>square</option>
<option>sine</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.5"/></label>
<label>Detune: <input type="range" id="detune" min="-50" max="50" step="1" value="0"/></label>
<!-- ADSR -->
<label>Attack: <input type="range" id="attack" min="0" max="1" step="0.01" value="0.1"/></label>
<label>Decay: <input type="range" id="decay" min="0" max="1" step="0.01" value="0.1"/></label>
<label>Sustain: <input type="range" id="sustain" min="0" max="1" step="0.01" value="0.7"/></label>
<label>Release: <input type="range" id="release" min="0" max="1" step="0.01" value="0.2"/></label>
<!-- Filter cutoff -->
<label>Filter cutoff: <input type="range" id="filterCutoff" min="0" max="10000" step="10" value="10000"/></label>
<label>Noise: <input type="checkbox" id="noise"/></label>
</div>
<!-- Playback controls -->
<button id="play">Play</button>
<button id="stop">Stop</button>
<script>
// Basic design outline:
class Instrument {
constructor() {
this.oscType = 'square';
this.volume = 0.5;
this.detune = 0;
this.attack = 0.1;
this.decay = 0.1;
this.sustain = 0.7;
this.release = 0.2;
this.filterCutoff = 10000;
this.noise = false;
}
}
class Pattern {
constructor(rows = 16) {
this.rows = [];
for (let i = 0; i < rows; i++) {
this.rows.push({ note: null, instrument: 0 });
}
}
}
// More code to generate and play notes using WebAudio API,
// UI code to enter notes, pattern navigation, save state to URL etc.
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
function playNote(freq, instrument, duration) {
// create oscillator, gain node, filter etc using instrument params
let osc;
let envGain = audioCtx.createGain();
envGain.gain.value = 0;
envGain.connect(audioCtx.destination);
if (instrument.noise) {
// Implement noise source
let bufferSize = audioCtx.sampleRate;
let noiseBuffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
let output = noiseBuffer.getChannelData(0);
for (let i = 0; i < bufferSize; i++) output[i] = Math.random() * 2 - 1;
let whiteNoise = audioCtx.createBufferSource();
whiteNoise.buffer = noiseBuffer;
whiteNoise.loop = true;
whiteNoise.connect(envGain);
whiteNoise.start();
setTimeout(() => whiteNoise.stop(), duration * 1000);
} else {
osc = audioCtx.createOscillator();
osc.type = instrument.oscType;
osc.frequency.value = freq;
osc.detune.value = instrument.detune;
let filter = audioCtx.createBiquadFilter();
filter.type = 'lowpass';
filter.frequency.value = instrument.filterCutoff;
osc.connect(filter);
filter.connect(envGain);
osc.start();
// ADSR envelope
let now = audioCtx.currentTime;
envGain.gain.cancelScheduledValues(now);
envGain.gain.setValueAtTime(0, now);
envGain.gain.linearRampToValueAtTime(instrument.volume, now + instrument.attack);
envGain.gain.linearRampToValueAtTime(instrument.sustain * instrument.volume, now + instrument.attack + instrument.decay);
setTimeout(() => {
let t = audioCtx.currentTime;
envGain.gain.cancelScheduledValues(t);
envGain.gain.setValueAtTime(envGain.gain.value, t);
envGain.gain.linearRampToValueAtTime(0, t + instrument.release);
osc.stop(t + instrument.release);
}, duration * 1000);
}
}
// Hook UI events for play, stop, bpm, etc.
</script>
</body>
</html>
Alternatives / libraries that might fit
- tone.js — Powerful Web Audio framework, can build custom chiptune synths
- notochord — minimal tracker style app, but check if fits your feature set
- jsfxr — chiptune sound effect generator, but limited composition capability
Summary
- If you want a ready-to-use tracker with sharing via URL hash, try BeepBox
- If you want a no-demo, custom tracker, build minimal with Web Audio API
- Control BPM, patterns, synth parameters with JS and standard inputs
- Use URL hashes for sharing song data serialized as JSON or custom string
- Add keyboard shortcuts for playback and navigation with JS
keydown listeners
- Implement looping by scheduling pattern playback with timers
If you want, I can help you write a minimal chiptune tracker proof-of-concept fully coded in HTML/JS. Let me know!