+
    O\i`                     	   R t Rt^ RIt^ RIt^ RIHtHtHt ^ RI	H
t ^ RIHt  ]tR^R^R^R	^R
^R^R^R^R^	R^/
t/ RRbRRbRRbRRbRRbRRbRRbRRbR R!bR"R#bR$R%bR&R'bR(R)bR*R+bR,R-bR.R/bR0R1bR2R3R4R5R6R7R8R9R:R;R<R=R>R?R@RARBRC/	Ct/ RD^bRE^bRF^bRG^bRH^bRI^bRJ^bRK^bRL^bRM^bRN^bRO^ bRP^!bRQ^"bRR^#bRS^$bRT^0b/ RU^1bRV^2bRW^@bRX^AbRY^BbRZ^CbR[^PbR\^QbR]^`bR^^dbR_^pbR`^qbRa^rbRb^sbRc^bRd^bRe^bCtRf^ RgRhRiRjRkRl/t/ RREbRREbRREbRREbRREbRREbRREbR REbR"REbR$RJbR&RJbR(REbR*R\bR,REbR.REbR0REbR2REbR4RER6RER8RER:RLR<R]R>RER@RERBRe/CtRmRnRoRpRqRrRsRt/tRu^ Rv^Rw^/t ]P4                  Rx8X  d   ^ RyIHt Rz]! 4       ,           R{,           tM]P4                  R|8X  d[   ^ R}IHt ^ RyIHt ]! 4       ^ ,          R~8X  d   RtM|]! 4       ^ ,          R8X  d   RtMf] ! RPC                  ]! 4       ]! 4       4      4      h]P4                  R8X  d,   ^ RyIHt ]! 4       R9   d   RtMRz]! 4       ,           R,           tM] ! R4      h^ RI"t"]PF                  PI                  ]"PJ                  4      t&]PF                  PO                  ]&]4      t(]PR                  ! ](4      t*]Pb                  ! ]*Pe                  4       4      Pg                  RR4      t4]4Pk                  R4      '       d   ]4]6! R4      R t4RR lt7RR lt8RR lt9 ! R R]:4      t;RR lt<R t=RR lt>RR lt?R t@ ! R R]:4      tARR ltBR tCR tDR tER tFR tG]*P                  3R ltIR tJR tKR tL ! R R]M4      tN ! R R]N]O4      tP ! R R]P4      tQR#   ] d    ]t ELIi ; i  ] ]+],3 Ed     ]! R4      t-]-f	   ] ! R4      h]PR                  ! ]-4      t* EL"  ]  d    ]P4                  Rx8X  d   Rt.M)]P4                  R|8X  d   Rt.M]P4                  R8X  d   Rt.Mh ^ RyIHt ]P4                  Rx8X  db   ]! 4       R8X  dV   ]PF                  P_                  R4      '       d   RMRt0]PR                  ! ]PF                  PO                  ]0].4      4      t*  EL]PR                  ! ].4      t*  ELi ; ii ; i)ak  python-soundfile is an audio library based on libsndfile, CFFI and NumPy.

Sound files can be read or written directly using the functions
`read()` and `write()`.
To read a sound file in a block-wise fashion, use `blocks()`.
Alternatively, sound files can be opened as `SoundFile` objects.

For further information, see https://python-soundfile.readthedocs.io/.

z0.13.1N)SEEK_SETSEEK_CURSEEK_END)find_library)ffititle	copyrightsoftwareartistcommentdatealbumlicensetracknumbergenreWAVi   AIFFi   AUi   RAWi   PAFi   SVXi   NISTi   VOCi   IRCAMi  
 W64i   MAT4i   MAT5i   PVFi   XIi   HTKi   SDSi   AVRi   WAVEXi   SD2i   FLACi   CAFi   WVEi   OGGi    MPC2Ki  ! RF64i  " MP3i  # PCM_S8PCM_16PCM_24PCM_32PCM_U8FLOATDOUBLEULAWALAW	IMA_ADPCMMS_ADPCMGSM610	VOX_ADPCMNMS_ADPCM_16NMS_ADPCM_24NMS_ADPCM_32G721_32G723_24G723_40DWVW_12DWVW_16DWVW_24DWVW_NDPCM_8DPCM_16VORBISOPUSALAC_16ALAC_20ALAC_24ALAC_32MPEG_LAYER_IMPEG_LAYER_IIMPEG_LAYER_IIIFILELITTLEi   BIGi    CPUi   0float64doublefloat32floatint32intint16shortCONSTANTAVERAGEVARIABLEdarwin)machinelibsndfile_z.dylibwin32)architecture64bitzlibsndfile_x64.dll32bitzlibsndfile_x86.dllz%no packaged library for Windows {} {}linuxzlibsndfile_arm64.soz.soz%no packaged library for this platformsndfilez8sndfile library not found using ctypes.util.find_libraryzlibsndfile.dylibzlibsndfile.dllzlibsndfile.soarm64z/opt/homebrew/lib/z/usr/local/lib/utf-8replacezlibsndfile-c           
         \        V RWWW4      ;_uu_ 4       pVP                  W#V4      pVP                  WWVV4      pRRR4       XXP                  3#   + '       g   i     L; i)a  Provide audio data from a sound file as NumPy array.

By default, the whole file is read from the beginning, but the
position to start reading can be specified with *start* and the
number of frames to read can be specified with *frames*.
Alternatively, a range can be specified with *start* and *stop*.

If there is less data left in the file than requested, the rest of
the frames are filled with *fill_value*.
If no *fill_value* is specified, a smaller array is returned.

Parameters
----------
file : str or int or file-like object
    The file to read from.  See `SoundFile` for details.
frames : int, optional
    The number of frames to read. If *frames* is negative, the whole
    rest of the file is read.  Not allowed if *stop* is given.
start : int, optional
    Where to start reading.  A negative value counts from the end.
stop : int, optional
    The index after the last frame to be read.  A negative value
    counts from the end.  Not allowed if *frames* is given.
dtype : {'float64', 'float32', 'int32', 'int16'}, optional
    Data type of the returned array, by default ``'float64'``.
    Floating point audio data is typically in the range from
    ``-1.0`` to ``1.0``.  Integer data is in the range from
    ``-2**15`` to ``2**15-1`` for ``'int16'`` and from ``-2**31`` to
    ``2**31-1`` for ``'int32'``.

    .. note:: Reading int values from a float file will *not*
        scale the data to [-1.0, 1.0). If the file contains
        ``np.array([42.6], dtype='float32')``, you will read
        ``np.array([43], dtype='int32')`` for ``dtype='int32'``.

Returns
-------
audiodata : `numpy.ndarray` or type(out)
    A two-dimensional (frames x channels) NumPy array is returned.
    If the sound file has only one channel, a one-dimensional array
    is returned.  Use ``always_2d=True`` to return a two-dimensional
    array anyway.

    If *out* was specified, it is returned.  If *out* has more
    frames than available in the file (or if *frames* is smaller
    than the length of *out*) and no *fill_value* is given, then
    only a part of *out* is overwritten and a view containing all
    valid frames is returned.
samplerate : int
    The sample rate of the audio file.

Other Parameters
----------------
always_2d : bool, optional
    By default, reading a mono sound file will return a
    one-dimensional array.  With ``always_2d=True``, audio data is
    always returned as a two-dimensional array, even if the audio
    file has only one channel.
fill_value : float, optional
    If more frames are requested than available in the file, the
    rest of the output is be filled with *fill_value*.  If
    *fill_value* is not specified, a smaller array is returned.
out : `numpy.ndarray` or subclass, optional
    If *out* is specified, the data is written into the given array
    instead of creating a new array.  In this case, the arguments
    *dtype* and *always_2d* are silently ignored!  If *frames* is
    not given, it is obtained from the length of *out*.
samplerate, channels, format, subtype, endian, closefd
    See `SoundFile`.

Examples
--------
>>> import soundfile as sf
>>> data, samplerate = sf.read('stereo_file.wav')
>>> data
array([[ 0.71329652,  0.06294799],
       [-0.26450912, -0.38874483],
       ...
       [ 0.67398441, -0.11516333]])
>>> samplerate
44100

rN)	SoundFile_prepare_readread
samplerate)fileframesstartstopdtype	always_2d
fill_valueoutrm   channelsformatsubtypeendianclosefdfdatas   &&&&&&&&&&&&&&  a/Users/agent/.cache/uv/archive-v0/6ZL4-8mCcRNgGE9wi6M6J/lib/python3.14/site-packages/soundfile.pyrl   rl      sc    l 
4jF
5 
589f5vvfYC@
5 	
5 
5s   &AA$	c	                
   ^ RI p	V	P                  V4      pVP                  ^8X  d   ^p
MVP                  ^,          p
\	        V RW*W4WVWx4
      ;_uu_ 4       pVP                  V4       RRR4       R#   + '       g   i     R# ; i)a  Write data to a sound file.

.. note:: If *file* exists, it will be truncated and overwritten!

Parameters
----------
file : str or int or file-like object
    The file to write to.  See `SoundFile` for details.
data : array_like
    The data to write.  Usually two-dimensional (frames x channels),
    but one-dimensional *data* can be used for mono files.
    Only the data types ``'float64'``, ``'float32'``, ``'int32'``
    and ``'int16'`` are supported.

    .. note:: The data type of *data* does **not** select the data
              type of the written file. Audio data will be
              converted to the given *subtype*. Writing int values
              to a float file will *not* scale the values to
              [-1.0, 1.0). If you write the value ``np.array([42],
              dtype='int32')``, to a ``subtype='FLOAT'`` file, the
              file will then contain ``np.array([42.],
              dtype='float32')``.

samplerate : int
    The sample rate of the audio data.
subtype : str, optional
    See `default_subtype()` for the default value and
    `available_subtypes()` for all possible values.

Other Parameters
----------------
format, endian, closefd, compression_level, bitrate_mode
    See `SoundFile`.

Examples
--------
Write 10 frames of random data to a new file:

>>> import numpy as np
>>> import soundfile as sf
>>> sf.write('stereo_file.wav', np.random.randn(10, 2), 44100, 'PCM_24')

Nw)numpyasarrayndimshaperj   write)rn   r|   rm   rx   ry   rw   rz   compression_levelbitrate_modenprv   r{   s   &&&&&&&&&   r}   r   r   8  sq    Z ::dDyyA~::a=	4jF$
4 
478	
4 
4 
4 
4s   A11B	c              #     "   \        V RWWW4      ;_uu_ 4       pVP                  WEV4      pVP                  WVWgW4       F  pVx  K	  	  RRR4       R#   + '       g   i     R# ; i5i)a  Return a generator for block-wise reading.

By default, iteration starts at the beginning and stops at the end
of the file.  Use *start* to start at a later position and *frames*
or *stop* to stop earlier.

If you stop iterating over the generator before it's exhausted,
the sound file is not closed. This is normally not a problem
because the file is opened in read-only mode. To close the file
properly, the generator's ``close()`` method can be called.

Parameters
----------
file : str or int or file-like object
    The file to read from.  See `SoundFile` for details.
blocksize : int
    The number of frames to read per block.
    Either this or *out* must be given.
overlap : int, optional
    The number of frames to rewind between each block.

Yields
------
`numpy.ndarray` or type(out)
    Blocks of audio data.
    If *out* was given, and the requested frames are not an integer
    multiple of the length of *out*, and no *fill_value* was given,
    the last block will be a smaller view into *out*.

Other Parameters
----------------
frames, start, stop
    See `read()`.
dtype : {'float64', 'float32', 'int32', 'int16'}, optional
    See `read()`.
always_2d, fill_value, out
    See `read()`.
samplerate, channels, format, subtype, endian, closefd
    See `SoundFile`.

Examples
--------
>>> import soundfile as sf
>>> for block in sf.blocks('stereo_file.wav', blocksize=1024):
>>>     pass  # do something with 'block'

ri   N)rj   rk   blocks)rn   	blocksizeoverlapro   rp   rq   rr   rs   rt   ru   rm   rv   rw   rx   ry   rz   r{   blocks   &&&&&&&&&&&&&&&&  r}   r   r   q  sj     f 
4jF
5 
589f5XXi&#
AEKA
5 
5 
5 
5s   A*2A
A*A'	!	A*c                   @   a  ] tR tRt o RtR t]R 4       tR tRt	V t
R# )_SoundFileInfoi  zInformation about a SoundFilec                >   W n         \        V4      ;_uu_ 4       pVP                  V n        VP                  V n        VP                  V n        VP
                  V n        \        V P
                  4      VP                  ,          V n        VP                  V n        VP                  V n	        VP                  V n
        VP                  V n        VP                  V n        VP                  V n        VP                  V n        R R R 4       R #   + '       g   i     R # ; iN)verboserj   namerm   rv   ro   rT   durationrw   rx   ry   format_infosubtype_infosections
extra_info)selfrn   r   r{   s   &&& r}   __init___SoundFileInfo.__init__  s    t__DIllDOJJDM((DK!$++.q||;DM((DK99DL((DK }}D !DJJDMllDO ___s   C'DD	c                &   \        V P                  R 4      w  r\        V^<4      w  r4V^8  d   RP                  WV4      pV# V^8  d   RP                  W44      pV# V^8:  d   RP                  V P                  4      pV# RP                  V4      pV# )i  z{0:.0g}:{1:02.0g}:{2:05.3f} hz{0:02.0g}:{1:05.3f} minz{0:d} samplesz	{0:.3f} s)divmodr   rw   ro   )r   hoursrestminutessecondsr   s   &     r}   _duration_str_SoundFileInfo._duration_str  s    T]]D1!$+A:6==egVH  \077IH
 	 \&--dkk:H  #))'2H    c                    R P                  . RO4      pV P                  '       d   VR P                  . RO4      ,          pRP                  V P                  P                  R 4      4      pVP	                  W4      # )
)z{0.name}zsamplerate: {0.samplerate} Hzzchannels: {0.channels}zduration: {0._duration_str}z$format: {0.format_info} [{0.format}]z'subtype: {0.subtype_info} [{0.subtype}])z
endian: {0.endian}zsections: {0.sections}zframes: {0.frames}zextra_info: """z
    {1}"""z
    )joinr   r   splitrw   )r   infoindented_extra_infos   &  r}   __repr___SoundFileInfo.__repr__  sk    yy89 <<<DII   D  *//0E0Ed0KL{{455r   )rv   r   ry   r   rw   r   ro   r   rm   r   rx   r   r   N)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   __static_attributes____classdictcell____classdict__s   @r}   r   r     s+     '+   6 6r   r   c                    \        W4      # )zReturns an object with information about a `SoundFile`.

Parameters
----------
verbose : bool
    Whether to print additional information.
)r   )rn   r   s   &&r}   r   r     s     $((r   c                 d    \        \        \        P                  \        P                  4      4      # )au  Return a dictionary of available major formats.

Examples
--------
>>> import soundfile as sf
>>> sf.available_formats()
{'FLAC': 'FLAC (FLAC Lossless Audio Codec)',
 'OGG': 'OGG (OGG Container format)',
 'WAV': 'WAV (Microsoft)',
 'AIFF': 'AIFF (Apple/SGI)',
 ...
 'WAVEX': 'WAVEX (Microsoft)',
 'RAW': 'RAW (header-less)',
 'MAT5': 'MAT5 (GNU Octave 2.1 / Matlab 5.0)'}

)dict_available_formats_helper_sndSFC_GET_FORMAT_MAJOR_COUNTSFC_GET_FORMAT_MAJOR r   r}   available_formatsr     s-    " )$*I*I*.*C*CE F Fr   c                ~   a  \        \        P                  \        P                  4      p\	        V 3R lV 4       4      # )a4  Return a dictionary of available subtypes.

Parameters
----------
format : str
    If given, only compatible subtypes are returned.

Examples
--------
>>> import soundfile as sf
>>> sf.available_subtypes('FLAC')
{'PCM_24': 'Signed 24 bit PCM',
 'PCM_16': 'Signed 16 bit PCM',
 'PCM_S8': 'Signed 8 bit PCM'}

c              3   ^   <"   T F"  w  rSe   \        SV4      '       g   K  W3x  K$  	  R # 5ir   )check_format).0rx   r   rw   s   &  r}   	<genexpr>%available_subtypes.<locals>.<genexpr>  s+      DXMG>\&'%B  Xs   --)r   r   SFC_GET_FORMAT_SUBTYPE_COUNTSFC_GET_FORMAT_SUBTYPEr   )rw   subtypess   f r}   available_subtypesr      s>    " ))J)J)-)D)DFH DX D D Dr   c                ^     \        \        WV4      4      #   \        \        3 d     R# i ; i)zCheck if the combination of format/subtype/endian is valid.

Examples
--------
>>> import soundfile as sf
>>> sf.check_format('WAV', 'PCM_24')
True
>>> sf.check_format('FLAC', 'VORBIS')
False

F)bool_format_int
ValueError	TypeError)rw   rx   ry   s   &&&r}   r   r     s0    K899	" s    ,,c                ^    \        V 4       \        P                  V P                  4       4      # )zReturn the default subtype for a given format.

Examples
--------
>>> import soundfile as sf
>>> sf.default_subtype('WAV')
'PCM_16'
>>> sf.default_subtype('MAT5')
'DOUBLE'

)_check_format_default_subtypesgetupper)rw   s   &r}   default_subtyper   )  s#     &  00r   c                   \  a  ] tR tRt o RtR:R lt]! R 4      t ]! R 4      t ]! R 4      t	 ]! R 4      t
 ]! R	 4      t ]! R
 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]! R 4      t ]R 4       tRtR tR tR tR tR tR tR tR tR t R t!]"3R lt#R  t$R;R! lt%R<R" lt&R# t'R$ t(R% t)R=R& lt*R>R' lt+R( t,R) t-R* t.R+ t/R, t0R- t1R. t2R/ t3R0 t4R1 t5R2 t6R3 t7R4 t8R5 t9R6 t:R7 t;R8 t<R9t=V t>R# )?rj   i9  zA sound file.

For more documentation see the __init__() docstring (which is also
used for the online documentation (https://python-soundfile.readthedocs.io/).

Nc           	        \        VR4      '       d   VP                  4       MTpWn        Vf   \        VRR4      p\	        V4      pW n        Wn        Wn        \        WW4WuV4      V n	        V P                  WV4      V n        \        V4      P                  R4      '       d(   V P                  4       '       d   V P                  ^ 4       \         P#                  V P                  \         P$                  \&        P(                  \         P*                  4       V P                  eI   V P-                  V P                  4       V P                  e   V P/                  V P                  4       R# R# R# )aA  Open a sound file.

If a file is opened with `mode` ``'r'`` (the default) or
``'r+'``, no sample rate, channels or file format need to be
given because the information is obtained from the file. An
exception is the ``'RAW'`` data format, which always requires
these data points.

File formats consist of three case-insensitive strings:

* a *major format* which is by default obtained from the
  extension of the file name (if known) and which can be
  forced with the format argument (e.g. ``format='WAVEX'``).
* a *subtype*, e.g. ``'PCM_24'``. Most major formats have a
  default subtype which is used if no subtype is specified.
* an *endian-ness*, which doesn't have to be specified at all in
  most cases.

A `SoundFile` object is a *context manager*, which means
if used in a "with" statement, `close()` is automatically
called when reaching the end of the code block inside the "with"
statement.

Parameters
----------
file : str or int or file-like object
    The file to open.  This can be a file name, a file
    descriptor or a Python file object (or a similar object with
    the methods ``read()``/``readinto()``, ``write()``,
    ``seek()`` and ``tell()``).
mode : {'r', 'r+', 'w', 'w+', 'x', 'x+'}, optional
    Open mode.  Has to begin with one of these three characters:
    ``'r'`` for reading, ``'w'`` for writing (truncates *file*)
    or ``'x'`` for writing (raises an error if *file* already
    exists).  Additionally, it may contain ``'+'`` to open
    *file* for both reading and writing.
    The character ``'b'`` for *binary mode* is implied because
    all sound files have to be opened in this mode.
    If *file* is a file descriptor or a file-like object,
    ``'w'`` doesn't truncate and ``'x'`` doesn't raise an error.
samplerate : int
    The sample rate of the file.  If `mode` contains ``'r'``,
    this is obtained from the file (except for ``'RAW'`` files).
channels : int
    The number of channels of the file.
    If `mode` contains ``'r'``, this is obtained from the file
    (except for ``'RAW'`` files).
subtype : str, sometimes optional
    The subtype of the sound file.  If `mode` contains ``'r'``,
    this is obtained from the file (except for ``'RAW'``
    files), if not, the default value depends on the selected
    `format` (see `default_subtype()`).
    See `available_subtypes()` for all possible subtypes for
    a given `format`.
endian : {'FILE', 'LITTLE', 'BIG', 'CPU'}, sometimes optional
    The endian-ness of the sound file.  If `mode` contains
    ``'r'``, this is obtained from the file (except for
    ``'RAW'`` files), if not, the default value is ``'FILE'``,
    which is correct in most cases.
format : str, sometimes optional
    The major format of the sound file.  If `mode` contains
    ``'r'``, this is obtained from the file (except for
    ``'RAW'`` files), if not, the default value is determined
    from the file extension.  See `available_formats()` for
    all possible values.
closefd : bool, optional
    Whether to close the file descriptor on `close()`. Only
    applicable if the *file* argument is a file descriptor.
compression_level : float, optional
    The compression level on 'write()'. The compression level
    should be between 0.0 (minimum compression level) and 1.0
    (highest compression level).
    See `libsndfile document <https://github.com/libsndfile/libsndfile/blob/c81375f070f3c6764969a738eacded64f53a076e/docs/command.md>`__.
