= pkaudio = pkaudio is a multi-puropose audio library written in '' '''python''' ''. Benchmarks will prove that python is perfectly capable of low-latency and reliable audio work. Sceptics need only install the pksampler and watch the cpu usage! ([milestone:pksampler-0.4 pkaudio progress]) ''NEWS'' I've written a pkaudio prototype, and it has made pksampler-0.4 possible. All of it is re-usable and easily readable with plenty of unit tests, so go for it! == The ideal audio library == * synchronous/asynchronous api * transparent multi-card I/O * reliable real-time performance * low-latency communication * cross-platform * standard/clean dependency list * audio graphs * event output (like peak levels) * music sequencing * disk buffering * decent media support * easy extension model == Status == Look at this unit test, just look at it! {{{ #!python class SchedulerTest(unittest.TestCase): def setUp(self): self.sound = buffering.Sound(1000, 44100) buffering.Filler(NoZeros(1000), self.sound).run() self.periodsize = 75 self.clock = engine.Clock() self.sched = scheduler.Scheduler(self.sound, self.clock) def test_play(self): frame = 400 self.sched.play(frame) stream_out = [] target = numarray.array([0] * self.periodsize, numarray.Int16) for i in range(10): self.clock.set(self.periodsize * i, self.periodsize) self.sched.render(target) stream_out.extend(target) self.assertFalse(numarray.any(target[:frame])) self.assertTrue(numarray.all(target[frame:])) }}} == the python equivalent == ''simple design, expect to throw out quite a few'' ''Threads'' * each sample, io * buffer, io * proc migration? * profile w/ in-proc audio first * consider migrating later ''Model'' * graphs * mixer * effects * dsp buffer-routines * volume(block) * resample * copy? ''Communication'' * in events are easy * out events * peaks '''HOWTO''' * ''pyogg: ld: multiple definitions of symbol _Py_OggError'' * PyObject *Py_OggError; should be "extern" * PyObject *Py_OggError; should go in _oggmodule.c '''hurdles''' * [SOLVED] realtime and the GIL (audio/buffering) * How can we buffer from the disk if the real-time thread cannot block? * C extensions unlock the GIL whild loading. Run a print test. * Remember, the lock can be held if it is only accessing small amounts of memory. * Querying memory can generally happen without locking the GIL. * '''all (good) C extensions release the GIL, including python I/O.''' * buffer ops * [SOLVED] written to device? * [SOLVED] read from disk? * [SOLVED] audioop?