python-sounddevice icon indicating copy to clipboard operation
python-sounddevice copied to clipboard

never_drop_input issues on Mac

Open mattgwwalker opened this issue 5 years ago • 2 comments

Hi,

When working on a Mac, adding the argument never_drop_input=True to a Stream causes the error PortAudioError: Error opening Stream: Invalid flag [PaErrorCode -9995]

However on a Windows instance, the code runs without fault.

To reproduce this, you can take the wire.py example and add never_drop_input=True to the call to Stream. (The blocksize should remain at its default value of zero.)

I will dig into this some more, but if anyone has any hints, I'm all ears.

Cheers,

Matthew

mattgwwalker avatar Jul 08 '20 05:07 mattgwwalker

Thanks for the report!

The sounddevice module is just passing the never_drop_input flag to the underlying PortAudio library (where the flag is called paNeverDropInput).

You could ask at the PortAudio mailing list (http://portaudio.com/contacts.html) about this.

mgeier avatar Jul 08 '20 09:07 mgeier

Thanks for the confirmation.

After much digging, it indeed appears that it's an internal PortAudio issue.

(PortAudio internally redefines the frame size, and then calls internal code that returns an error when it detects that the frame size is not paFramesPerBufferUnspecifed i.e. blocksize of zero in the sounddevice call.)

I'll write to the mailing list and see if I get anywhere.

Cheers,

Matthew

mattgwwalker avatar Jul 08 '20 10:07 mattgwwalker