bitrate_mode : {'CONSTANT', 'AVERAGE', 'VARIABLE'}, optional
    The bitrate mode on 'write()'. 
    See `libsndfile document <https://github.com/libsndfile/libsndfile/blob/c81375f070f3c6764969a738eacded64f53a076e/docs/command.md>`__.

Examples
--------
>>> from soundfile import SoundFile

Open an existing file for reading:

>>> myfile = SoundFile('existing_file.wav')
>>> # do something with myfile
>>> myfile.close()

Create a new sound file for reading and writing using a with
statement:

>>> with SoundFile('new_file.wav', 'x+', 44100, 2) as myfile:
>>>     # do something with myfile
>>>     # ...
>>>     assert not myfile.closed
>>>     # myfile.close() is called automatically at the end
>>> assert myfile.closed


__fspath__Nmodezr+)hasattrr   _namegetattr_check_mode_mode_compression_level_bitrate_mode_create_info_struct_info_open_fileset
issupersetseekableseekr   
sf_commandSFC_SET_CLIPPING_ffiNULLSF_TRUE_set_compression_level_set_bitrate_mode)r   rn   r   rm   rv   rx   ry   rw   rz   r   r   mode_ints   &&&&&&&&&&& r}   r   SoundFile.__init__A  s   N %,D,$?$?t T
<4.Dt$
"3)(Z)/&B
ZZ8
t9%%$--//IIaL

