Skip to content

Quick start

Prerequisites

  • SynthEngine or SynthEnginePro
  • GameMaker
    • IDE: 2024.6.2.162+
    • Runtime: 2024.6.0.205+
  • A basic understanding of synthesizers/digital audio is helpful

WARNING

Older GameMaker versions may work but are untested

Installation

Adding SynthEngine to your project is similar to adding any other local *.yymps package. Drag the file into your IDE, click "Add All", then "Import". This will add two folders to your project, "SynthEngine" and "SynthEngineDemo". You can delete the "SynthEngineDemo" folder if you don't plan on running the demo room.

Adding SynthEnginePro to your project is the same process as above. It will add an additional "SynthEninePro" folder, and a "SynthEngineProDemo" folder. As before, the demo folder is optional. If you purchased SynthEnginePro, you do not need to download SynthEngine separately.

INFO

SynthEngine comes with a obj_synth_engine object, but you do not need to add this object to any room in your game! That will happen automatically.

Your first synthesizer

The most basic example of a synthesizer looks like this:

gml
// Create the synthesizer
synth = synth_create();

// Add a sine wave oscillator
synth_add_osc(synth, synth_waveform_sine);

note_length = 1; // 1 second
note_frequency = 440; // A4 on the keyboard

// Render audio synchronously
var _synth_a4 = synth_render_audio(synth, note_length, note_frequency);

// Play the sound
audio_play_sound(_synth_a4.sound, 1, false);

This will render the audio to a sound and then play it back immediately. Rendering audio can take a while and may cause a stutter in your framerate, so it's best used for things like sound effects, or anything that you intend on playing multiple times.

Instead of rendering audio, you can trigger notes to play live like so:

gml
// This will play a note in real time when we press and hold the spacebar
if (keyboard_check_pressed(vk_space)) {
  note_index = synth_note_on(synth, note_frequency);
} else if (keyboard_check_released(vk_space)) {
  synth_note_off(synth, note_index);
}

Compatible exports

SynthEngine has been tested with the Windows and macOS exports, but should work with any export that supports creating audio buffers and audio queues. HTML5 support for audio buffers and queues is not consistent, and so compatibility with HTML5 is not guaranteed.