MidiPlayer is a cross-platform application for exploring sound synthesis and designing custom instruments from scratch, controllable via any MIDI device. It also supports SoundFount files for working with more complex and realistic sounds.
demo.mp4
Note
Precompiled binaries are available in the Releases section.
To build the project from sources, first clone the repository with its dependencies, then use CMake and a C++ compiler to compile it.
git clone --recurse-submodules [email protected]:B-Bischoff/MidiPlayer.git
cd MidiPlayer
./start.sh
The start.sh
script will run CMake to configure the build and then compile the project.
If you prefer to build manually without the script, run:
cmake -S . -B build
make -C build -j $(nproc)
The following apt packages are required to build this project: xorg-dev libglu1-mesa-dev libasound2-dev libglib2.0-dev cmake build-essential
xorg-dev libglu1-mesa-dev libasound2-dev
: Required libraries and headers for audio and graphics.cmake build-essential
Build system generate, C++ compiler and other essential build tools.
Note
This project requires a C++ compiler with support for C++17 (or later) and CMake version 3.5 or higher.
Once you created a new instrument you can:
- Select node(s) using the left mouse button
- Move around using the right mouse button (also works in the graph windows)
- Zoom using the mouse wheel
- Delete selected node(s) by pressing
Delete
key - Use the
F
key to focus on the selected node(s) - Change a node's input pin type to slider by right-clicking on it
- Copy, cut and paste nodes using
Ctrl + C / X / V
node-selection.mp4
Json file located in resources/instruments
at the same path than MidiPlayer executable are read at startup.
Instruments can be selected and loaded to the node editor from the "Stored instruments" window.
JSON files located in the resources/instruments
directory, at the same path as the MidiPlayer executable, are read at startup.
Instruments can be selected and loaded into the node editor from the "Stored Instruments" window.
save-load.mp4
Audio settings can be configured from the "Settings" window:
- Select output audio device
- Choose sample rate: 44100 Hz or 48000 Hz
- Set channel mode: mono or stereo
- Adjust audio latency (time between audio generation and upload)
MIDI device can be selected and used from within the "Settings" window. The computer keyboard can also be used as MIDI inputs using the following keys:
Keyboard keys layout:
S D G H BLACK KEYS
Z X C V B N , WHITE KEYS
Piano mapping:
Piano: C C# D D# E F F# G G# A B
Keys: Z S X D C V G B H N ,
Use 'O' and 'P' to respectively go up and down one octave
Windows can be docked and resized to create custom layouts.
Layouts are automatically saved between sessions, you can delete the imgui.ini
file to reset everything.
ui-dock.mp4
Below is a description of the available nodes, along with details about their inputs and behaviors.
Tip
Multiple links can be connected to the same input. The final value will be the sum of all connected links.
Master
Node from which audio goes to the system sound. This node is created by default and cannot be removed or duplicated.
The Master node sends audio to the system's output device. It is created by default and cannot be removed or duplicated.
Input:
input
β Audio signal (Any value).
The signal is clamped between -1
and 1
before being passed to the audio output.
Oscillator
Generates a periodic signal that oscillates between -1
and 1
.
Inputs:
freq
β Frequency in Hertz. Defines how many cycles occur per second. (Any value)phase
β Phase offset applied to the waveform. (Any value)
UI settings:
Oscillator shape can be selected from the following waveforms:
- Sin β Smooth sine wave oscillation between
-1
and1
. - Square β Alternates sharply between
-1
and1
, creating a binary-like signal. - Triangle β Linearly ramps between
-1
and1
in a triangular shape. - Saw Dig β A digital-style sawtooth wave that ramps linearly up to
1
and drops abruptly to-1
. - White Noise β Produces random values between
-1
and1
. - Pink Noise β Noise signal with equal energy per octave, resulting in a warmer, more balanced sound with more emphasis on lower frequencies.
- Brownian Noise β Also known as red or Brown noise. It produces a deeper, smoother noise, emphasizing low frequencies even more than pink noise.
Multiply
Multiply and outputs input A with input B.
If input A or B is unplugged, its value is 0
.
Inputs:
input A
β Audio signal (Any value).input B
β Audio signal (Any value).
Keyboard frequency
Converts MIDI note events (triggered by key presses) into corresponding frequencies in Hertz.
This node outputs the base frequency associated with each MIDI note.
A reference table mapping MIDI note numbers to note names and frequencies can be found here.
ADSR envelope
An ADSR envelope defines how the intensity (or amplitude) of its input evolves from the moment a key is pressed until it is released. It's composed of four phases:
The envelope describe four parameters or phases:
- Attack : How quickly the sound reaches its maximum intensity after the key is pressed.
- Decay : How quickly the sound drops from the peak to the sustain level.
- Sustain : The constant intensity level held as long as the key is pressed.
- Release : How quickly the sound fades to silence after the key is released.
Inputs:
input
β Audio signal affected by the envelope (Any value).trigger
β Any non-zero value will trigger the envelope.
UI settings:
Edit ADSR
: Modify the shape of the ADSR node using a graphic.
Low Pass Filter
Attenuates high-frequency components from the input signal.
As the cutoff value approaches 0
, more high frequencies are removed, resulting in a smoother sound.
Inputs:
input
β Audio signal (Any value).cutoff
β Smoothing factor between0
and1
(Out of range values are clamped).resonance
βEmphasizes frequencies near the cutoff. Ranges from0
(no resonance) to1
(strong peak at cutoff) (Out of range values are clamped).
High Pass Filter
Attenuates low-frequency components from the input signal.
As the cutoff value approaches 1
, more high frequencies are removed, resulting in a bright sound.
Inputs:
input
β Audio signal (Any value).cutoff
β Smoothing factor between0
and1
(Out of range values are clamped).resonance
βEmphasizes frequencies near the cutoff. Ranges from0
(no resonance) to1
(strong peak at cutoff) (Out of range values are clamped).
Comb filter
Applies a delayed version of the signal back into itself.
Inputs:
input
β Audio signal (Any value).delay samples
β Number of samples before the signal is fed back (Negative values are clamped to0
).feedback
β Amount of the delayed signal fed back into the input. Ranges from0
(no feedback) to1
(maximum feedback). (Out-of-range values are clamped)
Overdrive
Applies a soft clipping effect to simulate analog-style distortion.
input
β Audio signal (Any value).drive
β Controls the amount of distortion applied. Higher values increase the signal gain before clipping, resulting in a more aggressive, saturated sound.
SoundFontPlayer
Play the content of a SoundFont file in response to incoming MIDI note and velocity events.
UI settings:
Provides a file browser for selecting a SoundFont file (.sf2
) to load and use for playback.
Number
Output a constant value.
UI settings:
Value: The number to output, can be any value.