D$9$9499	& "".''(?(?@!!-&&t'9'9: . /r   c                    V P                   # r   )r   r   s   &r}   <lambda>SoundFile.<lambda>      r   c                    V P                   # r   )r   r   s   &r}   r   r     r   r   c                .    V P                   P                  # r   )r   rm   r   s   &r}   r   r     s    tzz'<'<r   c                .    V P                   P                  # r   r   ro   r   s   &r}   r   r     s    4::#4#4r   c                .    V P                   P                  # r   )r   rv   r   s   &r}   r   r         TZZ%8%8r   c                j    \        V P                  P                  \        P                  ,          4      # r   )_format_strr   rw   r   SF_FORMAT_TYPEMASKr   s   &r}   r   r     s    [!2!2T5L5L!LMr   c                j    \        V P                  P                  \        P                  ,          4      # r   )r   r   rw   r   SF_FORMAT_SUBMASKr   s   &r}   r   r         [!2!2T5K5K!KLr   c                j    \        V P                  P                  \        P                  ,          4      # r   )r   r   rw   r   SF_FORMAT_ENDMASKr   s   &r}   r   r     r   r   c                x    \        V P                  P                  \        P                  ,          4      ^,          #    )_format_infor   rw   r   r   r   s   &r}   r   r     s+    \$**"3"3"&"9"9#: ;;<>r   c                x    \        V P                  P                  \        P                  ,          4      ^,          # r  )r  r   rw   r   r   r   s   &r}   r   r     s+    \$**"3"3"&"8"8#9 ::;=r   c                .    V P                   P                  # r   )r   r   r   s   &r}   r   r     r   r   c                    V P                   R J # r   )r   r   s   &r}   r   r     s    4::#5r   c                @    \         P                  V P                  4      # r   )r   sf_errorr   r   s   &r}   r   r     s    t}}TZZ'@r   c                    V P                   # r   )r   r   s   &r}   r   r     s
    d.E.Er   c                    V P                   # r   )r   r   s   &r}   r   r     s
    ););r   c                   \         P                  ! RR4      p\        P                  V P                  \        P
                  V\         P                  ! V4      4       \         P                  ! V4      P                  RR4      # )z8Retrieve the log string generated when opening the file.zchar[]rf   rg   i @  )	r   newr   r   r   SFC_GET_LOG_INFOsizeofstringdecode)r   r   s   & r}   r   SoundFile.extra_info  sX     xx%(

