@@ -352,13 +352,14 @@ def play(data, samplerate=None, mapping=None, blocking=False, loop=False,
352352 treated as mono data.
353353 The data types *float64*, *float32*, *int32*, *int16*, *int8*
354354 and *uint8* can be used.
355- *float64* data is converted to *float32* before passing it to
356- PortAudio, because it's not supported natively.
355+ *float64* data is simply converted to *float32* before passing
356+ it to PortAudio, because it's not supported natively.
357357 mapping : array_like, optional
358358 List of channel numbers (starting with 1) where the columns of
359359 *data* shall be played back on. Must have the same length as
360- number of channels in *data* (except if *data* is mono).
361- Each channel may only appear once in *mapping*.
360+ number of channels in *data* (except if *data* is mono, in which
361+ case the signal is played back on all given output channels).
362+ Each channel number may only appear once in *mapping*.
362363 blocking : bool, optional
363364 If ``False`` (the default), return immediately (but playback
364365 continues in the background), if ``True``, wait until playback
@@ -428,7 +429,7 @@ def rec(frames=None, samplerate=None, channels=None, dtype=None,
428429 The recorded data.
429430
430431 .. note:: By default (``blocking=False``), an array of data is
431- returned which is still being written to while recording.
432+ returned which is still being written to while recording!
432433 The returned data is only valid once recording has stopped.
433434 Use `wait()` to make sure the recording is finished.
434435
@@ -590,14 +591,14 @@ def get_status():
590591def get_stream ():
591592 """Get a reference to the current stream.
592593
593- This applies only to streams created by calls to `play()`, `rec()`,
594+ This applies only to streams created by calls to `play()`, `rec()`
594595 or `playrec()`.
595596
596597 Returns
597598 -------
598599 Stream
599- An `OutputStream`, `InputStream`, or `Stream` associated with
600- the last invocation of `play()`, `rec()` or `playrec()`
600+ An `OutputStream`, `InputStream` or `Stream` associated with
601+ the last invocation of `play()`, `rec()` or `playrec()`,
601602 respectively.
602603
603604 """
@@ -630,7 +631,7 @@ def query_devices(device=None, kind=None):
630631 -------
631632 dict or DeviceList
632633 A dictionary with information about the given *device* or -- if
633- no *device* was specified -- a `DeviceList` containing one
634+ no arguments were specified -- a `DeviceList` containing one
634635 dictionary for each available device.
635636 The dictionaries have the following keys:
636637
@@ -703,7 +704,7 @@ def query_devices(device=None, kind=None):
703704 devices. The latter sometimes have a ridiculously high number of
704705 (virtual) inputs and outputs.
705706
706- On Mac OS X , you might get something similar to this:
707+ On macOS , you might get something similar to this:
707708
708709 >>> sd.query_devices()
709710 0 Built-in Line Input, Core Audio (2 in, 0 out)
@@ -819,7 +820,7 @@ def check_input_settings(device=None, channels=None, dtype=None,
819820 Parameters
820821 ----------
821822 device : int or str, optional
822- Device ID or device name substring, see `default.device`.
823+ Device ID or device name substring(s) , see `default.device`.
823824 channels : int, optional
824825 Number of input channels, see `default.channels`.
825826 dtype : str or numpy.dtype, optional
@@ -1272,7 +1273,7 @@ def __init__(self, samplerate=None, blocksize=None,
12721273 This is the same as `InputStream`, except that the *callback*
12731274 function and :meth:`~RawStream.read` work on plain Python buffer
12741275 objects instead of on NumPy arrays.
1275- NumPy is not necessary to use this.
1276+ NumPy is not necessary for using this.
12761277
12771278 Parameters
12781279 ----------
@@ -1312,7 +1313,7 @@ def read(self, frames):
13121313
13131314 This is the same as `Stream.read()`, except that it returns
13141315 a plain Python buffer object instead of a NumPy array.
1315- NumPy is not necessary to use this.
1316+ NumPy is not necessary for using this.
13161317
13171318 Parameters
13181319 ----------
@@ -1356,7 +1357,7 @@ def __init__(self, samplerate=None, blocksize=None,
13561357 This is the same as `OutputStream`, except that the *callback*
13571358 function and :meth:`~RawStream.write` work on plain Python
13581359 buffer objects instead of on NumPy arrays.
1359- NumPy is not necessary to use this.
1360+ NumPy is not necessary for using this.
13601361
13611362 Parameters
13621363 ----------
@@ -1396,7 +1397,7 @@ def write(self, data):
13961397
13971398 This is the same as `Stream.write()`, except that it expects
13981399 a plain Python buffer object instead of a NumPy array.
1399- NumPy is not necessary to use this.
1400+ NumPy is not necessary for using this.
14001401
14011402 Parameters
14021403 ----------
@@ -1451,9 +1452,9 @@ def __init__(self, samplerate=None, blocksize=None,
14511452 This is the same as `Stream`, except that the *callback*
14521453 function and `read()`/`write()` work on plain Python buffer
14531454 objects instead of on NumPy arrays.
1454- NumPy is not necessary to use this.
1455+ NumPy is not necessary for using this.
14551456
1456- To open "raw" input-only or output-only stream use
1457+ To open a "raw" input-only or output-only stream use
14571458 `RawInputStream` or `RawOutputStream`, respectively.
14581459 If you want to handle audio data as NumPy arrays instead of
14591460 buffer objects, use `Stream`, `InputStream` or `OutputStream`.
@@ -1653,17 +1654,17 @@ def __init__(self, samplerate=None, blocksize=None,
16531654 extra_settings = None , callback = None , finished_callback = None ,
16541655 clip_off = None , dither_off = None , never_drop_input = None ,
16551656 prime_output_buffers_using_stream_callback = None ):
1656- """Open a stream for input and output.
1657+ """Open a stream for simultaneous input and output.
16571658
16581659 To open an input-only or output-only stream use `InputStream` or
16591660 `OutputStream`, respectively. If you want to handle audio data
1660- as buffer objects instead of NumPy arrays, use `RawStream`,
1661- `RawInputStream` or `RawOutputStream`.
1661+ as plain buffer objects instead of NumPy arrays, use
1662+ `RawStream`, ` RawInputStream` or `RawOutputStream`.
16621663
16631664 A single stream can provide multiple channels of real-time
16641665 streaming audio input and output to a client application. A
16651666 stream provides access to audio hardware represented by one or
1666- more devices. Depending on the underlying Host API, it may be
1667+ more devices. Depending on the underlying host API, it may be
16671668 possible to open multiple streams using the same device, however
16681669 this behavior is implementation defined. Portable applications
16691670 should assume that a device may be simultaneously used by at
@@ -1984,6 +1985,9 @@ def input_underflow(self):
19841985 that one or more zero samples have been inserted into the input
19851986 buffer to compensate for an input underflow.
19861987
1988+ This can only happen in full-duplex streams (including
1989+ `playrec()`).
1990+
19871991 """
19881992 return self ._hasflag (_lib .paInputUnderflow )
19891993
@@ -1997,6 +2001,9 @@ def input_overflow(self):
19972001 too much CPU time. Otherwise indicates that data prior to one
19982002 or more samples in the input buffer was discarded.
19992003
2004+ This can happen in full-duplex and input-only streams (including
2005+ `playrec()` and `rec()`).
2006+
20002007 """
20012008 return self ._hasflag (_lib .paInputOverflow )
20022009
@@ -2007,6 +2014,9 @@ def output_underflow(self):
20072014 Indicates that output data (or a gap) was inserted, possibly
20082015 because the stream callback is using too much CPU time.
20092016
2017+ This can happen in full-duplex and output-only streams
2018+ (including `playrec()` and `play()`).
2019+
20102020 """
20112021 return self ._hasflag (_lib .paOutputUnderflow )
20122022
@@ -2017,6 +2027,10 @@ def output_overflow(self):
20172027 Indicates that output data will be discarded because no room is
20182028 available.
20192029
2030+ This can only happen in full-duplex streams (including
2031+ `playrec()`), but only when ``never_drop_input=True`` was
2032+ specified. See `default.never_drop_input`.
2033+
20202034 """
20212035 return self ._hasflag (_lib .paOutputOverflow )
20222036
@@ -2027,6 +2041,11 @@ def priming_output(self):
20272041 Some of all of the output data will be used to prime the stream,
20282042 input data may be zero.
20292043
2044+ This will only take place with some of the host APIs, and only
2045+ if ``prime_output_buffers_using_stream_callback=True`` was
2046+ specified.
2047+ See `default.prime_output_buffers_using_stream_callback`.
2048+
20302049 """
20312050 return self ._hasflag (_lib .paPrimingOutput )
20322051
@@ -2196,8 +2215,9 @@ class default(object):
21962215 callback. This flag is only valid for full-duplex callback streams
21972216 (i.e. only `Stream` and `RawStream` and only if *callback* was
21982217 specified; this includes `playrec()`) and only when used in
2199- combination with ``blocksize=0`` (the default).
2200- Using this flag incorrectly results in an error being raised.
2218+ combination with ``blocksize=0`` (the default). Using this flag
2219+ incorrectly results in an error being raised. See also
2220+ http://www.portaudio.com/docs/proposals/001-UnderflowOverflowHandling.html.
22012221
22022222 """
22032223 prime_output_buffers_using_stream_callback = False
@@ -2207,7 +2227,8 @@ class default(object):
22072227 buffers, rather than the default behavior of priming the buffers
22082228 with zeros (silence). This flag has no effect for input-only
22092229 (`InputStream` and `RawInputStream`) and blocking read/write streams
2210- (i.e. if *callback* wasn't specified).
2230+ (i.e. if *callback* wasn't specified). See also
2231+ http://www.portaudio.com/docs/proposals/020-AllowCallbackToPrimeStream.html.
22112232
22122233 """
22132234
@@ -2293,8 +2314,8 @@ def __init__(self, channel_selectors):
22932314 The length of *channel_selectors* must match the
22942315 corresponding *channels* parameter of `Stream()` (or
22952316 variants), otherwise a crash may result.
2296- The values in the selectors array must specify channels
2297- within the range of supported channels.
2317+ The values in the *channel_selectors* array must specify
2318+ channels within the range of supported channels.
22982319
22992320 Examples
23002321 --------
@@ -2745,7 +2766,7 @@ def _ignore_stderr():
27452766 FILE* fopen(const char* path, const char* mode);
27462767 int fclose(FILE* fp);
27472768 FILE* stderr; /* GNU C library */
2748- FILE* __stderrp; /* Mac OS X */
2769+ FILE* __stderrp; /* macOS */
27492770 """ )
27502771 try :
27512772 stdio = ffi .dlopen (None )
0 commit comments