#39150: portaudio --------------------+-------------------------------- Reporter: cr@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Keywords: | Port: portaudio --------------------+-------------------------------- == Symptoms == On Mac OS X 10.7.5 with CoreAudio 4.0.3, reading from the default audio source at non-standard framerates fails with an "Input overflowed" IOError: {{{ $ cat bm.py #!/usr/bin/env python import pyaudio p = pyaudio.PyAudio() s = p.open( format=pyaudio.paFloat32, channels=2, rate=24000, input=True, frames_per_buffer=256*4 ) while True: a = s.read( 256 ) $ ./bm.py Traceback (most recent call last): File "./bm.py", line 5, in <module> while True: a = s.read( 256 ) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/pyaudio.py", line 605, in read return pa.read_stream(self._stream, num_frames) IOError: [Errno Input overflowed] -9981 }}} Framerates tested: {{{ 96000: FAIL 88200: FAIL 48000: OK 44100: FAIL 32000: FAIL 24000: FAIL 22050: FAIL 16000: FAIL 12000: FAIL 11025: FAIL 8000: FAIL }}} == Preliminary analysis == The bug has been addressed upstream in mid-2012: https://www.assembla.com/spaces/portaudio/tickets/171#/activity/ticket Contrary to what the developer stated in the ticket, the actual svn commit that fixed the issue was 1844: {{{ ------------------------------------------------------------------------ r1844 | philburk | 2012-06-25 03:12:29 +0200 (Mo, 25. Jun 2012) | 4 Zeilen Fix ring buffer handling in pa_mac_core.c that caused many spurious paInputOverflow flags. Fixed size bug when input underflow detected. Code was confused between bytes and elements. Zero out the beginning of a recording when detecting pops to prevent start of audio from looking like a pop in qa loopback test. }}} While upgrading portaudio would probably be the better solution, there is no download archive that includes this revision, yet, except for the daily snapshot http://www.portaudio.com/archives/pa_snapshot.tgz . An alternative would be to switch to downloading from svn. == Solution == The patch from 1844 was added to the Portfile. Experiments show, that several frame rates now smoothly while others (possibly unsupported?) still fail. 1844 supposedly solves other spurious Input overflow failures, too. Framerates tested: {{{ 96000: OK 88200: OK 48000: OK 44100: OK 32000: OK 24000: OK 22050: FAIL 16000: FAIL 12000: FAIL 11025: FAIL 8000: FAIL }}} -- Ticket URL: <https://trac.macports.org/ticket/39150> MacPorts <http://www.macports.org/> Ports system for OS X