Sointu
Fork of 4klang that can target 386, amd64 and WebAssembly. Tools run on Windows, Mac & Linux
Install / Use
/learn @vsariola/SointuREADME
Sointu
A cross-architecture and cross-platform modular software synthesizer for small intros, forked from 4klang. Targetable architectures include 386, amd64, and WebAssembly; targetable platforms include Windows, Mac, Linux (and related) + browser.
- User manual is in the Wiki
- Discussions is for asking help, sharing patches/instruments and brainstorming ideas
- Issues is for reporting bugs
Installation
You can either:
- Download the latest build from the master branch from the actions. Find workflow "Binaries" and scroll down for .zip files containing the artifacts. Note: You have to be logged into Github to download artifacts!
or
- Download one of the tagged releases.
In both cases, you can then just run one of the executables (no need to install anything); or in the case of the VST plugins library files, copy them wherever you keep you VST2 plugins.
The pre 1.0 version release tags are mostly for reference: no backwards compatibility will be guaranteed while upgrading to a newer version. Backwards compatibility will be attempted from 1.0 onwards.
Uninstallation: Sointu stores configuration and recovery data files in
OS-specific folders e.g. AppData/Roaming/Sointu on Windows. For clean
uninstall, delete also this folder. See
here where to find those folders on other
platforms.
Summary
Sointu is work-in-progress. It is a fork and an evolution of 4klang, a modular software synthesizer intended to easily produce music for 4k intros — small executables with a maximum filesize of 4096 bytes containing realtime audio and visuals. Like 4klang, the sound is produced by a virtual machine that executes small bytecode to produce the audio; however, by now the internal virtual machine has been heavily rewritten and extended. It is actually extended so much that you will never fit all the features at the same time in a 4k intro, but a fairly capable synthesis engine can already be fitted in 600 bytes (386, compressed), with another few hundred bytes for the patch and pattern data.
Sointu consists of two core elements:
- A cross-platform synth-tracker that runs as either VSTi or stand-alone app for composing music, written in go. The app is still heavily work in progress. The app exports the projects as .yml files.
- A compiler, likewise written in go, which can be invoked from the command line to compile these .yml files into .asm or .wat code. For x86/amd64, the resulting .asm can be then compiled by nasm. For browsers, the resulting .wat can be compiled by wat2wasm.
This is how the current prototype app looks like:

Building
Various aspects of the project have different tool dependencies, which are listed below.
Sointu-track
This is the stand-alone version of the synth-tracker. Sointu-track uses the gioui for the GUI and oto for the audio, so the portability is currently limited by these.
Prerequisites
- go
- If you want to also use the x86 assembly written synthesizer, to test that the
patch also works once compiled:
- Follow the instructions to build the x86 native virtual machine before building the tracker.
- cgo compatible compiler e.g. gcc. On windows, you
best bet is MinGW. The compiler can be in PATH or
you can use the environment variable
CCto help go find the compiler. - Setting environment variable
CGO_ENABLED=1is a good idea, because if it is not set and go fails to find the compiler, go just excludes all files withimport "C"from the build, resulting in lots of errors about missing types.
Running
go run cmd/sointu-track/main.go
Building an executable
go build -o sointu-track.exe cmd/sointu-track/main.go
On other platforms than Windows, replace -o sointu-track.exe with
-o sointu-track.
If you want to include the x86 native virtual machine,
add -tags=native to all the commands e.g.
go build -o sointu-track.exe -tags=native cmd/sointu-track/main.go
Sointu-vsti
This is the VST instrument plugin version of the tracker, compiled into a dynamically linked library and ran inside a VST host.
Prerequisites
- go
- cgo compatible compiler e.g. gcc. On windows, you best
bet is MinGW. The compiler can be in PATH or you can
use the environment variable
CCto help go find the compiler. - Setting environment variable
CGO_ENABLED=1is a good idea, because if it is not set and go fails to find the compiler, go just excludes all files withimport "C"from the build, resulting in lots of errors about missing types. - If you want to build the VSTI with the native x86 assembly written synthesizer:
- Follow the instructions to build the x86 native virtual machine before building the plugin itself
Building
go build -buildmode=c-shared -tags=plugin -o sointu-vsti.dll .\cmd\sointu-vsti\
On other platforms than Windows, replace -o sointu-vsti.dll appropriately e.g.
-o sointu-vsti.so; so far, the VST instrument has been built & tested on
Windows and Linux.
Notice the -tags=plugin build tag definition. This is required by the vst2
library; otherwise, you will get a lot of
build errors.
Add -tags=native,plugin to use the x86 native virtual
machine instead of the virtual machine written in Go.
Sointu-compile
The command line interface to it is sointu-compile and the actual code resides in the compiler package, which is an ordinary go package with no other tool dependencies.
Running
go run cmd/sointu-compile/main.go
Building an executable
go build -o sointu-compile.exe cmd/sointu-compile/main.go
On other platforms than Windows, replace -o sointu-compile.exe with
-o sointu-compile.
Usage
The compiler can then be used to compile a .yml song into .asm and .h files. For example:
sointu-compile -arch=386 tests/test_chords.yml
nasm -f win32 test_chords.asm
WebAssembly example:
sointu-compile -arch=wasm tests/test_chords.yml
wat2wasm test_chords.wat
If you are looking for an easy way to compile an executable from a Sointu song (e.g. for a executable music compo), take a look at NR4's Python-based tool for it.
Examples
The folder examples/code contains usage examples for Sointu with winmm and
dsound playback under Windows and asound playback under Unix. Source code is
available in C and x86 assembly (win32, elf32 and elf64 versions).
To build the examples, use ninja examples.
If you want to target smaller executable sizes, using a compressing linker like Crinkler on Windows is recommended.
The linux examples use ALSA and need libasound2-dev (or libasound2-dev:386) installed. The 386 version also needs pipewire-alsa:386 installed, which is not there by default.
Native virtual machine
The native bridge allows Go to call the Sointu compiled x86 native virtual machine, through cgo, instead of using the Go written bytecode interpreter. With the latest Go compiler, the native virtual machine is actually slower than the Go-written one, but importantly, the native virtual machine allows you to test that the patch also works within the stack limits of the x87 virtual machine, which is the VM used in the compiled intros. In the tracker/VSTi, you can switch between the native synth and the Go synth under the CPU panel in the Song settings.
Before you can actually run it, you need to build the bridge using CMake (thus, this will not work with go get).
Prerequisites
The last point is because the command line player and the tracker use cgo to interface with the synth core, which is compiled into a library. The cgo bridge resides in the package bridge.
Building
Assuming you are using ninja:
mkdir build
cd build
cmake .. -GNinja
ninja sointu
:warning: you must build the library inside a directory called 'build' at the root of the project. This is because the path where cgo looks for the library is hard coded to point to build/ in the go files.
Running ninja sointu only builds the static library that Go needs. This is a
lot faster than building all the CTests.
You and now run all the Go tests, even the ones that test the native bridge. From the project root folder, run:
go test ./...
Play a song from the command line:
go run -tags=native cmd/sointu-play/main.go tests/test_chords.yml
:warning: Unlike the x86/amd64 VM compiled by Sointu, the Go written VM bytecode interpreter uses a software sta