D$9$9dkk$/	1{{4 '';;r   c                    V P                   e   RP                  V P                   4      MRpTV P                  e   RP                  V P                  4      MR,          pRP                  W4      # )Nz, compression_level={0} z, bitrate_mode='{0}'zSoundFile({0.name!r}, mode={0.mode!r}, samplerate={0.samplerate}, channels={0.channels}, format={0.format!r}, subtype={0.subtype!r}, endian={0.endian!r}{1}))r   rw   r   )r   compression_settings   & r}   r   SoundFile.__repr__  st    "&"8"8"D  9??@V@VWJL 	#'#4#4#@ !7 = =d>O>O PFH	J* +1&*K	Mr   c                &    V P                  4        R # r   closer   s   &r}   __del__SoundFile.__del__      

r   c                    V # r   r   r   s   &r}   	__enter__SoundFile.__enter__  s    r   c                &    V P                  4        R # r   r  )r   argss   &*r}   __exit__SoundFile.__exit__  r  r   c                    V\         9   dX   V P                  4        \        P                  V P                  \         V,          VP                  4       4      p\        V4       R# \        P                  WV4       R# )z:Write text meta-data in the sound file through properties.N)	
_str_types_check_if_closedr   sf_set_stringr   encode_error_checkobject__setattr__)r   r   valueerrs   &&& r}   r-  SoundFile.__setattr__  sT    :!!#$$TZZD1A%*\\^5Ct51r   c                "   V\         9   dl   V P                  4        \        P                  V P                  \         V,          4      pV'       d'   \
        P                  ! V4      P                  RR4      # R# \        RP                  V4      4      h)z9Read text meta-data in the sound file through properties.rf   rg   r  z)'SoundFile' object has no attribute {0!r})
r'  r(  r   sf_get_stringr   r   r  r  AttributeErrorrw   )r   r   r|   s   && r}   __getattr__SoundFile.__getattr__  sq    :!!#%%djj*T2BCDCG4;;t$++GY?ORO ;BB4HJ Jr   c                .    V P                   P                  # r   r   r   s   &r}   __len__SoundFile.__len__  s     zz   r   c                    R # )Tr   r   s   &r}   __bool__SoundFile.__bool__  s     r   c                "    V P                  4       # r   )r:  r   s   &r}   __nonzero__SoundFile.__nonzero__"  s     }}r   c                P    V P                   P                  \        P                  8H  # )z)Return True if the file supports seeking.)r   r   r   r   r   s   &r}   r   SoundFile.seekable'  s    zz""dll22r   c                    V P                  4        \        P                  V P                  W4      p\	        V P
                  4       V# )a  Set the read/write position.

Parameters
----------
frames : int
    The frame index or offset to seek.
whence : {SEEK_SET, SEEK_CUR, SEEK_END}, optional
    By default (``whence=SEEK_SET``), *frames* are counted from
    the beginning of the file.
    ``whence=SEEK_CUR`` seeks from the current position
    (positive and negative values are allowed for *frames*).
    ``whence=SEEK_END`` seeks from the end (use negative value
    for *frames*).

Returns
-------
int
    The new absolute read/write position in frames.

Examples
--------
>>> from soundfile import SoundFile, SEEK_END
>>> myfile = SoundFile('stereo_file.wav')

Seek to the beginning of the file:

>>> myfile.seek(0)
0

Seek to the end of the file:

>>> myfile.seek(0, SEEK_END)
44100  # this is the file length

)r(  r   sf_seekr   r+  
_errorcode)r   ro   whencepositions   &&& r}   r   SoundFile.seek+  s6    H 	<<

F;T__%r   c                .    V P                  ^ \        4      # )z'Return the current read/write position.)r   r   r   s   &r}   tellSoundFile.tellT  s    yyH%%r   c                    Vf%   V P                  W4      pV P                  WV4      pM"V^ 8  g   V\        V4      8  d   \        V4      pV P                  RWQ4      p\        V4      V8  d   Vf   VRV pV# WEVR% V# )a
  Read from the file and return data as NumPy array.

Reads the given number of frames in the given data format
starting at the current read/write position.  This advances the
read/write position by the same number of frames.
By default, all frames from the current read/write position to
the end of the file are returned.
Use `seek()` to move the current read/write position.

Parameters
----------
frames : int, optional
    The number of frames to read. If ``frames < 0``, the whole
    rest of the file is read.
dtype : {'float64', 'float32', 'int32', 'int16'}, optional
    Data type of the returned array, by default ``'float64'``.
    Floating point audio data is typically in the range from
    ``-1.0`` to ``1.0``. Integer data is in the range from
    ``-2**15`` to ``2**15-1`` for ``'int16'`` and from
    ``-2**31`` to ``2**31-1`` for ``'int32'``.

    .. note:: Reading int values from a float file will *not*
        scale the data to [-1.0, 1.0). If the file contains
        ``np.array([42.6], dtype='float32')``, you will read
        ``np.array([43], dtype='int32')`` for
        ``dtype='int32'``.

Returns
-------
audiodata : `numpy.ndarray` or type(out)
    A two-dimensional NumPy (frames x channels) array is
    returned. If the sound file has only one channel, a
    one-dimensional array is returned. Use ``always_2d=True``
    to return a two-dimensional array anyway.

    If *out* was specified, it is returned. If *out* has more
    frames than available in the file (or if *frames* is
    smaller than the length of *out*) and no *fill_value* is
    given, then only a part of *out* is overwritten and a view
    containing all valid frames is returned.

Other Parameters
----------------
always_2d : bool, optional
    By default, reading a mono sound file will return a
    one-dimensional array. With ``always_2d=True``, audio data
    is always returned as a two-dimensional array, even if the
    audio file has only one channel.
fill_value : float, optional
    If more frames are requested than available in the file,
    the rest of the output is be filled with *fill_value*. If
    *fill_value* is not specified, a smaller array is
    returned.
out : `numpy.ndarray` or subclass, optional
    If *out* is specified, the data is written into the given
    array instead of creating a new array. In this case, the
    arguments *dtype* and *always_2d* are silently ignored! If
    *frames* is not given, it is obtained from the length of
    *out*.

