Instrumentos
Oscilador
50%
30%
0 oct
0
0
0 ms
Envelope ADSR
10 ms
100 ms
70%
200 ms
Filtro
20 kHz
0,1
0%
10 ms
200 ms
Uníssono
1
0 oct
0%
LFOs
0 Hz
0 oct
0 ms

0 Hz
0
0 ms

0 Hz
0%
0 ms
50%
Criado com ChiptuneSynth
Descubra o 8BitForge
Teclado MIDI desativado
4
Tom
0
Mod
0
AZERTY: QZSEDFTGYHUJKOLPM · W/X oct · 1/2 pitch bend
Forma de onda
Exemplos de script — clique em Reproduzir para ouvir
1. Reproduza uma única nota
const synth = new ChiptuneSynth();
await synth.init();

// Play A4 (440Hz) on lead track, 0.5s
synth.playNote(440, 0, 0.5);
2. Reproduzir um acorde (C maior)
// C major chord across 3 tracks
synth.playNoteByName('C', 4, 0, 1.0);  // Root (Lead)
synth.playNoteByName('E', 4, 1, 1.0);  // Third (Bass)
synth.playNoteByName('G', 4, 3, 1.0);  // Fifth (FX)
3. Arpejo rápido
// Configure FX track: short attack, fast decay
synth.tracks[3].type = 'sawtooth';
synth.envelopes[3] = { attack: 0.001, decay: 0.08, sustain: 0.3, release: 0.1 };

const notes = ['C','E','G','B','C','B','G','E'];
const octs  = [4,4,4,4,5,4,4,4];
notes.forEach((n, i) => {
    setTimeout(() => synth.playNoteByName(n, octs[i], 3, 0.12), i * 100);
});
4. Onda dente de serra + varredura de filtro
// Sawtooth with filter envelope sweep
synth.tracks[0].type = 'sawtooth';
synth.tracks[0].volume = 0.35;
synth.tracks[0].filterEnabled = true;
synth.tracks[0].filterType = 'lowpass';
synth.tracks[0].filterCutoff = 800;
synth.tracks[0].filterQ = 8;
synth.tracks[0].filterEnvAmount = 48;
synth.tracks[0].filterEnvAttack = 0.3;
synth.tracks[0].filterEnvRelease = 0.8;

synth.playNoteByName('C', 3, 0, 2.0);
5. Pad uníssono denso
// 8-voice unison with vibrato + stereo spread
synth.tracks[0].type = 'square';
synth.tracks[0].dutyCycle = 0.25;
synth.tracks[0].unisonVoices = 8;
synth.tracks[0].unisonDetune = 20;
synth.tracks[0].unisonSpread = 70;
synth.envelopes[0] = { attack: 0.3, decay: 0.5, sustain: 0.8, release: 1.0 };
synth.vibrato[0] = { rate: 4, depth: 8 };

synth.playNoteByName('E', 4, 0, 2.5);
6. Loop de bateria (bombo + chimbal)
const BPM = 130, beat = 60 / BPM;

// Kick: Drums track (sine + pitchEnv)
synth.tracks[2].type = 'sine';
synth.tracks[2].pitchEnv = 36;
synth.envelopes[2] = { attack: 0.001, decay: 0.25, sustain: 0, release: 0.02 };

for (let bar = 0; bar < 2; bar++) {
  const t = bar * 4 * beat;
  for (let b = 0; b < 4; b++)
    setTimeout(() => synth.playNote(55, 2, 0.3), (t+b*beat)*1000);
  for (let i = 0; i < 8; i++)
    setTimeout(() => synth.playNote(440, 3, 0.05), (t+i*beat/2)*1000);
}
7. Melodia completa em 8 bits (melódia + baixo + bateria)
const BPM = 140, beat = 60/BPM;
const n = (name, oct, trk, t, dur) => {
  const f = ChiptuneSynth.noteToFrequency(name, oct);
  setTimeout(() => synth.playNote(f, trk, dur), t*1000);
};

// Lead (square, track 0)
synth.tracks[0].type = 'square';
n('E',5,0,0,beat*.4); n('E',5,0,beat*.5,beat*.4);
n('E',5,0,beat*1.5,beat*.4); n('C',5,0,beat*2,beat*.4);
n('E',5,0,beat*2.5,beat*.8); n('G',5,0,beat*3.5,beat);
n('G',4,0,beat*4,beat*.8);
n('C',5,0,beat*5.5,beat*.4); n('E',5,0,beat*6,beat*.4);

// Bass (triangle, track 1)
n('C',3,1,0,beat*.8); n('G',2,1,beat*2,beat*.8);
n('C',3,1,beat*3,beat*.8);
n('E',3,1,beat*4,beat*.8); n('C',3,1,beat*5.5,beat*.8);

// Hi-hat (noise, track 2)
for (let i = 0; i < 16; i++)
  setTimeout(() => synth.playNote(440,2,0.05), i*beat/2*1000);
# npm
npm install @8bitforge/chiptune-synth
<!-- CDN -->
<script src="https://unpkg.com/@8bitforge/chiptune-synth"></script>
ChiptuneSynth por 8Binami · Licença dupla (Gratuito para uso não comercial / Comercial)