Skip to content

Pianoteq Integration

David Anderson edited this page Nov 20, 2025 · 3 revisions

If you have Pianoteq installed, you can use it to play Numula scores.

Numula looks for Pianoteq version 8, then version 7. On Windows and Mac, it looks for the Pianoteq executables where the installer puts them by default. On Linux, it looks in the current directory.

Running Pianoteq as a server

The easiest way to use Pianoteq is to run it as a server. This way playing scores starts faster, and you won't end up with multiple Pianoteq windows.

To start Pianoteq as a server, run the program examples/pianoteq_server.py.

Once the server is running, you can play a Score using:

import numula.pianoteq as pianoteq

pianoteq.play_score(ns, preset=None, version=None)

If preset is present, it specifies a Pianoteq preset (e.g., "NY Steinway Model D", or "My Presets/NY Steinway Model D modified").

If version is present, it specifies a Pianoteq version (e.g. 8 or 9), in case you have multiple versions installed.

Most of the Numula examples work this way.

Note: this creates a file data/temp.midi. If you want to hang onto this, rename it.

Other interfaces to Pianoteq

Play a MIDI file in a new Pianoteq instance

pianoteq.play_midi_file(filename, preset=None)

plays the given MIDI file in a new Pianoteq instance.

Play a Score in a new Pianoteq instance

pianoteq.play_score_aux(ns, preset=None)

Render a MIDI file to a .WAV file

To render a MIDI file to a .WAV file:

pianoteq.midi_to_wav(
    ifile: str,
    ofile: str,
    mono: bool = False,
    preset: bool = None
)

The WAV file will have a 44.1K sampling rate and stereo 16-bit samples. If mono is True, the file is stereo, but its L and R signals are (almost) the same. Otherwise Pianoteq generates a stereo soundfield with bass to the left and treble to the right.

Controlling Pianoteq via RPC

Numula provides an API for controlling a Pianoteq server programmatically using network RPCs:

pianoteq.loadMidiFile(filename: str)
pianoteq.midiPlay()
pianoteq.midiSeek(seconds: float)
pianoteq.midiStop()
pianoteq.midiPause()
pianoteq.LoadPreset(name: str)

Clone this wiki locally