# Module-wide Default Settings

class sounddevice.default

  Get/set defaults for the sounddevice module.

  The attributes `device`, `channels`, `dtype`, `latency` and `extra_settings` accept single values which specify the given property for both input and output. However, if the property differs between input and output, pairs of values can be used, where the first value specifies the input and the second value specifies the output. All other attributes are always single values.

  Examples

      >>> import sounddevice as sd
      >>> sd.default.samplerate = 48000
      >>> sd.default.dtype
      ['float32', 'float32']

  Different values for input and output:

      >>> sd.default.channels = 1, 2

  A single value sets both input and output at the same time:

      >>> sd.default.device = 5
      >>> sd.default.device
      [5, 5]

  An attribute can be set to the “factory default” by assigning `None`:

      >>> sd.default.samplerate = None
      >>> sd.default.device = None, 4

  Use `reset()` to reset all attributes:

      >>> sd.default.reset()

  device = (None, None)

    Index or query string of default input/output device.

    If not overwritten, this is queried from PortAudio.

    See also

    `default`, `query_devices()`, the device argument of `Stream`

  channels = (None, None)

    Default number of input/output channels.

    See also

    `default`, `query_devices()`, the channels argument of `Stream`

  dtype = ('float32', 'float32')

    Default data type used for input/output samples.

    The types `'float32'`, `'int32'`, `'int16'`, `'int8'` and `'uint8'` can be used for all streams and functions. Additionally, `play()`, `rec()` and `playrec()` support `'float64'` (for convenience, data is merely converted from/to `'float32'`) and `RawInputStream`, `RawOutputStream` and `RawStream` support `'int24'` (packed 24 bit format, which is not supported in NumPy!).

    See also

    `default`, `numpy.dtype`, the dtype argument of `Stream`

  latency = ('high', 'high')

    See the latency argument of `Stream`.

  extra_settings = (None, None)

    Host-API-specific input/output settings.

    See also

    `AsioSettings`, `CoreAudioSettings`, `WasapiSettings`

  samplerate = None

    Sampling frequency in Hertz (= frames per second).

    See also

    `default`, `query_devices()`

  blocksize = 0

    See the blocksize argument of `Stream`.

  clip_off = False

    Disable clipping.

    Set to `True` to disable default clipping of out of range samples.

  dither_off = False

    Disable dithering.

    Set to `True` to disable default dithering.

  never_drop_input = False

    Set behavior for input overflow of full-duplex streams.

    Set to `True` to request that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback. This flag is only valid for full-duplex callback streams (i.e. only `Stream` and `RawStream` and only if callback was specified; this includes `playrec()`) and only when used in combination with `blocksize=0` (the default). Using this flag incorrectly results in an error being raised. See also http://www.portaudio.com/docs/proposals/001-UnderflowOverflowHandling.html.

  prime_output_buffers_using_stream_callback = False

    How to fill initial output buffers.

    Set to `True` to call the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence). This flag has no effect for input-only (`InputStream` and `RawInputStream`) and blocking read/write streams (i.e. if callback wasn’t specified). See also http://www.portaudio.com/docs/proposals/020-AllowCallbackToPrimeStream.html.

  property hostapi

    Index of the default host API (read-only).

  reset()

    Reset all attributes to their “factory default”.