Examples
--------
>>> from soundfile import SoundFile
>>> myfile = SoundFile('stereo_file.wav')

Reading 3 frames from a stereo file:

>>> myfile.read(3)
array([[ 0.71329652,  0.06294799],
       [-0.26450912, -0.38874483],
       [ 0.67398441, -0.11516333]])
>>> myfile.close()

See Also
--------
buffer_read, .write

Nrl   )_check_frames_create_empty_arraylen	_array_io)r   ro   rr   rs   rt   ru   s   &&&&&&r}   rl   SoundFile.readX  s    ` ;'';F**6eDCzVc#h.S4s8f!'6l 
  *FG
r   c                   V P                  VRR7      pV P                  V4      p\        P                  ! VR,           WP                  ,          4      pV P                  RWCV4      pWQ8X  g   Q h\        P                  ! V4      # )a  Read from the file and return data as buffer object.

Reads the given number of *frames* in the given data format
starting at the current read/write position.  This advances the
read/write position by the same number of frames.
By default, all frames from the current read/write position to
the end of the file are returned.
Use `seek()` to move the current read/write position.

Parameters
----------
frames : int, optional
    The number of frames to read. If ``frames < 0``, the whole
    rest of the file is read.
dtype : {'float64', 'float32', 'int32', 'int16'}
    Audio data will be converted to the given data type.

Returns
-------
buffer
    A buffer containing the read data.

See Also
--------
buffer_read_into, .read, buffer_write

N)rt   z[]rl   )rK  _check_dtyper   r  rv   	_cdata_iobuffer)r   ro   rr   ctypecdataread_framess   &&&   r}   buffer_readSoundFile.buffer_read  sq    8 ##Ft#<!!%(v'=>nnVU6B$$${{5!!r   c                t    V P                  V4      pV P                  W4      w  rEV P                  RWCV4      pV# )a  Read from the file into a given buffer object.

Fills the given *buffer* with frames in the given data format
starting at the current read/write position (which can be
changed with `seek()`) until the buffer is full or the end
of the file is reached.  This advances the read/write position
by the number of frames that were read.

Parameters
----------
buffer : writable buffer
    Audio frames from the file are written to this buffer.
dtype : {'float64', 'float32', 'int32', 'int16'}
    The data type of *buffer*.

Returns
-------
int
    The number of frames that were read from the file.
    This can be less than the size of *buffer*.
    The rest of the buffer is not filled with meaningful data.

See Also
--------
buffer_read, .read

rl   )rQ  _check_bufferrR  )r   rS  rr   rT  rU  ro   s   &&&   r}   buffer_read_intoSoundFile.buffer_read_into  s=    8 !!%(**69f=r   c                    ^ RI pVP                  V4      pV P                  RV\        V4      4      pV\        V4      8X  g   Q hV P	                  V4       R# )a  Write audio data from a NumPy array to the file.

Writes a number of frames at the read/write position to the
file. This also advances the read/write position by the same
number of frames and enlarges the file if necessary.

Note that writing int values to a float file will *not* scale
the values to [-1.0, 1.0). If you write the value
``np.array([42], dtype='int32')``, to a ``subtype='FLOAT'``
file, the file will then contain ``np.array([42.],
dtype='float32')``.

Parameters
----------
data : array_like
    The data to write. Usually two-dimensional (frames x
    channels), but one-dimensional *data* can be used for mono
    files. Only the data types ``'float64'``, ``'float32'``,
    ``'int32'`` and ``'int16'`` are supported.

    .. note:: The data type of *data* does **not** select the
          data type of the written file. Audio data will be
          converted to the given *subtype*. Writing int values
          to a float file will *not* scale the values to
          [-1.0, 1.0). If you write the value ``np.array([42],
          dtype='int32')``, to a ``subtype='FLOAT'`` file, the
          file will then contain ``np.array([42.],
          dtype='float32')``.

Examples
--------
>>> import numpy as np
>>> from soundfile import SoundFile
>>> myfile = SoundFile('stereo_file.wav')

Write 10 frames of random data to a new file:

>>> with SoundFile('stereo_file.wav', 'w', 44100, 2, 'PCM_24') as f:
>>>     f.write(np.random.randn(10, 2))

See Also
--------
buffer_write, .read

Nr   )r   ascontiguousarrayrN  rM  _update_frames)r   r|   r   writtens   &&  r}   r   SoundFile.write  sP    \ 	 ##D)..$D	:#d)###G$r   c                    V P                  V4      pV P                  W4      w  rEV P                  RWCV4      pWe8X  g   Q hV P                  V4       R# )a  Write audio data from a buffer/bytes object to the file.

Writes the contents of *data* to the file at the current
read/write position.
This also advances the read/write position by the number of
frames that were written and enlarges the file if necessary.

Parameters
----------
data : buffer or bytes
    A buffer or bytes object containing the audio data to be
    written.
dtype : {'float64', 'float32', 'int32', 'int16'}
    The data type of the audio data stored in *data*.

See Also
--------
.write, buffer_read

r   N)rQ  rZ  rR  r_  )r   r|   rr   rT  rU  ro   r`  s   &&&    r}   buffer_writeSoundFile.buffer_write0  sR    * !!%(**47..%?   G$r   c           	   #    "   ^ RI pRV P                  9  d   RV P                  9  d   \        R4      hV P                  W64      pVf6   Vf   \	        R4      hVe   TM
\        W4      p	V P                  WV4      pRp
MVe   \	        R4      h\        V4      pRp
RpV^ 8  d   Vf   ^ pM\        V4      pWRV% \        W,
          V4      pV P                  WWVW|R 4       V'       d"   Vf   VP                  Wr) R 4      pMWr) R VR	&   WV,           8  d   Vf   VRW2,            pMTpV
'       d   VP                  V4      MTx  W=,          pK  R# 5i)
a  Return a generator for block-wise reading.

By default, the generator yields blocks of the given
*blocksize* (using a given *overlap*) until the end of the file
is reached; *frames* can be used to stop earlier.

Parameters
----------
blocksize : int
    The number of frames to read per block. Either this or *out*
    must be given.
overlap : int, optional
    The number of frames to rewind between each block.
frames : int, optional
    The number of frames to read.
    If ``frames < 0``, the file is read until the end.
dtype : {'float64', 'float32', 'int32', 'int16'}, optional
    See `read()`.

Yields
------
`numpy.ndarray` or type(out)
    Blocks of audio data.
    If *out* was given, and the requested frames are not an
    integer multiple of the length of *out*, and no
    *fill_value* was given, the last block will be a smaller
    view into *out*.


Other Parameters
----------------
always_2d, fill_value, out
    See `read()`.
fill_value : float, optional
    See `read()`.
out : `numpy.ndarray` or subclass, optional
    If *out* is specified, the data is written into the given
    array instead of creating a new array. In this case, the
    arguments *dtype* and *always_2d* are silently ignored!

Examples
--------
>>> from soundfile import SoundFile
>>> with SoundFile('stereo_file.wav') as f:
>>>     for block in f.blocks(blocksize=1024):
>>>         pass  # do something with 'block'

Nri   +z*blocks() is not allowed in write-only modez)One of {blocksize, out} must be specifiedTz-Only one of {blocksize, out} may be specifiedFNNN)
r   r   SoundFileRuntimeErrorrK  r   minrL  rM  rl   copy)r   r   r   ro   rr   rs   rt   ru   r   out_sizecopy_outoverlap_memoryoutput_offsettoreadr   s   &&&&&&&&       r}   r   SoundFile.blocksK  sc    d 	diiCtyy$8'(TUU##F7;  KLL$.$:yI@VH**8FCH$CE ECIHqj% ! #N 3&4N]#2F;FIIfYC<OP!)%'WWS^%<N(+HIN1%G++
0B-V-.$,"''%.%7F+ s   D-E0!Ec                f   Vf   V P                  4       p\        P                  V P                  \        P                  \
        P                  ! RV4      \
        P                  ! R4      4      pV'       d,   \        P                  V P                  4      p\        VR4      hWP                  n        R# )a.  Truncate the file to a given number of frames.

After this command, the read/write position will be at the new
end of the file.

Parameters
----------
frames : int, optional
    Only the data before *frames* is kept, the rest is deleted.
    If not specified, the current read/write position is used.

Nzsf_count_t*
sf_count_tzError truncating the file)rH  r   r   r   SFC_FILE_TRUNCATEr   r  r  r  LibsndfileErrorr   ro   )r   ro   r/  s   && r}   truncateSoundFile.truncate  sy     >YY[Foodjj$*@*@"hh}f="kk,79 --

+C!#'BCC"

r   c                d    V P                  4        \        P                  V P                  4       R# )a:  Write unwritten data to the file system.

Data written with `write()` is not immediately written to
the file system but buffered in memory to be written at a later
time.  Calling `flush()` makes sure that all changes are
actually written to the file system.

This has no effect on files opened in read-only mode.

N)r(  r   sf_write_syncr   r   s   &r}   flushSoundFile.flush  s"     	4::&r   c                    V P                   '       gD   V P                  4        \        P                  V P                  4      pRV n        \        V4       R# R# )z.Close the file.  Can be called multiple times.N)closedry  r   sf_closer   r+  )r   r/  s   & r}   r  SoundFile.close  s:    {{{JJL--

