This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
Note: This is currently a direct clone of the SourceForge project at

Original readme follows.

PyJack version 0.5.2
Original code by Andrew W. Schmeder <>, in2003
Transport support by Il'dar Akhmetgaleev <akhilman at="" gmail="" dot="" com="">, in Jan 14 2008
Revision and packaging by falkTX <>, in Feb 2010
Implemented changes by the Clam Team <>, in Mar 2010
More Jack implementations by falkTX <>, in Apr 2010

This is open source software released under the GPL license.
The full text of this license is found in the file 'LICENSE',
included with this source code package.

This software is presently distributed from
Please check that site for the latest version.


PyJack is a module written in C which exposes the Jack API to Python.
For information about Jack see This
enables a Python program to connect to and interact with pro-audio
applications which use the Jack Audio Server.


- To show that it can be done.

- For programmers who want to prototype DSP and sound synthesis
algorithms using Numeric Python and similar tools. PyJack provides the
means to capture and playback audio.

- For patchbay applications; A powerful Jack patchbay can be written
in Python using this module. This is planned for the future.


This package uses the excellent and simple Python distutils.
Installation is very simple. It works something like this;

# tar -xzvf pyjack-0.*.tar.gz (unpack archive)
# cd pyjack-0.* (cd to source dir)
# (sudo) python install (install...)


Demos can be found in the "demos" directory

Realtime Issues:

Python is known to be relatively slow (compared to C/C++),
and non-realtime due to memory management details. Because of this,
Python is -NOT- a suitable language for realtime audio processing!
This means that it is unacceptable to place the Python intepreter
"inside" of a Jack client.
PyJack therefore uses a "semi-detached" method. The PyJack
client consists of two threads; a Jack client thread and a Python
thread. The Jack client thread is run in realtime context; it never
blocks, it is entirely deterministic, and does not touch any Python
data structures nor the interpreter. The Jack client thread merely
copies audio data in/out of socket buffers. On the Python side,
calls to jack.process() copy audio data in/out of the other end of
those sockets providing the connection to Python via Numeric arrays
of floats. In any case, use of a large buffer size (e.g. 1024 samples)
is recommended.
In order to capture or playback audio without missing a block,
Python must call jack.process() at least once every 500*(N/Sr)
milliseconds. (N = jack.get_buffer_size(), Sr = jack.get_sample_rate()).
If this rate is not kept up, you may get jack.InputSyncError or
jack.OutputSyncError exceptions thrown by jack.process().
Typically you will want to use the following design for a DSP
prototyping program:

1. Attach to the jack server (jack.attach)
Create input and output ports (jack.register_port)
Connect inputs and outputs to jack graph (jack.connect)
Activate client (jack.activate)
2. Preallocate matricies for input and output audio data
3. Capture X seconds of audio (jack.process)
4. Process audio using your algorithm
It does not matter how long this takes...
5. Playback X seconds of audio (jack.process)
6. Detach from jack server (jack.detach)

See the example code to get started; and

Module Documentation and Usage Examples:

Example: Importing the module:
>>> import jack
>>> dir(jack)
['CanMonitor', ... ]
>>> print jack.attach.__doc__
Attach client to the Jack server

Exceptions Thrown by the Jack module:

These are called jack.Error, jack.InputSyncError, etc.

A general exception thrown when things go wrong. Usually something
bad, like "can't connect to server", or "failed to connect ports"

Thrown when you try to access a jack API function before the client
has been attached.

Thrown when you are misusing the PyJack API. For example, trying to
call jack.activate() when the client has already been activated.

Often the low level jack client thread is not synchronized with the
Python side. This exception will be thrown to warn you that there a
potential synchronization problem. jack.OutputSyncError is extremely
uncommon, you should not ever see that error. jack.InputSyncError is
very common, for example if you have activated the client but do not
start calling jack.process() immediately.

>>> import jack
>>> import time
>>> jack.attach("test")
... etc
>>> jack.activate()
>>> time.sleep(1)
>>> jack.process(output, input)

Here you will get a InputSyncError, because you have been sleeping
for 1 second, the data in the audio buffer is about 1 second old.
In other words, the input stream has been stopped for 1 second,
holding old data. In spite of getting this error, you _will_ get
the old audio data in your input array.

Say that you want to write a monitoring application in Python; Now,
having a toolkit running along with audio processing in realtime is
nearly impossible (I've tried it; there is just not enough time to
redraw the screen without getting an InputSyncError). Basically what
you will want to do is only call jack.process() a few times per
second (say 5 times per second). Each time you call jack.process()
it will throw an InputSyncError, but you know that the audio data is
at most 1/5th of a second old; that is probably good enough for a
very simple metering of the input without making the GUI requirements
too extreme.

Jack Port Flags:


These are bit flags which indicate the properties of Jack ports. Use
the bitwise operators (| and &) with them;

