Using any other values in pyaudio for rate / format / chunk give me the error: [Errno Input overflowed] -9981
Question: OS: Mac OSX 10.7.5 Python: Python 2.7.3 (homebrew) pyaudio: 0.2.7 portaudio:
19.20111121 (homebrew - portaudio)

**The following script outputs the following and displays the issues I am
having:**

    
    
    #!/usr/bin/env python
    import pyaudio
    from pprint import pprint
    
    p = pyaudio.PyAudio()
    
    
    # SUCCEEDS
    pprint(p.is_format_supported(input_format=pyaudio.paInt8,input_channels=1,rate=44100,input_device=0)) # => True
    try:
        stream = p.open(format=pyaudio.paInt8,channels=1,rate=44100,input=True,frames_per_buffer=1024)
        data = stream.read(1024)
    except IOError as e:
        print 'This never happens: '+str(e)
    
    # FAILS
    pprint(p.is_format_supported(input_format=pyaudio.paInt8,input_channels=1,rate=22050,input_device=0)) # => True
    try:
        stream = p.open(format=pyaudio.paInt8,channels=1,rate=22050,input=True,frames_per_buffer=1024)
        data = stream.read(1024)
    except IOError as e:
        print 'This fails: '+str(e)
    
    # FAILS
    pprint(p.is_format_supported(input_format=pyaudio.paInt8,input_channels=1,rate=22050,input_device=0)) # => True
    try:
        stream = p.open(format=pyaudio.paInt8,channels=1,rate=22050,input=True,frames_per_buffer=512)
        data = stream.read(1024)
    except IOError as e:
        print 'This also fails: '+str(e)
    
    # FAILS
    pprint(p.is_format_supported(input_format=pyaudio.paInt8,input_channels=1,rate=11025,input_device=0)) # => True
    try:
        stream = p.open(format=pyaudio.paInt8,channels=1,rate=11025,input=True,frames_per_buffer=512)
        data = stream.read(1024)
    except IOError as e:
        print 'This also fails as well: '+str(e)
    
    stream.stop_stream()
    stream.close()
    p.terminate()
    

**The above outputs the following:**

    
    
    True
    True
    This fails: [Errno Input overflowed] -9981
    True
    This also fails: [Errno Input overflowed] -9981
    True
    This also fails as well: [Errno Input overflowed] -9981
    


Answer: If you want to check whether the desired settings of format, channels, rate,
etc. are supported by your OS and hardware, do the following:

    
    
    import pyaudio
    soundObj = pyaudio.PyAudio()
    
    # Learn what your OS+Hardware can do
    defaultCapability = soundObj.get_default_host_api_info()
    print defaultCapability
    
    # See if you can make it do what you want
    isSupported = soundObj.is_format_supported(input_format=pyaudio.paInt8, input_channels=1, rate=22050, input_device=0)
    print isSupported
    

`isSupported` will be `True` incase your system can deal with your settings.
The memory overflow errors might be due to some OS+Hardware issues. You must
check what your default host API can actually do. You don't need to "open" and
"close" the `soundObj` via the "stream class" for querying it.

Have a look at this SO question: [PyAudio Input
overflowed](http://stackoverflow.com/questions/10733903/pyaudio-input-
overflowed)

For additional pyaudio documentation and help visit:

<http://people.csail.mit.edu/hubert/pyaudio/docs/>

### Edit:

It turns out that "Errno Input overflowed - 9981" is not a trivial issue:
<http://trac.macports.org/ticket/39150>

I see that you have the latest portaudio version (19.20111121) but
19.20111121_4 claims to have fixed the bug. See if upgrading portaudio works.