+CDJ r   c                0   \        V\        \        34      '       EdW   \        P                  P                  V4      '       d   RV P                  9   d%   \        RP                  V P                  4      4      h\        V P                  4      P                  R4      '       dO   \        P                  ! \        P                  ! V\        P                  \        P                  ,          4      4       \         P"                  p\        V\        4      '       dK   \$        P&                  R8X  d   \         P(                  pM$VP+                  \$        P,                  ! 4       4      pV! WV P.                  4      pM\        V\0        4      '       d#   \         P3                  WV P.                  V4      pMt\5        W4      '       d@   \         P7                  V P9                  V4      W P.                  \:        P<                  4      pM$\?        RP                  V P                  4      4      hV\:        P<                  8X  d<   \         PA                  V4      p\C        VRP                  V P                  4      R7      hV\         PD                  8X  d   ^ V P.                  n#        V# )z9Call the appropriate sf_open*() function from libsndfile.xzFile exists: {0!r}zw+r_   zInvalid file: {0!r}zError opening {0!r}: prefix)$
isinstance_unicodebytes_ospathisfiler   OSErrorrw   r   r   r   r  openO_WRONLYO_TRUNCr   sf_open_sysplatformsf_wchar_openr*  getfilesystemencodingr   rV   
sf_open_fd_has_virtual_io_attrssf_open_virtual_init_virtual_ior   r   r   r  rt  	SFM_WRITEro   )r   rn   r   rz   openfunctionfile_ptrr/  s   &&&&   r}   r   SoundFile._open  s   dXu-..xxt$$$))#!"6"="=dii"HII^..t44IIchhtS\\CKK-GHI<<L$))==G+#'#5#5L;;t'A'A'CDD#DDJJ?Hc""ttzz7KH"422++D,A,A$,G,4jj$))MH 188CDDtyy --)C!#.E.L.LTYY.WXXt~~% !"DJJ r   c           
       a \         P                  ! R4      V3R l4       p\         P                  ! R4      V3R l4       p\         P                  ! R4      V3R l4       p\         P                  ! R4      V3R l4       p\         P                  ! R	4      V3R
 l4       pRVRVRVRVRV/V n        \         P                  ! RV P                  4      # )z4Initialize callback functions for sf_open_virtual().sf_vio_get_filelenc                    < SP                  4       pSP                  ^ \        4       SP                  4       pSP                  V\        4       V#     )rH  r   r   r   )	user_datacurrsizern   s   &  r}   vio_get_filelen3SoundFile._init_virtual_io.<locals>.vio_get_filelen  s:    99;DIIa"99;DIIdH%Kr   sf_vio_seekc                 F   < SP                  W4       SP                  4       # r   )r   rH  )offsetrD  r  rn   s   &&&r}   vio_seek,SoundFile._init_virtual_io.<locals>.vio_seek  s    IIf%99;r   sf_vio_readc                    <  \         P                  ! W4      pSP                  V4      pV#   \         d;    SP	                  T4      p\        T4      p\         P                  ! Y4      pYS^ T%  T# i ; ir  )r   rS  readintor3  rl   rM  )ptrcountr  buf	data_readr|   rn   s   &&&   r}   vio_read,SoundFile._init_virtual_io.<locals>.vio_read
  sr    (kk#- MM#.	  " (yy'I	kk#1#'Ai (s   ', AA10A1sf_vio_writec                 t   < \         P                  ! W4      pVR ,          pSP                  V4      pVf   TpV# )rg  )r   rS  r   )r  r  r  r  r|   r`  rn   s   &&&   r}   	vio_write-SoundFile._init_virtual_io.<locals>.vio_write  s7    ++c)Cq6Djj&GNr   sf_vio_tellc                 $   < SP                  4       # r   )rH  )r  rn   s   &r}   vio_tell,SoundFile._init_virtual_io.<locals>.vio_tell!  s    99;r   get_filelenr   rl   r   rH  zSF_VIRTUAL_IO*)r   callback_virtual_ior  )r   rn   r  r  r  r  r  s   &f     r}   r  SoundFile._init_virtual_io  s    	+	,	 
-	 
}	%	 
&	 
}	%
	 
&
	 
~	&	 
'	 
}	%	 
&	 *?"H"H#Y"H	. xx($*:*:;;r   c                    \         # )zpReturn all attributes used in __setattr__ and __getattr__.

This is useful for auto-completion (e.g. IPython).

)r'  r   s   &r}   _getAttributeNamesSoundFile._getAttributeNames.  s
     r   c                @    V P                   '       d   \        R4      hR# )zuCheck if the file is closed and raise an error if it is.

This should be used in every method that uses self._file.