>>> print jack.get_port_flags('alsa_pcm:capture_1')
>>> print (jack.get_port_flags('alsa_pcm:capture_1') & jack.IsInput) > 0
>>> print (jack.get_port_flags('alsa_pcm:capture_1') & jack.IsOutput) > 0
>>> print (jack.get_port_flags('alsa_pcm:capture_1') & jack.IsPhysical) > 0
>>> print (jack.get_port_flags('alsa_pcm:capture_1') & jack.IsTerminal) > 0
>>> print (jack.get_port_flags('alsa_pcm:capture_1') & jack.CanMonitor) > 0

When creating ports, you will want to use a bitwise | of the flags;

>>> jack.register_port("input_1", jack.IsInput | jack.CanMonitor)
>>> jack.register_port("input_1", jack.IsOutput | jack.CanMonitor)

Function calls in the jack module:

Attach to the jack server using the given client name.
All other function calls in the jack module require that you call
this function first. (otherwise you will get a NotConnectedError).

>>> jack.attach("foo_client")

Detach from the jack server

>>> jack.detach()
>>> jack.get_sample_rate()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
jack.NotConnectedError: Jack connection has not yet been established.

jack.register_port(name, flags)
Create a new port for this client with the given flags.
Once a port is created it cannot be 'unregistered'.
(The Jack API does permit this, but the PyJack module does not support it.)

Enables callbacks to the realtime jack thread.
This must be called before jack.process() is used.
Enabling the realtime thread has minimal CPU overhead.

Disables Jack callbacks to the realtime thread.
Opposite of jack.activate()
jack.process() cannot be used after jack.deactivate() is called,
until jack.activate() is called again.

This function exchanges audio between Python and the realtime jack thread.

It requires two arguments, which are both 2D Numeric Python arrays.
The arrays -must- be of type 'Float'. The size in the first dimenision
must match the number of inputs or outputs, and the size of the second
dimension must match the buffer size. See and
for examples of how this works. Following is a part of the code from In this example there is only one input port and one output
port. input.shape = (1, 1024), output.shape = (1, 144000).
Notice that process will modify entries in the input array.

input = Numeric.zeros((1,N), 'f') # note the float type here...
output = Numeric.reshape(
2*Numeric.pi*440.0 * (Numeric.arange(0, sec, 1.0/(Sr), 'f')[0:int(Sr*sec)])
), (1, Sr*sec)).astype('f')

i = 0
while i < output.shape[1] - N:
jack.process(output[:,i:i+N], input)
i += N
except jack.InputSyncError:
except jack.OutputSyncError:

Returns a list of all registered ports in the Jack graph.
The name of a port looks like: "client_name:port_name"

>>> jack.get_ports()
['alsa_pcm:capture_1', 'alsa_pcm:capture_2', 'alsa_pcm:capture_3', ... ]

Returns an integer which is the bitwise-or of all flags for a given port.

>>> jack.get_port_flags('alsa_pcm:playback_6')

Returns a list of ports connected to the given port.
If nothing is connected, returns a list of length zero.

>>> jack.get_connections('alsa_pcm:capture_1')

jack.connect(source, destination)
Connect two ports on the Jack graph.
Note that source must have the IsOutput flag, and
destination must have the IsInput flag.
If you want to recieve or send audio, you must
connect your client's inputs/outputs (those
ports registered via jack.register_port()) to
something else which is generating or recieving
audio, e.g. the alsa_pcm ports.
You can connect ports which belong to other clients
as well, e.g. for a patchbay application.

At the time of writing, there is a bug in the Jack
API which causes audio data to be missing from
input buffers if ports are connected before
jack.activate() is called. Until this is fixed,
please make sure that you call jack.activate()
prior to using jack.connect().

jack.disconnect(source, destination)
Break a connection established by jack.connect().

Returns the current buffer size used by the Jack server.
If this number is small you may have a lot of synchronization problems.

Returns the current sample rate used by the Jack server.

Check if any asynchronous event callbacks have been raised since
the last call to jack.check_events().
Use of this function does -NOT- require that you be presently attached
to the Jack server; however the values will not change unless you are!

>>> jack.check_events()
{'graph_ordering': 0, 'shutdown': 0, 'port_registration': 0, 'hangup': 0}

If graph_ordering == 1:
Then a pair of ports somewhere in the jack graph has been connected or

If port_registration == 1:
Then a port has been added or removed from the jack graph.

If shutdown == 1:
Then the Jack server has shutdown; your client is no longer attached.

If hangup == 1:
Then the Jack server decided to kill the PyJack client for some reason;
the client is no longer attached.

Any flag which is raised is immediatly reset to zero when this
function is called.


Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More


History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
py-jack-0.5.2.tar.gz (13.5 kB) Copy SHA256 Checksum SHA256 Source Nov 15, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting