TG101 is a software simulation of the Yamaha TG100 General MIDI sound module from 1991. It is not a full-fledged audio plugin or application, but rather an "engine", that you can use to build your own audio plugin or application. The Martinic TG100 virtual instrument plugin uses the TG101 engine.
The TG101 engine requires ROM dumps of the original TG100 firmware and wave ROM, which are not included in this project.
To use the TG101 engine add the TG101 and WDL
source files (*.cpp and *.h) to your C++ project. Then include
Engine.h in your source code, and create an instance of the
TG101::Engine, i.e.:
#include "TG101/Engine.h"
// Instantiate synth engine.
TG101::Engine engine;
// Load meta data tables from firmware.
engine.LoadFirmware("tg100prog.bin");
// Load sample data from wave ROM.
engine.LoadWaveTbl("tg100smpl.bin");
// Resample wave data.
engine.SetSampleRate(44100.0);
// Reset wave generators.
engine.Reset();
// Stereo output buffer that can hold 2 seconds at 44.1 kHz.
static const int L = 0, R = 1, len = 2 * 44100;
float buf[2][len];
// Generate audio (silence) for 0.2 seconds.
int idx = 0;
engine.ProcessAudio(&buf[L][idx], &buf[R][idx], 8820);
// After 0.2 seconds play note.
idx += 8820;
const int note = 60;
engine.NoteOn(0, note, 127);
// Generate audio for 1 second.
engine.ProcessAudio(&buf[L][idx], &buf[R][idx], 44100);
// After 1 second release note.
idx += 44100;
engine.NoteOff(0, note);
// Generate audio for remaining 0.8 s.
engine.ProcessAudio(&buf[L][idx], &buf[R][idx], len - idx);This example assumes the TG101 source files are stored in TG101/, and the
WDL source files in WDL/.
In a real-world plugin or application you would receive MIDI data from a
MIDI device, pass it to engine.ProcessMidiMsg(), call
engine.ProcessAudio() to generate audio in between MIDI messages, and send
this audio to an audio output device, all from within a continuous loop.
This project requires some source files from the WDL "Tale" Edition library, which you can download from:
You will need the following files:
WDL/denormal.h
WDL/heapbuf.h
WDL/mutex.h
WDL/ptrlist.h
WDL/resample.cpp
WDL/resample.h
WDL/sha.cpp
WDL/sha.h
WDL/wdlatomic.h
WDL/wdlendian.h
WDL/wdltypes.h
Copyright © 2022-2026 Theo Niessink <theo@taletn.com>
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.