zI/O operation on closed fileN)r|  rh  r   s   &r}   r(  SoundFile._check_if_closed6  s     ;;;'(FGG r   c                    V P                  4       '       d7   V P                  V P                  4       ,
          pV^ 8  g   W8  d   Vf   TpV# V^ 8  d   \        R4      hV# )z8Reduce frames to no more than are available in the file.z/frames must be specified for non-seekable files)r   ro   rH  r   )r   ro   rt   remaining_framess   &&& r}   rK  SoundFile._check_frames?  sZ    ==??#{{TYY[8zf7(0)  aZNOOr   c                4   V\         P                  4       9   g   Q h\        V\        4      '       g   \        P
                  ! V4      p\        \        V4      V P                  \        P                  ! V4      ,          4      w  r4V'       d   \        R4      hW3# )z1Convert buffer to cdata and check for valid size.z*Data size must be a multiple of frame size)
_ffi_typesvaluesr  r  r   from_bufferr   rM  rv   r  r   )r   r|   rT  ro   	remainders   &&&  r}   rZ  SoundFile._check_bufferJ  sv    
))++++$&&##D)D"3t9#'==4;;u3E#EGIJJ|r   c                    ^ RI pV'       g   V P                  ^8  d   WP                  3pMV3pVP                  WSRR7      # )z-Create an empty array with appropriate shape.NC)order)r   rv   empty)r   ro   rs   rr   r   r   s   &&&&  r}   rL  SoundFile._create_empty_arrayU  s9    )MM)EGExxCx00r   c           	          \         V,          #   \         d8    \        RP                  \	        \         P                  4       4      T4      4      hi ; i)z7Check if dtype string is valid and return ctype string.z(dtype must be one of {0!r} and not {1!r})r  KeyErrorr   rw   sortedkeys)r   rr   s   &&r}   rQ  SoundFile._check_dtype^  sM    	3e$$ 	3GNNz()52 3 3	3s
    AAc                   VP                   R9  dA   \        RP                  VP                  VP                   ^8  d   R4      4      hR4      4      hVP                   ^8X  d   ^MVP                  ^,          pW@P                  8w  d1   \        RP                  VP                  V P                  V4      4      hVP
                  P                  '       g   \        R4      hV P                  VP                  P                  4      pVP                  P                  \        P                  ! V4      8X  g   Q h\        P                  ! VR,           VP                  R,          ^ ,          4      pV P                  WWS4      # )	z+Check array and call low-level IO function.zInvalid shape: {0!r} ({1})z0 dimensions not supportedztoo many dimensionsz5Invalid shape: {0!r} (Expected {1} channels, got {2})zData must be C-contiguous*r|   )r     )r   r   rw   r   rv   flagsc_contiguousrQ  rr   r   itemsizer   r  cast__array_interface__rR  )r   actionarrayro   array_channelsrT  rU  s   &&&&   r}   rN  SoundFile._array_iof  sC   ::U"9@@nsnxnx{|n|Nj  Y  Z  Z  CX  Y  Z  Z#jjAo5;;q>]]*T[[\a\g\gimiviv  yG  H  I  I{{'''899!!%++"2"23{{##t{{5'9999		%#+u'@'@'H'KL~~fU;;r   c                   V\         P                  4       9   g   Q hV P                  4        V P                  4       '       d   V P	                  4       p\        \        RV,           R,           V,           4      pV! V P                  W$4      p\        V P                  4       V P                  4       '       d   V P                  XV,           \        4       V# )z.Call one of libsndfile's read/write functions.sf_f_)r  r  r(  r   rH  r   r   r   r+  rC  r   r   )r   r  r|   rT  ro   r  funcs   &&&&&  r}   rR  SoundFile._cdata_iot  s    
))++++==??99;DtUV^d2U:;djj$/T__%==??IIdVmX.r   c                   V P                  4       '       dN   V P                  4       pV P                  ^ \        4      V P                  n        V P                  V\        4       R# V P                  ;P
                  V,          un        R# )z!Update self.frames after writing.N)r   rH  r   r   r   ro   r   )r   r`  r  s   && r}   r_  SoundFile._update_frames  sR    ==??99;D $		!X 6DJJIIdH%JJ(r   c                V   V^ 8w  d"   V P                  4       '       g   \        R4      hV^ 8  d   Ve   \        R4      h\        W4      P	                  V P
                  4      w  rpW!8  d   TpV^ 8  d	   W!,
          pV P                  4       '       d   V P                  V\        4       V# )z)Seek to start frame and calculate length.z(start is only allowed for seekable filesz&Only one of {frames, stop} may be used)r   r   r   sliceindicesro   r   r   )r   rp   rq   ro   _s   &&&& r}   rk   SoundFile._prepare_read  s    A:dmmooGHHQ;4+DEEu+33DKK@Q<DA:\F==??IIeX&r   c                    / p\         P                  4        FW  w  r#\        P                  V P                  V4      pV'       g   K/  \
        P                  ! V4      P                  RR4      W&   KY  	  V# )zGet all metadata present in this SoundFile

Returns
-------

metadata: dict[str, str]
    A dict with all metadata. Possible keys are: 'title', 'copyright',
    'software', 'artist', 'comment', 'date', 'album', 'license',
    'tracknumber' and 'genre'.
rf   rg   )r'  itemsr   r2  r   r   r  r  )r   strsstrtypestridr|   s   &    r}   copy_metadataSoundFile.copy_metadata  s]     (..0NG%%djj%8Dt $D 1 8 8) L 1 r   c                z   V\         9   g   Q h\        P                  ! R4      p\         V,          V^ &   \        P	                  V P
                  \        P                  V\        P                  ! V4      4      pV\        P                  8w  d/   \        P                  V P
                  4      p\        VRV 24      hR# )z,Call libsndfile's set bitrate mode function.zint[1]zError set bitrate mode N)_bitrate_modesr   r  r   r   r   SFC_SET_BITRATE_MODEr  r   r  rt  )r   r   pointer_bitrate_moder/  s   &&  r}   r   SoundFile._set_bitrate_mode  s    ~---#xx1"0">Qoodjj$*C*CEY[_[f[fg{[|}$,,--

+C!#)@'OPP r   c                   ^ Tu;8:  d   ^8:  g   M \        R4      h\        P                  ! R4      pW^ &   \        P	                  V P
                  \        P                  V\        P                  ! V4      4      pV\        P                  8w  d/   \        P                  V P
                  4      p\        VRV 24      hR# )z1Call libsndfile's set compression level function.z)Compression level must be in range [0..1]z	double[1]zError set compression level N)r   r   r  r   r   r   SFC_SET_COMPRESSION_LEVELr  r   r  rt  )r   r   pointer_compression_levelr/  s   &&  r}   r    SoundFile._set_compression_level  s    &+!+HII$(HH[$9!'8!$oodjj$*H*HJceiepep  rK  fL  M$,,--

+C!#)EFWEX'YZZ r   )r   r   r   r   r   r   r  )	ri   NNNNNTNN)rQ   FNN)r  N)Nr  r  rQ   FNNr   )?r   r   r   r   r   r   r   r   r   rm   ro   rv   rw   rx   ry   r   r   r   r|  rC  r   r   r   r   r   r  r   r$  r-  r4  r7  r:  r=  r   r   r   rH  rl   rW  r[  r   rc  r   ru  ry  r  r   r  r  r(  rK  rZ  rL  rQ  rN  rR  r_  rk   r  r   r   r   r   r   s   @r}   rj   rj   9  s    };~ +,D*+,D7<=J,45F189H3MOF-LNG4LNF8	>?K ?	=>L :89H356F2@AJ' !EF,;<L'< < EM2J!


3 #+ 'R&\|!"FB4%l%6[z#0'"H1<fH		13<) $	Q
[ 
[r   rj   c                ,    V ^ 8w  d   \        WR7      hR# )z+Raise LibsndfileError if there is an error.r  N)rt  )r/  r  s   &&r}   r+  r+    s    
axc11 r   c                :   \        V 4      pVf+   \        V 4      pVf   \        RP                  V 4      4      hM6\	        V\
        \        34      '       g   \        RP                  V4      4      h V\        VP                  4       ,          ,          pTf   RpM6\	        T\
        \        34      '       g   \        RP                  T4      4      h T\        TP                  4       ,          ,          p\        P                  ! R4      pY4n        ^Tn        \        P!                  T4      \        P"                  8X  d   \        R4      hT#   \         d    \        RP                  T4      4      hi ; i  \         d    \        RP                  T4      4      hi ; i)	z8Return numeric ID for given format|subtype|endian combo.z)No default subtype for major format {0!r}zInvalid subtype: {0!r}zUnknown subtype: {0!r}rM   zInvalid endian-ness: {0!r}zUnknown endian-ness: {0!r}SF_INFO*z1Invalid combination of format, subtype and endian)r   r   r   rw   r  r  str	_subtypesr   r  r   _endiansr   r  rv   r   sf_format_checkSF_FALSE)rw   rx   ry   resultr   s   &&&  r}   r   r     ss   6"F!&)?;BB6JL L  (C11077@AAC)GMMO,, ~3004;;FCDDF(6<<>** 88JDKDMD!T]]2?A 	AM#  C188ABBC  F5<<VDEEFs   1"E "E4 &E14&Fc                   \        V \        \        34      '       g   \        RP	                  V 4      4      h\        V 4      pVP                  R4      '       g   \        V 4      \        V4      8  d   \        RP	                  V 4      4      h\        VP                  R4      4      ^8w  d   \        R4      hRV9   d   \        P                  pV# RV9   d   \        P                  pV# \        P                  pV# )z=Check if mode is valid and return its integer representation.zInvalid mode: {0!r}zxrwb+xrwz&mode must contain exactly one of 'xrw'rf  ri   )r  r  r  r   rw   r   
differencerM  r   intersectionr   SFM_RDWRSFM_READr  )r   mode_setr   s   &  r}   r   r     s    dXsO,,-44T:;;4yH7##s4y3x='@.55d;<<
8  '(A-ABB
h==
 O	 
