chiptune sequencer editor adsr osc filter fm detune synth track share "/#" html
- User
chiptune sequencer editor adsr osc filter fm detune synth track share "/#" html
- Assistant
chiptune sequencer editor adsr osc filter fm detune synth track share "/#" html
It sounds like you want to create or find a chiptune-style synthesizer/sequencer/editor implemented in HTML/JavaScript with features like:
You want a web-based chiptune synthesizer and sequencer/editor that supports:
/# style fragment identifier)Before creating one from scratch, here are some existing projects or libraries you might check out or fork:
BeepBox is a very close fit and open source — you can fork and customize.
If you want a minimal demo or starting point:
Use Web Audio API to create oscillators:
const audioCtx = new AudioContext();
function createOscillator(type='square', frequency=440){
const osc = audioCtx.createOscillator();
osc.type = type;
osc.frequency.setValueAtTime(frequency, audioCtx.currentTime);
return osc;
}
Using GainNode and scheduled gain automation:
function applyADSR(gainNode, attack, decay, sustain, release, startTime) {
const now = startTime || audioCtx.currentTime;
gainNode.gain.cancelScheduledValues(now);
gainNode.gain.setValueAtTime(0, now);
gainNode.gain.linearRampToValueAtTime(1, now + attack);
gainNode.gain.linearRampToValueAtTime(sustain, now + attack + decay);
// Release phase should be scheduled when note ends
}
function releaseADSR(gainNode, release, releaseStart) {
const now = releaseStart || audioCtx.currentTime;
gainNode.gain.cancelScheduledValues(now);
gainNode.gain.setValueAtTime(gainNode.gain.value, now);
gainNode.gain.linearRampToValueAtTime(0, now + release);
}
Add BiquadFilterNode:
const filter = audioCtx.createBiquadFilter();
filter.type = 'lowpass';
filter.frequency.setValueAtTime(1000, audioCtx.currentTime);
Modulate oscillator frequency with another oscillator:
const modOsc = audioCtx.createOscillator();
modOsc.frequency.setValueAtTime(100, audioCtx.currentTime);
const modGain = audioCtx.createGain();
modGain.gain.setValueAtTime(50, audioCtx.currentTime); // modulation depth
modOsc.connect(modGain);
modGain.connect(osc.frequency);
Oscillator supports detune in cents:
osc.detune.setValueAtTime(10, audioCtx.currentTime); // detune oscillator by 10 cents
Build a basic step sequencer with HTML buttons or grid. On each step schedule notes accordingly.
Serialize the track settings and patterns into a JSON, then encode in Base64 or URI component, append to URL fragment:
const state = {
adsr: {...},
sequence: [...],
osc: {...},
filter: {...},
};
const encoded = encodeURIComponent(JSON.stringify(state));
const shareURL = `${location.origin}${location.pathname}#/` + encoded;
On load, parse the URL and initialize the UI/synth state.
Here's a simple example skeleton to get started:
https://codesandbox.io/s/chiptune-adrs-fm-synth-sequencer-xyz123 (note: example only, not a real link)
If you want I can help you build a specific example or UI for this. Just ask!
Not yet included in a published release.