Put the caller to sleep for at least msec milliseconds.
The function may sleep longer than requested so don’t rely on this for accurate musical timing.
Get version information for the PortAudio library.
Returns the release number and a textual description of the current PortAudio build, e.g.
(1899, 'PortAudio V19-devel (built Feb 15 2014 23:28:00)')
- class sounddevice.CallbackFlags(flags=0)§
Flag bits for the status argument to a stream callback.
If you experience under-/overflows, you can try to increase the
blocksizesettings. You should also avoid anything that could block the callback function for a long time, e.g. extensive computations, waiting for another thread, reading/writing files, network connections, etc.
This can be used to collect the errors of multiple status objects:
>>> import sounddevice as sd >>> errors = sd.CallbackFlags() >>> errors |= status1 >>> errors |= status2 >>> errors |= status3 >>> # and so on ... >>> errors.input_overflow True
The values may also be set and cleared by the user:
>>> import sounddevice as sd >>> cf = sd.CallbackFlags() >>> cf <sounddevice.CallbackFlags: no flags set> >>> cf.input_underflow = True >>> cf <sounddevice.CallbackFlags: input underflow> >>> cf.input_underflow = False >>> cf <sounddevice.CallbackFlags: no flags set>
- property input_underflow§
In a stream opened with
blocksize=0, indicates that input data is all silence (zeros) because no real data is available. In a stream opened with a non-zero blocksize, it indicates that one or more zero samples have been inserted into the input buffer to compensate for an input underflow.
This can only happen in full-duplex streams (including
- property input_overflow§
In a stream opened with
blocksize=0, indicates that data prior to the first sample of the input buffer was discarded due to an overflow, possibly because the stream callback is using too much CPU time. In a stream opened with a non-zero blocksize, it indicates that data prior to one or more samples in the input buffer was discarded.
- property output_underflow§
Indicates that output data (or a gap) was inserted, possibly because the stream callback is using too much CPU time.
- property output_overflow§
Indicates that output data will be discarded because no room is available.
- property priming_output§
Some of all of the output data will be used to prime the stream, input data may be zero.
This will only take place with some of the host APIs, and only if
prime_output_buffers_using_stream_callback=Truewas specified. See
- exception sounddevice.CallbackStop§
Exception to be raised by the user to stop callback processing.
If this is raised in the stream callback, the callback will not be invoked anymore (but all pending audio buffers will be played).
- exception sounddevice.CallbackAbort§
Exception to be raised by the user to abort callback processing.
If this is raised in the stream callback, all pending buffers are discarded and the callback will not be invoked anymore.
- exception sounddevice.PortAudioError§
This exception will be raised on PortAudio errors.
A variable length tuple containing the following elements when available:
A string describing the error
A 3-tuple containing the host API index, host error code, and the host error message (which may be an empty string)