Demo Principale
CDN v3.0.0

Aggiungi questi tag alla tua pagina โ€” prima di </body> o in <head> :

Motore Synth
<script src="https://cdn.chiptune-synth.8binami.com/3.0.0/chiptune-synth.min.js"></script>
Sound Font (170+ instruments)
<script src="https://cdn.chiptune-synth.8binami.com/3.0.0/chiptune-sound-font.min.js"></script>

Per Iniziare

Impara ChiptuneSynth passo dopo passo โ€” clicca su "Esegui" per sentire ogni esempio dal vivo

1

Ciao, Chiptune!

Crea un sintetizzatore, inizializzalo e riproduci il tuo primo effetto sonoro โ€” tutto in 3 righe.

const synth = new ChiptuneSynth();
await synth.init();
synth.playPreset('coin');  // ding!
L'AudioContext richiede un gesto dell'utente (clic) per avviarsi โ€” per questo usiamo un pulsante.
2

Suonare una Nota per Nome

Suona il Do centrale per mezzo secondo sulla traccia Lead (traccia 0).

synth.playNoteByName('C', 4, 0, 0.5);
// note, octave, track, duration (seconds)
3

Suonare una Melodia

Programma piรน note con timing per creare una melodia semplice.

const melody = [
  { note:'C', oct:4, time:0 },
  { note:'E', oct:4, time:0.25 },
  { note:'G', oct:4, time:0.5 },
  { note:'C', oct:5, time:0.75 }
];
melody.forEach(n =>
  setTimeout(() =>
    synth.playNoteByName(n.note, n.oct, 0, 0.3),
    n.time * 1000
  )
);
4

Caricare uno Strumento

Passa dall'onda quadra predefinita a un violino, poi suona una nota.

synth.loadInstrument('violin', 0);
synth.playNoteByName('A', 4, 0, 1.5);
// Available: piano, violin, cello, flute, organ,
// brass, harmonica, synthLead, synthPad, synthBass,
// marimba, electricGuitar
5

Stratificazione Multi-Traccia

Suona strumenti diversi su tracce diverse allo stesso tempo.

synth.loadInstrument('synthPad', 0);  // Lead
synth.loadInstrument('synthBass', 1); // Bass

// Play a chord on the pad
synth.playNoteByName('C', 4, 0, 2);
synth.playNoteByName('E', 4, 0, 2);
synth.playNoteByName('G', 4, 0, 2);

// Bass note underneath
synth.playNoteByName('C', 2, 1, 2);
6

Regolare il Suono

Personalizza l'inviluppo, il vibrato e la forma d'onda per modellare il tuo suono.

// Slow attack pad
synth.updateEnvelope(0, {
  attack: 0.5, decay: 0.3,
  sustain: 0.6, release: 1.0
});

// Add vibrato
synth.updateVibrato(0, {
  rate: 5, depth: 8
});

// Change waveform to sawtooth
synth.updateTrack(0, { type: 'sawtooth' });

synth.playNoteByName('D', 4, 0, 2.5);
7

Combo SFX di Gioco

Concatena piรน effetti sonori per una sequenza di gioco โ€” raccogli monete, potenziati, spara!

synth.playPreset('coin');
setTimeout(() => synth.playPreset('powerup'), 400);
setTimeout(() => synth.playPreset('laser'), 1200);
setTimeout(() => synth.playPreset('explosion'), 1500);
setTimeout(() => synth.playPreset('1up'), 2200);
8

Visualizzazione Forma d'Onda

Disegna la forma d'onda audio live su un canvas โ€” ottimo per le UI di gioco!

function draw() {
  const data = synth.getWaveformData();
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  ctx.strokeStyle = '#00f0ff';
  ctx.beginPath();
  data.forEach((v, i) => {
    const x = (i / data.length) * canvas.width;
    const y = (v / 255) * canvas.height;
    i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y);
  });
  ctx.stroke();
  requestAnimationFrame(draw);
}
draw();