PKAudio 0.3 reviewDownload
PKAudio library is a high performance signal/audio processing library that allows stream objects to be created and mixed without inte
PKAudio library is a high performance signal/audio processing library that allows stream objects to be created and mixed without interrupting the main stream of audio.
The core library runs in pkaudiod, an executable that runs with realtime or high priority, and a single client can communicate with it via a tcp socket.
A python client is provided, and can be used to write clients in other languages if necessary. The API is small and the protocol is simple.
There are two parts to pkaudio: the pkaudiod daemon executable and the python module to communicate with it. The daemon is written in C++ and is configured and compiled like and other make program. To install everything, all you have to do is use the install.py python script like any other extension module. Here are the simplest install instructions:
cd < source dir >
python install.py [-h]
If Jack support is compiled into pkaudio, make sure you start the jack daemon before running pkaudiod. If you don't, there will be no audio output. You can start the jack server with at least something like this (-r 44100 is required):
jackd -d alsa -r 44100
The pkaudiod executable is installed in your path and can be executed explicitly from the command line, or implicitly with the python module:
The "--realtime" option tells pkaudiod to run with realtime priority, or the highest priority possible if realtime shceduling is not available in the kernel. Most systems will only allow processes to be scheduled with realtime priority if they are executed by the superuser "root". If you want to run the daemon with realtime priority as a normal user, you have to set the owner of the file to 'root', and the suid bit to on, like this (this is automatically done in the install.py script):
chown root `which pkaudiod`
chmod +s `which pkaudiod`
The daemon will tell you if it is running with realtime priority, or if it is running with increased priority.
Using the Python Module:
A good way to learn how to use the python module is to look at test_unittest.py. But, the following code will start the pkaudiod daemon as a child process and play a wav file:
sid = pkaudio.createModule('Sample',
sample = pkaudio.getModuleInfo(sid)
mixer = pkaudio.getMainMixer(0)
pkaudio.setProperty(sid, 'playing', pkaudio.TRUE)
pkaudio.setProperty(sid, 'looping', pkaudio.TRUE)
Fortunately, all of this can be accomplished with the higher-level PKAudio module:
d = PKAudio.Driver()
s = PKAudio.Sample("/home/me/my.wav")
m = d.getMixer(0)
while not s.atEnd():
PKAudio 0.3 keywords