Skip to main content

liquiphy

A quick and dirty interface to the liquidsfz command-line using python's subprocess.

Install liquidsfz

You must install liquidsfz first for this package to work. To install:

  1. Make sure you have all the build dependencies:
$ sudo apt install \
	automake autoconf autoconf-archive libtool \
	libjack-jackd2-dev libreadline-dev lv2-dev libsndfile1-dev \
	libgl-dev libxrandr-dev libxcursor-dev libxext-dev
  1. Clone the repo:
$ git clone https://github.com/swesterfeld/liquidsfz.git
  1. Ensure the repo's submodules exist and are up-to-date. Enter the repo dir and update:
$ cd liquidsfz
$ git submodule update --init --recursive
  1. Run the autogen script found in the repo directory:
$ ./autogen.sh
  1. Then, do the configure, make, install routine:
./configure
make
make install

Install liquiphy

Install this package (liquiphy) using python pip:

$ pip install liquiphy

...or...

$ python3 -m pip install liquiphy

QuickStart Example

from liquiphy import LiquidSFZ
with LiquidSFZ(<path-to-sfz>) as liq:
	liq.noteon(0, 60, 80)
	sleep(1)
	liq.noteoff(0, 60)

If you need to get a reference to the constructed instance before starting the liquidsfz subprocess, use the "defer_start" parameter in the constructor:

with LiquidSFZ(<path-to-sfz>, defer_start = True) as liq:
	... do something first ...
	liq.start()
	... do regular stuff ...

API

To see a list of available methods, do this:

from liquiphy import LiquidSFZ
with LiquidSFZ() as liquid:
	print(dir(liquid))

liquidsfz help

All the commands which you can call on a LiquidSFZ instance mirror the underlying "liquidsfz" command API. Calling "help" on the liquidsfz command line produces the following table:

quit                - quit liquidsfz

load sfz_filename   - load sfz from filename
allsoundoff         - stop all sounds
reset               - system reset (stop all sounds, reset controllers)
noteon chan key vel - start note
noteoff chan key    - stop note
cc chan ctrl value  - send controller event
pitch_bend chan val - send pitch bend event (0 <= val <= 16383)
gain value          - set gain (0 <= value <= 5)
max_voices value    - set maximum number of voices
max_cache_size size - set maximum cache size in MB
preload_time time   - set preload time in ms
keys                - show keys supported by the sfz
switches            - show switches supported by the sfz
ccs                 - show ccs supported by the sfz
stats               - show voices/cache/cpu usage
info                - show information
voice_count         - print number of active synthesis voices
sleep time_ms       - sleep for some milliseconds
source filename     - load a file and execute each line as command
echo text           - print text

Looking at the above table, we see that there is a command "cc", which sends a controller event. The parameters are "chan, ctrl, value". Interpreting this as a python method would produce this:

def cc(self, chan, ctrl, value):
	"""
	send controller event
	"""

So calling this method would work like this:

from liquiphy import LiquidSFZ
with LiquidSFZ(<path-to-sfz>) as liq:
	liq.cc(0, 0x78, 0)

... which would send CC 0x78 (all sound off) to channel 0.

Return values

For methods which print text, the text printed by liquidsfz is the return value of the function.

with LiquidSFZ(<path-to-sfz>) as liq:
	print(liq.ccs())

... which in the test I just ran produced the following text:

ccs
Supported Controls:
 - CC #7 - Volume [ default 100 ]
 - CC #10 - Pan [ default 64 ]

quick-liq

Need to listen to an .sfz file without a lot of hassle? Call "quick-liq " from the command line, like so:

$ quick-liq <path-to-sfz>

The above command loads the given .sfz file in a liquidsfz instance and automatically connects the Jack MIDI input and Jack audio outputs to the first available (physical) ports. So far, it's the quickest, easiest way I found to listen to the sound of an .sfz without hassling with container apps or Jack connections.

Metadata

Release files for liquiphy 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liquiphy 1.3.3
File Size Uploaded Provenance
liquiphy-1.3.3.tar.gz 19.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for liquiphy 1.3.3
File Interpreter ABI Platform
liquiphy-1.3.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 37.5 kB

Release files / liquiphy-1.3.3.tar.gz

Download URL liquiphy-1.3.3.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ca3dbcf39f40832be9afaa15e669259a417758342087ae893feb92628f19d309
BLAKE2b-256 checksum
How to use checksums
df3c51fe3d17ea6f2134c6d3750d2ab86a614740731be66659ce19228543903f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / liquiphy-1.3.3-py2.py3-none-any.whl

Download URL liquiphy-1.3.3-py2.py3-none-any.whl
Size 18.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
effa04b1b7c4ec390a2750f85e0c1711a68bd4d9dc23deb4d1f41d6ddb2267a9
BLAKE2b-256 checksum
How to use checksums
db90ac59f8d2de5e13ae7710d63126f5f7050275db49e7b3a113a2bcc65b3f3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for liquiphy 1.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page