chiptune tracker adsr osc filter fm detune synth track share "/#" html
- User
chiptune tracker adsr osc filter fm detune synth track share "/#" html
- Assistant
chiptune tracker adsr osc filter fm detune synth track share "/#" html
It looks like you want to create or find a chiptune-style synthesizer or tracker implemented in HTML/JavaScript that features classic synth components like ADSR envelopes, oscillators, filters, FM synthesis, detune, and the ability to share or export tracks, possibly via URLs or some sharing method.
Here's a breakdown of what you're after and what can be done:
Before building from scratch, here are some tools you can use or reference:
jsfxr / sfxr – Classic chiptune sound effect generator in JS
https://alexanderjeurissen.github.io/jsfxr/
FamiTracker (Windows) – Popular NES tracker (not web-based, but inspiration)
BeepBox – Online chiptune tracker that supports sharing via URL
https://www.beepbox.co/
Tone.js – Powerful Web Audio API wrapper, supports oscillators, ADSR, filters, FM, detune
https://tonejs.github.io/
Here is a minimal example using Tone.js that demonstrates a simple synth with those components. You can build a tracker UI on top of this foundation.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Chiptune Synth Demo</title>
<style>
body { font-family: sans-serif; padding: 1em; max-width: 400px; }
label { display: block; margin: 0.5em 0 0.2em 0; }
input[type=range] { width: 100%; }
button { margin-top: 1em; }
</style>
</head>
<body>
<h1>Chiptune Synth Demo</h1>
<label>Frequency: <span id="freqDisplay">440</span> Hz</label>
<input type="range" id="freq" min="100" max="1000" value="440" />
<label>ADSR Attack: <span id="attackDisplay">0.1</span>s</label>
<input type="range" id="attack" min="0" max="1" step="0.01" value="0.1" />
<label>ADSR Decay: <span id="decayDisplay">0.1</span>s</label>
<input type="range" id="decay" min="0" max="1" step="0.01" value="0.1" />
<label>ADSR Sustain: <span id="sustainDisplay">0.5</span></label>
<input type="range" id="sustain" min="0" max="1" step="0.01" value="0.5" />
<label>ADSR Release: <span id="releaseDisplay">0.2</span>s</label>
<input type="range" id="release" min="0" max="2" step="0.01" value="0.2" />
<label>Filter Frequency: <span id="filterFreqDisplay">1000</span> Hz</label>
<input type="range" id="filterFreq" min="100" max="5000" value="1000" />
<label>Detune: <span id="detuneDisplay">0</span> cents</label>
<input type="range" id="detune" min="-50" max="50" value="0" />
<label>FM Modulation Index: <span id="fmIndexDisplay">0</span></label>
<input type="range" id="fmIndex" min="0" max="1000" value="0" />
<button id="playBtn">Play Note</button>
<script src="https://unpkg.com/tone@14.7.77/build/Tone.js"></script>
<script>
const freqInput = document.getElementById('freq');
const freqDisplay = document.getElementById('freqDisplay');
const attackInput = document.getElementById('attack');
const decayInput = document.getElementById('decay');
const sustainInput = document.getElementById('sustain');
const releaseInput = document.getElementById('release');
const attackDisplay = document.getElementById('attackDisplay');
const decayDisplay = document.getElementById('decayDisplay');
const sustainDisplay = document.getElementById('sustainDisplay');
const releaseDisplay = document.getElementById('releaseDisplay');
const filterFreqInput = document.getElementById('filterFreq');
const filterFreqDisplay = document.getElementById('filterFreqDisplay');
const detuneInput = document.getElementById('detune');
const detuneDisplay = document.getElementById('detuneDisplay');
const fmIndexInput = document.getElementById('fmIndex');
const fmIndexDisplay = document.getElementById('fmIndexDisplay');
freqInput.oninput = () => freqDisplay.textContent = freqInput.value;
attackInput.oninput = () => attackDisplay.textContent = attackInput.value;
decayInput.oninput = () => decayDisplay.textContent = decayInput.value;
sustainInput.oninput = () => sustainDisplay.textContent = sustainInput.value;
releaseInput.oninput = () => releaseDisplay.textContent = releaseInput.value;
filterFreqInput.oninput = () => filterFreqDisplay.textContent = filterFreqInput.value;
detuneInput.oninput = () => detuneDisplay.textContent = detuneInput.value;
fmIndexInput.oninput = () => fmIndexDisplay.textContent = fmIndexInput.value;
// Create a carrier oscillator with square wave (classic chiptune)
const carrier = new Tone.Oscillator({
type: 'square',
frequency: 440,
detune: 0
});
// FM oscillator modulating frequency of carrier
// Simple approach using frequency modulation synthesis
const modulator = new Tone.Oscillator({
type: 'square',
frequency: 220
});
// Scale modulator output to modulation index (depth)
const modGain = new Tone.Gain(0);
modulator.connect(modGain);
modGain.connect(carrier.frequency);
// ADSR envelope for amplitude
const ampEnvelope = new Tone.AmplitudeEnvelope({
attack: 0.1,
decay: 0.1,
sustain: 0.5,
release: 0.2
});
// Filter
const filter = new Tone.Filter({
type: 'lowpass',
frequency: 1000,
Q: 1
});
carrier.connect(ampEnvelope);
ampEnvelope.connect(filter);
filter.toDestination();
modulator.start();
carrier.start();
document.getElementById('playBtn').onclick = async () => {
// Start audio context if not started
await Tone.start();
carrier.frequency.value = +freqInput.value;
carrier.detune.value = +detuneInput.value;
ampEnvelope.attack = +attackInput.value;
ampEnvelope.decay = +decayInput.value;
ampEnvelope.sustain = +sustainInput.value;
ampEnvelope.release = +releaseInput.value;
filter.frequency.value = +filterFreqInput.value;
// Modulator frequency fixed to half carrier frequency (simple)
modulator.frequency.value = carrier.frequency.value / 2;
modGain.gain.value = +fmIndexInput.value;
ampEnvelope.triggerAttack();
// Auto release after 1 second for demo
setTimeout(() => {
ampEnvelope.triggerRelease();
}, 1000);
};
</script>
</body>
</html>
You can extend this by adding a step sequencer or tracker UI (like rows and columns where you can enter notes and effects). For sharing tracks, you could serialize your track data or parameter settings as JSON and encode it into a URL hash string, then read it back on load.
If you'd like, I can help you build the tracker UI or implement sharing/export features next! Just ask.
Not yet included in a published release.