Control JACK audio server with Python.
Can be used as replacement for jackd for more robust configuration, for example, when using jack
package.
pip install jack_server
Also you need to have jackserver
library on your machine, it comes with JACK2. I had problems with apt-package on Ubuntu (jackd2
), if you do too, compile jack yourself.
On server creation you can specify some parameters:
import jack_server
server = jack_server.Server(
name="myfancyserver",
sync=True,
realtime=False,
driver="coreaudio",
device="BuiltInSpeakerDevice",
rate=48000,
period=1024,
# nperiods=2 # Work only with `alsa` driver
)
server.start()
input()
They are actually an equivalent of jackd
flags:
-n
,--name
toname
,-S
,--sync
tosync
,-R
,--realtime
,-r
,--no-realtime
torealtime
,-d
todriver
,
And driver arguments:
-d
,--device
todevice
,-r
,--rate
torate
,-p
,--period
toperiod
,
Open and start the server. All state controlling methods are idempotent.
Stop and close server.
Selected driver.
Actual server name. It is property that calls C code, so you can actually set the name.
Whether JACK runs in sync mode. Useful when you`re trying to send and receive multichannel audio.
Whether JACK should start in realtime mode.
Server parameters mapped by name.
Driver (JACK backend), can be safely changed before server is started. Not supposed to be created by user code.
Driver name, read-only.
Selected device.
Sampling rate.
Buffer size.
Number of periods. 2 is right for motherboard, PCI, PCI-X, etc.; 3 for USB (source).
Can be helpful when tailoring performance on jittery systems.
Driver parameters mapped by name.
Valid sampling rate, 44100
or 48000
.
Not supposed to be created by user code.
Read-only verbose name of parameter.
Value of the parameter, can be changed.
Set info output handler. By default JACK does is itself, i. e. output is being printed in stdout.
Set error output handler. By default JACK does is itself, i. e. output is being printed in stderr.