== O >>Or   c                   TpVf+   \        W4      p\        V\        \        34      '       g   Q hM\	        V4       \
        P                  ! R4      pRV9  g   VP                  4       R8X  d>   Vf   \        R4      hW(n	        Vf   \        R4      hW8n
        \        WEV4      Vn        V# \        ;QJ d    R W#WuV3 4       F  '       g   K   RM	  RM! R W#WuV3 4       4      '       d   \        R	4      hV# )
z*Check arguments and create SF_INFO struct.r  ri   r   zsamplerate must be specifiedzchannels must be specifiedc              3   (   "   T F  qR Jx  K
  	  R # 5ir   r   )r   args   & r}   r   &_create_info_struct.<locals>.<genexpr>  s      I +H3$ +Hs   TFz\Not allowed for existing files (except 'RAW'): samplerate, channels, format, subtype, endian)_get_format_from_filenamer  r  r  r   r   r  r   r   rm   rv   r   rw   any)	rn   r   rm   rv   rw   rx   ry   original_formatr   s	   &&&&&&&  r}   r   r     s    O~*46&8S/2222f88JD
$&,,.E1:;;$899 !&6: K	 3 Io+H I333 Io+H I I I L M MKr   c                :   Rp\        V RV 4      p  \        P                  P                  V 4      R,          R,          pVP	                  RR4      pVP                  4       \        9  d"   RV9  d   \        RP                  V 4      4      hV#   \
         d     LIi ; i)	a  Return a format string obtained from file (or file.name).

If file already exists (= read mode), an empty string is returned on
error.  If not, an exception is raised.
The return type will always be str or unicode (even if
file/file.name is a bytes object).

r  r   :r  NNrf   rg   ri   zGNo format specified and unable to get format from file extension: {0!r}r  )
r   r  r  splitextr  	Exceptionr   _formatsr   rw   )rn   r   rw   s   && r}   r  r    s     F4&D""4(,R0w	2 ||~X%#T/ 006t> 	>M  s   ?B BBc                    \         \        \        3 F(  pVP                  4        F  w  r#W08X  g   K  Vu u # 	  K*  	  R# )z;Return the string representation of a given numeric format.zn/a)r  r  r  r  )
format_int
dictionarykvs   &   r}   r   r   1  s7    	83
$$&DA ' 4
 r   c                P   \         P                  ! R4      pWn        \        P	                  \         P
                  W\         P                  ! R4      4       VP                  p\        VP                  4      V'       d(   \         P                  ! V4      P                  RR4      3# R3# )z6Return the ID and short description of a given format.zSF_FORMAT_INFO*SF_FORMAT_INFOrf   rg   r  )r   r  rw   r   r   r   r  r   r   r  r  )r  format_flagr   r   s   &&  r}   r  r  ;  s    ((,-K#OODII{KK 013D**+<@DKK$$Wi8J JFHJ Jr   c              #     "   \         P                  ! R4      p\        P                  \         P                  W\         P
                  ! R4      4       \        V^ ,          4       F  p\        W14      x  K  	  R# 5i)z8Helper for available_formats() and available_subtypes().zint*rV   N)r   r  r   r   r   r  ranger  )
count_flagr!  r  r  s   &&  r}   r   r   F  sM     HHVEOODIIz$++e2DEE!Ho
:33 &s   A8A:c                    \        V \        \        34      '       g   \        RP	                  V 4      4      h \
        V P                  4       ,          pV#   \         d    \        RP	                  T 4      4      hi ; i)z4Check if `format_str` is valid and return format ID.zInvalid format: {0!r}zUnknown format: {0!r})	r  r  r  r   rw   r  r   r  r   )
format_strr  s   & r}   r   r   N  su    j8S/22/66zBCCEj..01
   E077
CDDEs   A &A;c           	        V\         P                  8H  pV\         P                  8H  p\        \	        V R4      \	        V R4      \	        V R4      ;'       g    T\	        V R4      ;'       g    \	        V R4      ;'       g    T.4      # )z>Check if file has all the necessary attributes for virtual IO.r   rH  r   rl   r  )r   r  r  allr   )rn   r   readonly	writeonlys   &&  r}   r  r  Y  sw    4==(HDNN*Iffg**(fGGz!:GGi	  r   c                       ] tR tRtRtRtR# )SoundFileErrorie  z-Base class for all soundfile-specific errors.r   Nr   r   r   r   r   r   r   r   r}   r,  r,  e  s    7r   r,  c                       ] tR tRtRtRtR# )rh  ii  zGsoundfile module runtime error.

Errors that used to be `RuntimeError`.r   Nr-  r   r   r}   rh  rh  i  s    . 	r   rh  c                   D   a  ] tR tRt o RtRR lt]R 4       tR tRt	V t
R# )	rt  io  zVlibsndfile errors.


Attributes
----------
code
    libsndfile internal error number.
c                J    \         P                  WV4       Wn        W n        R # r   )rh  r   coder  )r   r1  r  s   &&&r}   r   LibsndfileError.__init__x  s    &&t6:	r   c                    V P                   '       dF   \        P                  V P                   4      p\        P                  ! V4      P                  RR4      # R# )zRaw libsndfile error message.rf   rg   z'(Garbled error message from libsndfile))r1  r   sf_error_numberr   r  r  )r   err_strs   & r}   error_stringLibsndfileError.error_string}  sB     999**4995G;;w'..w	BB
 =r   c                <    V P                   V P                  ,           # r   )r  r6  r   s   &r}   __str__LibsndfileError.__str__  s    {{T....r   )r1  r  Nr  )r   r   r   r   r   r   r   r6  r9  r   r   r   s   @r}   rt  rt  o  s-     
 	= 	=/ /r   rt  )aarch64
aarch64_bearmv8barmv8l)r  r  NrQ   FNNNNNNNT)NNNTNN)Nr  r  r  NrQ   FNNNNNNNT)Fr   )NNr;  )Rr   __version__osr  sysr  r   r   r   ctypes.utilr   _find_library
_soundfiler   r   unicoder  	NameErrorr  r'  r  r  r  r   r  r  r  r]   _machine_packaged_libnamer`   _architecturer  rw   _soundfile_datar  dirname__file___pathr   
_full_pathdlopenr   ImportErrorr   _libname_explicit_libnameisdir_hbrew_pathr  sf_version_stringr  __libsndfile_version__
startswithrM  rl   r   r   r,  r   r   r   r   r   r   rj   r+  r   r   r   r  r   SFC_GET_FORMAT_INFOr  r   r   r  r  r,  RuntimeErrorrh  rt  r   r   r}   <module>r[     sl  	    + + 5 "H 44444
44444
	X
X 	X 
X	
 
X 
X X 
X X 
X X X 
X 	X 
X  
X!" 
X#$ X	X
X	X	X	XX
X	X5:#f#f# f# f	#
 f# f# f# f# f# f# f# f# f# f# f#  f!#" f##$ f%#& f'#( f)#* f+#, f-#. f/#0 f1#2 f3#4 f5#6 f7#8 f9#: f;#< f=#> f?#@ fA#B fC#D fE#	L jj	j	j		X
X 	X
 
X 
X X 
X X 
X X X 
X 	Y 
X  
X!" 
X#$ X%& 
X
X	X	V	XX
X	5 < xwUW	
 q:2}} 0)HJ6A	'	!:0
 ?1( 4_Q7* 4A!6-/8:>@ @	'	!0:FF 5 -
 :U B=>>HH_556Eu&78J;;z"D< T%;%;%=>EEgyY $$]333C4F4GHZz6r8v16V 16h)F*D.$1 I[ I[X2@&60 *.)A)A J4		Y 		NL 	/+ /u2  HJ 	i( 22 +TUU{{8$ 2==H$ 2]]g% 0]]g% / 	1==H$w)>25((..AU2V2V.& ;;sxx}}[:KLMD;;01D'22sO   M# D3M3 #	M0/M03Q??&N((BQ;00Q; Q?$Q;6Q?:Q;;Q?