ó
    Â“,jÎ ã            '       óä  • % S r SrSSKrSSKrSSKrSSKJ	r	  SSK
Jr  SSKJrJrJr  SSKJrJrJrJrJr  SSKrSSKJr  SS	KJr  \\-  \-  \R<                  \   -  r\\ S
'   \RB                  \"\S4   \RF                  \RH                  \RJ                  -  \RL                  -  \RN                  -     4   r(\\ S'   \RB                  \"\\4   \RF                  \RH                  \RJ                  -  \RL                  -  \RN                  -     4   r)\\ S'   \S   r*\\ S'   \\ S'   \\ S'   SSSSSSSSSSS.
r+\\,\\4      \ S'   0 SS_S S!_S"S#_S$S%_S&S'_S(S)_S*S+_S,S-_S.S/_S0S1_S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S?_S@SASBSCSDSESFSGSHSI.	Er-\\,\\4      \ SJ'   0 SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSST_SUSV_SWSX_SYSZ_S[S\_S]S^_S_S`_SaSb_ScSd_0 SeSf_SgSh_SiSj_SkSl_SmSn_SoSp_SqSr_SsSt_SuSv_SwSx_SySz_S{S|_S}S~_SS€_S�S‚_SƒS„_S…S†_Er.\\,\\4      \ S‡'   SSˆS‰SŠS‹.r/\\,\\4      \ SŒ'   0 SSL_S SL_S"SL_S&SL_S(SL_S*SL_S,SL_S.SL_S0SL_S2SQ_S4SQ_S6SL_S8Ss_S:SL_S<SL_S>SL_S�SL_SLSLSLSSSuSLSLS…SŽ.Er0\\,\\4      \ S�'   S�S‘S’S“S.r1\\,\\4      \ S”'   SSSS•.r2\\,\\4      \ S–'    \Rf                  S—:X  a  SS˜K3J4r5  S™\5" 5       -   Sš-   r6O…\Rf                  S›:X  a;  SSK7r8\8Rr                  " 5       r:\:Sœ:X  a  S�r6OW\:Sž:X  a  SŸr6ON\:S›:X  a  S r6OE\;" S¡\: 35      e\Rf                  S¢:X  a"  SS˜K3J4r5  \5" 5       S£;   a  S¤r6OS™\5" 5       -   S¥-   r6O\;" S¦5      eSSK<r<\Rz                  R}                  \<R~                  5      r@\Rz                  Rƒ                  \@\65      rB\R†                  " \B5      rD\R–                  " \DR™                  5       5      R›                  S¯S°5      rN\NRŸ                  S±5      (       a  \N\P" S±5      S rN    SãS²\S³\S´\Sµ\S-  S¶\*S·\QS¸\RS-  S¹\(\)-  S-  Sº\S-  S»\S-  S¼\S-  S½\S-  S¾\S-  S¿\QSÀ\"\(\)-  \4   4SÁ jjrS    SäS²\SÂ\(Sº\S½\S-  S¾\S-  S¼\S-  S¿\QSÃ\RS-  SÄ\S-  SÀS4SÅ jjrT        SåS²\SÆ\S-  SÇ\S³\S´\Sµ\S-  S¶\*S·\QS¸\RS-  S¹\(\)-  S-  Sº\S-  S»\S-  S¼\S-  S½\S-  S¾\S-  S¿\QSÀ\	\(SS4   \	\)SS4   -  4"SÈ jjrU " SÉ SÊ5      rVSæS²\SË\QSÀ\V4SÌ jjrWSÀ\,\\4   4SÍ jrXSçS¼\S-  SÀ\,\\4   4SÎ jjrY  SèS¼\S½\S-  S¾\S-  SÀ\Q4SÏ jjrZS¼\SÀ\S-  4SÐ jr[ " SÑ SÒ5      r\SéSÓ jr]SÔ r^SÕ r_SÖ r`S× raSØ rb\DRÆ                  4SÙ jrdSÚ reSÛ rfSÜ rg " SÝ SÞ\h5      ri " Sß Sà\i\j5      rk " Sá Sâ\k5      rlg! \;\E\F4 aù     \" S§5      rG\Gc  \;" S¨5      e\R†                  " \G5      rD GN! \; aÆ    \Rf                  S—:X  a  S©rHO'\Rf                  S›:X  a  SªrHO\Rf                  S¢:X  a  S«rHOe SS˜K3J4r5  \Rf                  S—:X  a_  \5" 5       S¬:X  aT  \Rz                  R“                  S­5      (       a  S­OS®rJ\R†                  " \Rz                  Rƒ                  \J\H5      5      rD  GNÃ\R†                  " \H5      rD  GNÙf = ff = f)ê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.14.0é    N)Ú	Generator)Úfind_library)ÚSEEK_CURÚSEEK_ENDÚSEEK_SET)ÚAnyÚBinaryIOÚFinalÚLiteralÚ	TypeAlias)ÚSelf)ÚffiÚFileDescriptorOrPath.Ú	AudioDataÚAudioData_2d)Úfloat64Úfloat32Úint32Úint16Ú	dtype_strÚ_sndÚ_ffié   é   é   é   é   é   é   é   é	   é   )
ÚtitleÚ	copyrightÚsoftwareÚartistÚcommentÚdateÚalbumÚlicenseÚtracknumberÚgenreÚ
_str_typesÚWAVi   ÚAIFFi   ÚAUi   ÚRAWi   ÚPAFi   ÚSVXi   ÚNISTi   ÚVOCi   ÚIRCAMi  
 ÚW64i   ÚMAT4i   ÚMAT5i   ÚPVFi   ÚXIi   ÚHTKi   ÚSDSi   ÚAVRi   i   i   i   i   i   i    i  ! i  " i  # )	ÚWAVEXÚSD2ÚFLACÚCAFÚWVEÚOGGÚMPC2KÚRF64ÚMP3Ú_formatsÚ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é0   ÚG723_24é1   ÚG723_40é2   ÚDWVW_12é@   ÚDWVW_16éA   ÚDWVW_24éB   ÚDWVW_NéC   ÚDPCM_8éP   ÚDPCM_16éQ   ÚVORBISé`   ÚOPUSéd   ÚALAC_16ép   ÚALAC_20éq   ÚALAC_24ér   ÚALAC_32és   ÚMPEG_LAYER_Ié€   ÚMPEG_LAYER_IIé�   ÚMPEG_LAYER_IIIé‚   Ú	_subtypesi   i    i   0)ÚFILEÚLITTLEÚBIGÚCPUÚ_endiansr?   )r@   rA   rB   rC   rD   rE   rF   rG   Ú_default_subtypesÚdoubleÚfloatÚintÚshortÚ
_ffi_types)ÚCONSTANTÚAVERAGEÚVARIABLEÚ_bitrate_modesÚdarwin)ÚmachineÚlibsndfile_z.dylibÚwin32z	win-arm64zlibsndfile_arm64.dllz	win-amd64zlibsndfile_x64.dllzlibsndfile_x86.dllz no packaged library for Windows Úlinux)Úaarch64Ú
aarch64_beÚarmv8bÚarmv8lz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-ÚfileÚframesÚstartÚstopÚdtypeÚ	always_2dÚ
fill_valueÚoutÚ
samplerateÚchannelsÚformatÚsubtypeÚendianÚclosefdÚreturnc           
      óº   • [        U SX‰X¼X­5       nUR                  X#U5      nUR                  XXVU5      nSSS5        WWR                  4$ ! , (       d  f       N= f)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Úreadrª   )r¢   r£   r¤   r¥   r¦   r§   r¨   r©   rª   r«   r¬   r­   r®   r¯   ÚfÚdatas                   Ú—C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\soundfile.pyrµ   rµ   á   s^   € ôp 
�4˜˜jØ Fô
5Ø89Ø—‘ ¨fÓ5ˆØ�v‰v�f Y¸CÓ@ˆ÷
5ð �—‘ÐÐ÷	
5õ 
5ús   �&AÁ
Ar·   Úcompression_levelÚbitrate_modec	                 óè   • SSK n	U	R                  U5      nUR                  S:X  a  Sn
OUR                  S   n
[	        U SX*X4XVXx5
       nUR                  U5        SSS5        g! , (       d  f       g= f)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')

r   Nr   Úw)ÚnumpyÚasarrayÚndimÚshaper³   Úwrite)r¢   r·   rª   r­   r®   r¬   r¯   r¹   rº   Únpr«   r¶   s               r¸   rÁ   rÁ   A  sg   € ó` Ø�:‰:�dÓ€DØ‡y�y�Aƒ~Ø‰à—:‘:˜a‘=ˆÜ	�4˜˜jØ FØ$ô
4à78Ø	�‰�Œ÷
4÷ 
4ö 
4ús   ÁA#Á#
A1Ú	blocksizeÚoverlapc           
   #   ó¾   #   • [        U SX«XÞXÏ5       nUR                  XEU5      nUR                  XX6XxU	5       Sh  v•N   SSS5        g N! , (       d  f       g= f7f)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'

r²   N)r³   r´   Úblocks)r¢   rÃ   rÄ   r£   r¤   r¥   r¦   r§   r¨   r©   rª   r«   r¬   r­   r®   r¯   r¶   s                    r¸   rÆ   rÆ   |  sa   é € ôn 
�4˜˜jØ Fô
5Ø89Ø—‘ ¨fÓ5ˆØ—8‘8˜I°¸yÐVYÓZ×ZÐZ÷
5ð 
5ñ 	[÷
5õ 
5üs,   ‚A’*A¼A
½AÁ	AÁ
AÁ
AÁAc                   ó4   • \ rS rSrSrS r\S 5       rS rSr	g)Ú_SoundFileInfoi¹  zInformation about a SoundFilec                 ó  • X l         [        U5       nUR                  U l        UR                  U l        UR                  U l        UR
                  U l        [        U R
                  5      UR                  -  U l        UR                  U l        UR                  U l	        UR                  U l
        UR                  U l        UR                  U l        UR                  U l        UR                  U l        S S S 5        g ! , (       d  f       g = f©N)Úverboser³   Únamerª   r«   r£   r�   Údurationr¬   r­   r®   Úformat_infoÚsubtype_infoÚsectionsÚ
extra_info)Úselfr¢   rË   r¶   s       r¸   Ú__init__Ú_SoundFileInfo.__init__¼  s®   € Ø$ŒÜ�tŒ_ Ø)*¯©ˆDŒIØ#$§<¡<ˆDŒOØ!"§¡ˆDŒMØ Ÿx™xˆDŒKÜ#(¨¯©Ó#5°a·l±lÑ#BˆDŒMØ Ÿx™xˆDŒKØ !§	¡	ˆDŒLØ Ÿx™xˆDŒKØ$%§M¡MˆDÔØ%&§^¡^ˆDÔØ!"§¡ˆDŒMØ#$§<¡<ˆDŒO÷ �_Ž_ús   ’C#C>Ã>
Dc                 óÞ   • [        U R                  S5      u  p[        US5      u  p4US:¼  a  US SUS SUS S3nU$ US:¼  a  US SUS S	3nU$ US::  a  U R                  S
 S3nU$ US S3nU$ )Ni  é<   r   z.0gÚ:z02.0gz05.3fz hz minÚdz samplesz.3fz s)ÚdivmodrÍ   r£   )rÒ   ÚhoursÚrestÚminutesÚsecondsrÍ   s         r¸   Ú_duration_strÚ_SoundFileInfo._duration_strÌ  s¬   € ä˜TŸ]™]¨DÓ1‰ˆÜ! $¨Ó+ÑˆØ�A‹:Ø ˜ A g¨e _°A°g¸e°_ÀBÐGˆHð ˆð ˜‹\Ø! %˜¨¨'°%¨¸Ð=ˆHð
 ˆð	 ˜‹\ØŸ+™+ a˜¨Ð1ˆHð ˆð " #˜ bÐ)ˆHØˆó    c                 ó  • SR                  U R                   SU R                   S3SU R                   3SU R                   3SU R
                   SU R                   S3S	U R                   SU R                   S3/5      nU R                  (       an  S
R                  U R                  R                  S5      5      nUSR                  SU R                   3SU R                   3SU R                   3SSU S3/5      -  nU$ )NÚ
zsamplerate: z Hzz
channels: z
duration: zformat: z [Ú]z	subtype: z
    z	
endian: z
sections: zframes: zextra_info: """z    z""")ÚjoinrÌ   rª   r«   rÞ   rÎ   r¬   rÏ   r­   rË   rÑ   Úsplitr®   rÐ   r£   )rÒ   ÚinfoÚindented_extra_infos      r¸   Ú__repr__Ú_SoundFileInfo.__repr__Ú  s  € Ø�y‰yØ—	‘	ˆ{Ø˜DŸO™OÐ,¨CÐ0Ø˜$Ÿ-™-˜Ð)Ø˜$×,Ñ,Ð-Ð.Ø˜×(Ñ(Ð)¨¨D¯K©K¨=¸Ð:Ø˜×*Ñ*Ð+¨2¨d¯l©l¨^¸1Ð=ð?ó@ˆð �<�<Ø#-×"3Ñ"3°D·O±O×4IÑ4IÈ$Ó4OÓ"PÐØ�D—I‘IØ˜dŸk™k˜]Ð+Ø˜dŸm™m˜_Ð-Ø˜DŸK™K˜=Ð)Ø"ØÐ+Ð,¨CÐ0ð	2ó3ñ 3ˆDð ˆrà   )r«   rÍ   r®   rÑ   r¬   rÎ   r£   rÌ   rª   rÐ   r­   rÏ   rË   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rÓ   ÚpropertyrÞ   rè   Ú__static_attributes__© rà   r¸   rÈ   rÈ   ¹  s#   † Ù'ò0ð  ñó ðõrà   rÈ   rË   c                 ó   • [        X5      $ )z‹Returns an object with information about a `SoundFile`.

Parameters
----------
verbose : bool
    Whether to print additional information.
)rÈ   )r¢   rË   s     r¸   ræ   ræ   í  s   € ô ˜$Ó(Ð(rà   c                  ód   • [        [        [        R                  [        R                  5      5      $ )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_helperr   ÚSFC_GET_FORMAT_MAJOR_COUNTÚSFC_GET_FORMAT_MAJORrñ   rà   r¸   Úavailable_formatsrø   ø  s-   € ô" Ô)¬$×*IÑ*IÜ*.×*CÑ*CóEó Fð Frà   c                 ó¶   • [        [        R                  [        R                  5      nU VVs0 s H  u  p#U b  [	        X5      (       d  M  X#_M     snn$ s  snnf )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'}

)rõ   r   ÚSFC_GET_FORMAT_SUBTYPE_COUNTÚSFC_GET_FORMAT_SUBTYPEÚcheck_format)r¬   Úsubtypesr­   rÌ   s       r¸   Úavailable_subtypesrþ     sY   € ô" )¬×)JÑ)JÜ)-×)DÑ)DóF€Há/7ô Dªx™m˜gØ‘>¤\°&×%Bó ˆGŠM©xò Dð Dùó Ds   ®AÁAc                 óZ   •  [        [        XU5      5      $ ! [        [        4 a     gf = f)zÁCheck 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)r¬   r­   r®   s      r¸   rü   rü   $  s0   € ðÜ”K °Ó8Ó9Ð9øÜœ	Ð"ó Ùðús   ‚ —*©*c                 ó^   • [        U 5        [        R                  U R                  5       5      $ )z­Return the default subtype for a given format.

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

)Ú_check_formatr‹   ÚgetÚupper)r¬   s    r¸   Údefault_subtyper  7  s#   € ô �&ÔÜ× Ñ  §¡£Ó0Ð0rà   c                   óh  • \ rS rSrSr      SRS\S\S-  S\S-  S\S-  S\S-  S	\S-  S
\S-  S\S\	S-  S\S-  SS4S jjr
\" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \" S 5      r \S 5       rSrS\4S  jrSSS! jrS\4S" jr S#\!SS4S$ jr"S%\S&\!SS4S' jr#S%\S\!4S( jr$S\4S) jr%S\4S* jr&S\4S+ jr'S\4S, jr(\)4S-\S.\S\4S/ jjr*S\4S0 jr+   STS-\S1\,S2\S3\	S-  S4\-\.-  S-  S\-\.-  4S5 jjr/SUS-\S1\,S-  S\04S6 jjr1S7\2\0-  \!-  S1\,S\4S8 jr3S9\-SS4S: jr4S9\5S1\,SS4S; jr6    SVS<\S-  S=\S-\S1\,S2\S3\	S-  S4\-\.-  S-  S\7\-SS4   \7\.SS4   -  4S> jjr8SWS-\S-  SS4S? jjr9SSS@ jr:SSSA jr;\<Rz                  " 5       r>SB r?SC r@SD rASE rBSF rCSG rDSH rESI rFSJ rGSK rHSL rISM rJS\K\\4   4SN jrLSO rMSP rNSQrOg)Xr³   iG  z¡A sound file.

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

Nr¢   Úmoderª   r«   r­   r®   r¬   r¯   r¹   rº   r°   c           	      ó
  • [        U[        R                  5      (       a  [        R                  " U5      nXl        Uc  [        USS5      nUc  [        S5      e[        U5      nX l        X�l	        X l
        [        XX4XuU5      U l        U R                  XU5      U l        [        U5      R!                  S5      (       a&  U R#                  5       (       a  U R%                  S5        [&        R)                  U R                  [&        R*                  [,        R.                  [&        R0                  5        U R                  bE  U R3                  U R                  5        U R                  b  U R5                  U R                  5        ggg)a@  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

Nr
  z6Can not get `mode` from file. provided `mode` is None.zr+r   )Ú
isinstanceÚ_osÚPathLikeÚfspathÚ_nameÚgetattrr  Ú_check_modeÚ_modeÚ_compression_levelÚ_bitrate_modeÚ_create_info_structÚ_infoÚ_openÚ_fileÚsetÚ
issupersetÚseekableÚseekr   Ú
sf_commandÚSFC_SET_CLIPPINGr   ÚNULLÚSF_TRUEÚ_set_compression_levelÚ_set_bitrate_mode)rÒ   r¢   r
  rª   r«   r­   r®   r¬   r¯   r¹   rº   Úmode_ints               r¸   rÓ   ÚSoundFile.__init__O  s-  € ôP �dœCŸL™L×)Ñ)Ü—:’:˜dÓ#ˆDØŒ
Ø‰<Ü˜4 ¨Ó.ˆDØ‰|ÜÐ XÓYÐYÜ˜tÓ$ˆØŒ
Ø"3ÔØ)ÔÜ(¨°ZØ)/¸&óBˆŒ
à—Z‘Z °Ó8ˆŒ
Üˆt‹9×Ñ ×%Ñ%¨$¯-©-¯/©/à�I‰I�aŒLÜ�‰˜Ÿ
™
¤D×$9Ñ$9¼4¿9¹9ÜŸ™ô	&ð ×"Ñ"Ñ.à×'Ñ'¨×(?Ñ(?Ô@Ø×!Ñ!Ñ-Ø×&Ñ& t×'9Ñ'9Õ:ð .ð /rà   c                 ó   • U R                   $ rÊ   )r  ©rÒ   s    r¸   Ú<lambda>ÚSoundFile.<lambda>Ò  ó   €  §¢rà   c                 ó   • U R                   $ rÊ   )r  r'  s    r¸   r(  r)  Ô  r*  rà   c                 ó.   • U R                   R                  $ rÊ   )r  rª   r'  s    r¸   r(  r)  Ö  s   €  t§z¡z×'<Ò'<rà   c                 ó.   • U R                   R                  $ rÊ   ©r  r£   r'  s    r¸   r(  r)  Ø  s   €  4§:¡:×#4Ò#4rà   c                 ó.   • U R                   R                  $ rÊ   )r  r«   r'  s    r¸   r(  r)  Ú  ó   €  T§Z¡Z×%8Ò%8rà   c                 ób   • [        U R                  R                  [        R                  -  5      $ rÊ   )Ú_format_strr  r¬   r   ÚSF_FORMAT_TYPEMASKr'  s    r¸   r(  r)  Ý  s   € ”[ §¡×!2Ñ!2´T×5LÑ5LÑ!LÔMrà   c                 ób   • [        U R                  R                  [        R                  -  5      $ rÊ   )r2  r  r¬   r   ÚSF_FORMAT_SUBMASKr'  s    r¸   r(  r)  à  ó   € ”[ §¡×!2Ñ!2´T×5KÑ5KÑ!KÔLrà   c                 ób   • [        U R                  R                  [        R                  -  5      $ rÊ   )r2  r  r¬   r   ÚSF_FORMAT_ENDMASKr'  s    r¸   r(  r)  ã  r6  rà   c                 óh   • [        U R                  R                  [        R                  -  5      S   $ ©Nr   )Ú_format_infor  r¬   r   r3  r'  s    r¸   r(  r)  æ  s+   € ”\ $§*¡*×"3Ñ"3Ü"&×"9Ñ"9ñ#:ó ;Ø;<ò>rà   c                 óh   • [        U R                  R                  [        R                  -  5      S   $ r:  )r;  r  r¬   r   r5  r'  s    r¸   r(  r)  ê  s+   € ”\ $§*¡*×"3Ñ"3Ü"&×"8Ñ"8ñ#9ó :Ø:;ò=rà   c                 ó.   • U R                   R                  $ rÊ   )r  rÐ   r'  s    r¸   r(  r)  í  r0  rà   c                 ó   • U R                   S L $ rÊ   )r  r'  s    r¸   r(  r)  ï  s   €  4§:¡:°Ñ#5rà   c                 ó@   • [         R                  U R                  5      $ rÊ   )r   Úsf_errorr  r'  s    r¸   r(  r)  ñ  s   € ¤t§}¡}°T·Z±ZÔ'@rà   c                 ó   • U R                   $ rÊ   )r  r'  s    r¸   r(  r)  ó  s
   € ¨d×.EÒ.Erà   c                 ó   • U R                   $ rÊ   )r  r'  s    r¸   r(  r)  õ  s
   € ¨×);Ò);rà   c                 ó  • [         R                  " SS5      n[        R                  U R                  [        R
                  U[         R                  " U5      5        [         R                  " U5      R                  SS5      $ )z8Retrieve the log string generated when opening the file.zchar[]i @  r    r¡   )	r   Únewr   r  r  ÚSFC_GET_LOG_INFOÚsizeofÚstringÚdecode)rÒ   ræ   s     r¸   rÑ   ÚSoundFile.extra_infoø  sX   € ô �xŠx˜ %Ó(ˆÜ�‰˜Ÿ
™
¤D×$9Ñ$9ØœdŸkšk¨$Ó/ô	1ä�{Š{˜4Ó ×'Ñ'¨°Ó;Ð;rà   c                 óL  • U R                   b  SU R                    3OSnUU R                  b  SU R                   S3OS-  nSU R                  < SU R                  < SU R                   SU R
                   S	U R                  < S
U R                  < SU R                  < U S3$ )Nz, compression_level=Ú z, bitrate_mode='Ú'z
SoundFile(z, mode=z, samplerate=z, channels=z	, format=z
, subtype=z	, endian=Ú))	r¹   rº   rÌ   r
  rª   r«   r¬   r­   r®   )rÒ   Úcompression_settings     r¸   rè   ÚSoundFile.__repr__  sÄ   € à"&×"8Ñ"8Ñ"Dð "6°d×6LÑ6LÐ5MÑNØJLð 	àØ#'×#4Ñ#4Ñ#@ð #3°4×3DÑ3DÐ2EÀQÑ GØFHñ	JÐà˜TŸY™Y™M¨°·±±ð >Ø"Ÿo™oÐ.¨k¸$¿-¹-¸ð IØŸ+™+™¨
°4·<±<Ñ2Bð CØŸ+™+™Ð)<Ð(=¸Qð@ð 	Arà   c                 ó$   • U R                  5         g rÊ   ©Úcloser'  s    r¸   Ú__del__ÚSoundFile.__del__  ó   € Ø�
‰
�rà   c                 ó   • U $ rÊ   rñ   r'  s    r¸   Ú	__enter__ÚSoundFile.__enter__  s   € Øˆrà   Úargsc                 ó$   • U R                  5         g rÊ   rQ  )rÒ   rY  s     r¸   Ú__exit__ÚSoundFile.__exit__  rU  rà   rÌ   Úvaluec                 óè   • U[         ;   aR  U R                  5         [        R                  U R                  [         U   UR                  5       5      n[        U5        g[        R                  XU5        g)z:Write text meta-data in the sound file through properties.N)	r-   Ú_check_if_closedr   Úsf_set_stringr  ÚencodeÚ_error_checkÚobjectÚ__setattr__)rÒ   rÌ   r]  Úerrs       r¸   rd  ÚSoundFile.__setattr__  sT   € à”:ÓØ×!Ñ!Ô#Ü×$Ñ$ T§Z¡Z´¸DÑ1AØ%*§\¡\£^ó5ˆCä˜Õä×Ñ˜t¨5Õ1rà   c                 ó   • U[         ;   af  U R                  5         [        R                  U R                  [         U   5      nU(       a&  [
        R                  " U5      R                  SS5      $ S$ [        SU< 35      e)z9Read text meta-data in the sound file through properties.r    r¡   rK  z$'SoundFile' object has no attribute )	r-   r_  r   Úsf_get_stringr  r   rG  rH  ÚAttributeError)rÒ   rÌ   r·   s      r¸   Ú__getattr__ÚSoundFile.__getattr__   sm   € à”:ÓØ×!Ñ!Ô#Ü×%Ñ% d§j¡j´*¸TÑ2BÓCˆDÞCG”4—;’;˜tÓ$×+Ñ+¨G°YÓ?ÐOÈRÐOä Ø6°t±hÐ?óAð Arà   c                 ó.   • U R                   R                  $ rÊ   r.  r'  s    r¸   Ú__len__ÚSoundFile.__len__*  s   € ð �z‰z× Ñ Ð rà   c                 ó   • g)NTrñ   r'  s    r¸   Ú__bool__ÚSoundFile.__bool__/  s   € ð rà   c                 ó"   • U R                  5       $ rÊ   )rp  r'  s    r¸   Ú__nonzero__ÚSoundFile.__nonzero__4  s   € ð �}‰}‹Ðrà   c                 óP   • U R                   R                  [        R                  :H  $ )z)Return True if the file supports seeking.)r  r  r   r!  r'  s    r¸   r  ÚSoundFile.seekable9  s   € à�z‰z×"Ñ"¤d§l¡lÑ2Ð2rà   r£   Úwhencec                 ó�   • U R                  5         [        R                  U R                  X5      n[	        U R
                  5        U$ )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  rb  Ú
_errorcode)rÒ   r£   rw  Úpositions       r¸   r  ÚSoundFile.seek=  s6   € ðH 	×ÑÔÜ—<‘< §
¡
¨FÓ;ˆÜ�T—_‘_Ô%Øˆrà   c                 ó.   • U R                  S[        5      $ )z'Return the current read/write position.r   )r  r   r'  s    r¸   ÚtellÚSoundFile.tellf  s   € à�y‰y˜œHÓ%Ð%rà   r¦   r§   r¨   r©   c                 óò   • Uc$  U R                  X5      nU R                  XU5      nO US:  d  U[        U5      :”  a  [        U5      nU R                  SXQ5      n[        U5      U:”  a  Uc  USU nU$ XEUS& U$ )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

Nr   rµ   )Ú_check_framesÚ_create_empty_arrayÚlenÚ	_array_io)rÒ   r£   r¦   r§   r¨   r©   s         r¸   rµ   ÚSoundFile.readk  s‹   € ðb ‰;Ø×'Ñ'¨Ó;ˆFØ×*Ñ*¨6¸eÓD‰Cà˜‹z˜V¤c¨#£hÓ.Ü˜S›�Ø—‘ ¨Ó4ˆÜˆs‹8�fÓØÑ!Ø˜'˜6�l�ð ˆ
ð  *�F�G�Øˆ
rà   c                 óð   • U R                  USS9nU R                  U5      n[        R                  " US-   XR                  -  5      nU R                  SXCU5      nXQ:X  d   e[        R                  " U5      $ )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)r¨   z[]rµ   )r�  Ú_check_dtyper   rD  r«   Ú	_cdata_ioÚbuffer)rÒ   r£   r¦   ÚctypeÚcdataÚread_framess         r¸   Úbuffer_readÚSoundFile.buffer_readË  sq   € ð8 ×#Ñ# F°tÐ#Ð<ˆØ×!Ñ! %Ó(ˆÜ—’˜ ™ v·±Ñ'=Ó>ˆØ—n‘n V¨U¸6ÓBˆØÓ$Ð$Ð$Ü�{Š{˜5Ó!Ð!rà   r‰  c                 ót   • U R                  U5      nU R                  X5      u  pEU R                  SXCU5      nU$ )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

rµ   )r‡  Ú_check_bufferrˆ  )rÒ   r‰  r¦   rŠ  r‹  r£   s         r¸   Úbuffer_read_intoÚSoundFile.buffer_read_intoî  s=   € ð8 ×!Ñ! %Ó(ˆØ×*Ñ*¨6Ó9‰ˆØ—‘ ¨°fÓ=ˆØˆrà   r·   c                 óª   • SSK nUR                  U5      nU R                  SU[        U5      5      nU[        U5      :X  d   eU R	                  U5        g)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

r   NrÁ   )r½   Úascontiguousarrayr„  rƒ  Ú_update_frames)rÒ   r·   rÂ   Úwrittens       r¸   rÁ   ÚSoundFile.write  sP   € ó\ 	ð ×#Ñ# DÓ)ˆØ—.‘. ¨$´°D³	Ó:ˆØœ#˜d›)Ó#Ð#Ð#Ø×Ñ˜GÕ$rà   c                 ó¢   • U R                  U5      nU R                  X5      u  pEU R                  SXCU5      nXe:X  d   eU R                  U5        g)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)r‡  r�  rˆ  r•  )rÒ   r·   r¦   rŠ  r‹  r£   r–  s          r¸   Úbuffer_writeÚSoundFile.buffer_writeE  sR   € ð* ×!Ñ! %Ó(ˆØ×*Ñ*¨4Ó7‰ˆØ—.‘. ¨%¸Ó?ˆØÓ Ð Ð Ø×Ñ˜GÕ$rà   rÃ   rÄ   c           	   #   óx  #   • SSK nSU R                  ;  a  SU R                  ;  a  [        S5      eU R                  X65      nUc3  Uc  [	        S5      eUb  UO
[        X5      n	U R                  X•U5      nSn
OUb  [	        S5      e[        U5      nS	n
SnUS:”  a�  Uc  SnO[        U5      nX·SU& [        X-
  U5      nU R                  XÔXVX|S 5        U(       a   Uc  UR                  Xr* S 5      nOXr* S USS& XU-   :”  a  Uc  USX2-    nOUnU
(       a  UR                  U5      OUv •  X=-  nUS:”  a  Mœ  gg7f)
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'

r   Nr²   Ú+z*blocks() is not allowed in write-only modez)One of {blocksize, out} must be specifiedTz-Only one of {blocksize, out} may be specifiedF)
r½   r
  ÚSoundFileRuntimeErrorr�  r  Úminr‚  rƒ  rµ   Úcopy)rÒ   rÃ   rÄ   r£   r¦   r§   r¨   r©   rÂ   Úout_sizeÚcopy_outÚoverlap_memoryÚoutput_offsetÚtoreadÚblocks                  r¸   rÆ   ÚSoundFile.blocks`  sg  é € óh 	à�d—i‘iÓ C¨t¯y©yÓ$8Ü'Ð(TÓUÐUà×#Ñ# FÓ7ˆØ‰;ØÑ ÜÐ KÓLÐLØ$.Ñ$:‘yÄÀIÓ@VˆHØ×*Ñ*¨8ÀÓFˆCØ‰HàÑ$ÜØCóEð Eä˜C›ˆIØˆHàˆØ�q‹jØÑ%Ø !‘ä # NÓ 3�Ø&4�N�]Ð#ä˜Ñ2°FÓ;ˆFØ�I‰I�f Y¸CÀÐ<OÔPæØ!Ñ)Ø%'§W¡W¨S°°¨^Ó%<‘Nà(+¨H¨I¨�N¡1Ð%à GÑ+Ó+°
Ñ0BØÐ-˜VÑ-Ð.‘à�Þ$,�"—'‘'˜%”.°%Ò7ØÑˆFð+ �q�jùs   ‚D4D:Ä8D:c                 ó`  • Uc  U R                  5       n[        R                  U R                  [        R                  [
        R                  " SU5      [
        R                  " S5      5      nU(       a+  [        R                  U R                  5      n[        US5      eXR                  l        g)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)r~  r   r  r  ÚSFC_FILE_TRUNCATEr   rD  rF  r@  ÚLibsndfileErrorr  r£   )rÒ   r£   re  s      r¸   ÚtruncateÚSoundFile.truncate¿  sy   € ð ‰>Ø—Y‘Y“[ˆFÜ�o‰o˜dŸj™j¬$×*@Ñ*@Ü"Ÿhšh }°fÓ=Ü"Ÿkšk¨,Ó7ó9ˆö ä—-‘- §
¡
Ó+ˆCÜ! #Ð'BÓCÐCØ"�
‰
Õrà   c                 ób   • U R                  5         [        R                  U R                  5        g)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                 óª   • U R                   (       dB  U R                  5         [        R                  U R                  5      nSU l        [        U5        gg)z.Close the file.  Can be called multiple times.N)Úclosedr¯  r   Úsf_closer  rb  )rÒ   re  s     r¸   rR  ÚSoundFile.closeå  s8   € à�{�{à�J‰JŒLÜ—-‘- §
¡
Ó+ˆCØˆDŒJÜ˜Õð rà   c                 óz  ^ ^• [        U[        [        45      (       Ga/  [        R                  R                  U5      (       aœ  ST R                  ;   a  [        ST R                  < 35      e[        T R                  5      R                  S5      (       aJ  [        R                  " [        R                  " U[        R                  [        R                  -  5      5        [        R                   n[        U[        5      (       aI  ["        R$                  S:X  a  [        R&                  nOqUR)                  ["        R*                  " 5       5      nOL[        U[,        5      (       a  U4S jnO0[/        X5      (       a  U 4S jnO[1        ST R                  < 35      eT R2                     U" XT R4                  5      nU[6        R8                  :X  a.  [        R;                  U5      n[=        UST R                  < S	3S
9e SSS5        U[        R>                  :X  a  ST R4                  l         W$ ! , (       d  f       N5= f)z9Call the appropriate sf_open*() function from libsndfile.ÚxzFile exists: zw+r˜   c                 ó2   >• [         R                  XUT5      $ rÊ   )r   Ú
sf_open_fd)r¢   r$  ræ   r¯   s      €r¸   r(  Ú!SoundFile._open.<locals>.<lambda>  s   ø€ ¼¿¹ÈÐX\Ð^eÔ8frà   c                 ól   >• [         R                  TR                  U 5      X[        R                  5      $ rÊ   )r   Úsf_open_virtualÚ_init_virtual_ior   r   )r¢   r$  ræ   rÒ   s      €r¸   r(  r¹    s(   ø€ ¼×8LÑ8LÈT×MbÑMbÐcgÓMhØ,4¼D¿I¹Iô9Grà   zInvalid file: zError opening z: ©ÚprefixNr   )!r  ÚstrÚbytesr  ÚpathÚisfiler
  ÚOSErrorrÌ   r  r  rR  ÚopenÚO_WRONLYÚO_TRUNCr   Úsf_openÚ_sysÚplatformÚsf_wchar_openra  ÚgetfilesystemencodingrŽ   Ú_has_virtual_io_attrsr  Ú_sf_error_lockr  r   r   r@  rª  Ú	SFM_WRITEr£   )rÒ   r¢   r$  r¯   ÚopenfunctionÚfile_ptrre  s   `  `   r¸   r  ÚSoundFile._openõ  s‹  ù€ ä�dœS¤%˜L×)Ò)Ü�x‰x�‰˜t×$Ñ$Ø˜$Ÿ)™)Ó#Ü! M°$·)±)±Ð"?Ó@Ð@Ü˜Ÿ™“^×.Ñ.¨t×4Ñ4ä—I’IœcŸhšh t¬S¯\©\¼C¿K¹KÑ-GÓHÔIÜŸ<™<ˆLÜ˜$¤×$Ñ$Ü—=‘= GÓ+Ü#'×#5Ñ#5‘LàŸ;™;¤t×'AÒ'AÓ'CÓD�DøÜ˜œc×"Ñ"Üf‰LÜ" 4×2Ñ2ôG‰Lô ˜n¨T¯Y©Y©MÐ:Ó;Ð;à× Ó Ù# D°D·J±JÓ?ˆHØœ4Ÿ9™9Ó$Ü—m‘m HÓ-�Ü% c°NÀ4Ç9Á9Á-ÈrÐ2RÑSÐSð %÷ !ð
 ”t—~‘~Ó%ð !"ˆD�J‰JÔð ˆ÷ !Õ ús   Æ&AH,È,
H:c                 ó–  ^• [         R                  " S5      U4S j5       n[         R                  " S5      U4S j5       n[         R                  " S5      U4S j5       n[         R                  " S5      U4S j5       n[         R                  " S	5      U4S
 j5       nUUUUUS.U l        [         R                  " SU R                  5      $ )z4Initialize callback functions for sf_open_virtual().Úsf_vio_get_filelenc                 ó    >• TR                  5       nTR                  S[        5        TR                  5       nTR                  U[        5        U$ ©Nr   )r~  r  r   r   )Ú	user_dataÚcurrÚsizer¢   s      €r¸   Úvio_get_filelenÚ3SoundFile._init_virtual_io.<locals>.vio_get_filelen  s:   ø€ à—9‘9“;ˆDØ�I‰I�aœÔ"Ø—9‘9“;ˆDØ�I‰I�dœHÔ%ØˆKrà   Úsf_vio_seekc                 óF   >• TR                  X5        TR                  5       $ rÊ   )r  r~  )Úoffsetrw  rÖ  r¢   s      €r¸   Úvio_seekÚ,SoundFile._init_virtual_io.<locals>.vio_seek$  s   ø€ à�I‰I�fÔ%Ø—9‘9“;Ðrà   Úsf_vio_readc                 óæ   >•  [         R                  " X5      nTR                  U5      nU$ ! [         a:    TR	                  U5      n[        U5      n[         R                  " X5      nXSSU&  U$ f = frÕ  )r   r‰  Úreadintori  rµ   rƒ  )ÚptrÚcountrÖ  ÚbufÚ	data_readr·   r¢   s         €r¸   Úvio_readÚ,SoundFile._init_virtual_io.<locals>.vio_read)  sr   ø€ ð(Ü—k’k #Ó-�Ø ŸM™M¨#Ó.�	ð Ðøô "ó (Ø—y‘y Ó'�Ü ›I�	Ü—k’k #Ó1�Ø#'�A�iÑ ØÐð(ús   ƒ', ¬A A0Á/A0Úsf_vio_writec                 ój   >• [         R                  " X5      nUS S  nTR                  U5      nUc  UnU$ rÊ   )r   r‰  rÁ   )rã  rä  rÖ  rå  r·   r–  r¢   s         €r¸   Ú	vio_writeÚ-SoundFile._init_virtual_io.<locals>.vio_write6  s7   ø€ ä—+’+˜cÓ)ˆCØ‘q�6ˆDØ—j‘j Ó&ˆGà‰Ø�ØˆNrà   Úsf_vio_tellc                 ó$   >• TR                  5       $ rÊ   )r~  )rÖ  r¢   s    €r¸   Úvio_tellÚ,SoundFile._init_virtual_io.<locals>.vio_tell@  s   ø€ à—9‘9“;Ðrà   )Úget_filelenr  rµ   rÁ   r~  zSF_VIRTUAL_IO*)r   ÚcallbackÚ_virtual_iorD  )rÒ   r¢   rÙ  rÞ  rç  rë  rï  s    `     r¸   r¼  ÚSoundFile._init_virtual_io  sÈ   ø€ ä	�ŠÐ+Ó	,ô	ó 
-ð	ô 
�Š�}Ó	%ô	ó 
&ð	ô 
�Š�}Ó	%ô
	ó 
&ð
	ô 
�Š�~Ó	&ô	ó 
'ð	ô 
�Š�}Ó	%ô	ó 
&ð	ð ,;Ø$,Ø$,Ø%.Ø$,ñ	.ˆÔô �xŠxÐ(¨$×*:Ñ*:Ó;Ð;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._getAttributeNamesM  s
   € ô Ðrà   c                 ó<   • U R                   (       a  [        S5      eg)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²  r�  r'  s    r¸   r_  ÚSoundFile._check_if_closedU  s   € ð �;�;Ü'Ð(FÓGÐGð rà   c                 ó°   • U R                  5       (       a/  U R                  U R                  5       -
  nUS:  d  X:”  a  Uc  UnU$ US:  a  [        S5      eU$ )z8Reduce frames to no more than are available in the file.r   z/frames must be specified for non-seekable files)r  r£   r~  r  )rÒ   r£   r¨   Úremaining_framess       r¸   r�  ÚSoundFile._check_frames^  sZ   € à�=‰=�?‰?Ø#Ÿ{™{¨T¯Y©Y«[Ñ8ÐØ˜‹z˜fÓ7Ø(Ñ0Ø)�ð ˆð �a‹ZÜÐNÓOÐOØˆrà   c                 ó&  • U[         R                  5       ;   d   e[        U[        5      (       d  [        R
                  " U5      n[        [        U5      U R                  [        R                  " U5      -  5      u  p4U(       a  [        S5      eX4$ )z1Convert buffer to cdata and check for valid size.z*Data size must be a multiple of frame size)r�   Úvaluesr  rÀ  r   Úfrom_bufferrÙ   rƒ  r«   rF  r  )rÒ   r·   rŠ  r£   Ú	remainders        r¸   r�  ÚSoundFile._check_bufferi  sv   € àœ
×)Ñ)Ó+Ó+Ð+Ð+Ü˜$¤×&Ñ&Ü×#Ò# DÓ)ˆDÜ"¤3 t£9Ø#'§=¡=´4·;²;¸uÓ3EÑ#EóGÑˆæÜÐIÓJÐJØˆ|Ðrà   c                 óz   • SSK nU(       d  U R                  S:”  a  XR                  4nOU4nUR                  XSSS9$ )z-Create an empty array with appropriate shape.r   Nr   ÚC)Úorder)r½   r«   Úempty)rÒ   r£   r§   r¦   rÂ   rÀ   s         r¸   r‚  ÚSoundFile._create_empty_arrayt  s9   € ãÞ˜Ÿ™¨Ó)ØŸM™MÐ)‰Eà�GˆEØ�x‰x˜¨CˆxÐ0Ð0rà   c                 óŽ   •  [         U   $ ! [         a/    [        S[        [         R	                  5       5      < SU< 35      ef = f)z7Check if dtype string is valid and return ctype string.zdtype must be one of z	 and not )r�   ÚKeyErrorr  ÚsortedÚkeys)rÒ   r¦   s     r¸   r‡  ÚSoundFile._check_dtype}  sM   € ð	fÜ˜eÑ$Ð$øÜó 	fÜÐ4´V¼J¿O¹OÓ<MÓ5NÑ4QÐQZÐ[`ÑZcÐdÓeÐeð	fús	   ‚ ‹9Ac           	      ó¢  • UR                   S;  a/  [        SUR                  < SUR                   S:  a  SOS S35      eUR                   S:X  a  SOUR                  S   nX@R                  :w  a*  [        SUR                  < SU R                   S	U S35      eUR                  R
                  (       d  [        S
5      eU R                  UR                  R                  5      nUR                  R                  [        R                  " U5      :X  d   e[        R                  " US-   UR                  S   S   5      nU R                  XXS5      $ )z+Check array and call low-level IO function.)r   r   zInvalid shape: z (r   z0 dimensions not supportedztoo many dimensionsrM  z (Expected z channels, got zData must be C-contiguousÚ*r·   r   )r¿   r  rÀ   r«   ÚflagsÚc_contiguousr‡  r¦   rÌ   Úitemsizer   rF  ÚcastÚ__array_interface__rˆ  )rÒ   ÚactionÚarrayr£   Úarray_channelsrŠ  r‹  s          r¸   r„  ÚSoundFile._array_io„  s.  € à�:‰:˜UÓ"Ü˜¨u¯{©{©o¸RÐ`e×`jÑ`jÐmnÓ`nÑ@\ð  uJð  @Kð  KLð  Mó  Nð  NØ#Ÿj™j¨A›o™°5·;±;¸q±>ˆØŸ]™]Ó*Ü˜¨u¯{©{©o¸[ÈÏÉÈÐWfÐguÐfvÐvwÐxÓyÐyØ�{‰{×'×'ÜÐ8Ó9Ð9Ø×!Ñ! %§+¡+×"2Ñ"2Ó3ˆØ�{‰{×#Ñ#¤t§{¢{°5Ó'9Ó9Ð9Ð9Ü—	’	˜% #™+ u×'@Ñ'@ÀÑ'HÈÑ'KÓLˆØ�~‰~˜f¨UÓ;Ð;rà   c                 ó„  • U[         R                  5       ;   d   eU R                  5         SnU R                  5       (       a  U R	                  5       n[        [        SU-   S-   U-   5      nU" U R                  X$5      n[        U R                  5        U R                  5       (       a  U R                  XT-   [        5        U$ )z.Call one of libsndfile's read/write functions.r   Úsf_Úf_)r�   rþ  r_  r  r~  r  r   r  rb  rz  r  r   )rÒ   r  r·   rŠ  r£   r×  Úfuncs          r¸   rˆ  ÚSoundFile._cdata_io’  s–   € àœ
×)Ñ)Ó+Ó+Ð+Ð+Ø×ÑÔØˆØ�=‰=�?‰?Ø—9‘9“;ˆDÜ”t˜U V™^¨dÑ2°UÑ:Ó;ˆÙ�d—j‘j $Ó/ˆÜ�T—_‘_Ô%Ø�=‰=�?‰?Ø�I‰I�d‘m¤XÔ.Øˆrà   c                 ó  • U R                  5       (       aL  U R                  5       nU R                  S[        5      U R                  l        U R                  U[        5        gU R                  =R
                  U-  sl        g)z!Update self.frames after writing.r   N)r  r~  r  r   r  r£   r   )rÒ   r–  r×  s      r¸   r•  ÚSoundFile._update_frames   sR   € à�=‰=�?‰?Ø—9‘9“;ˆDØ $§	¡	¨!¬XÓ 6ˆD�J‰JÔØ�I‰I�dœHÕ%à�J‰J×Ò Ñ(Örà   c                 ó@  • US:w  a   U R                  5       (       d  [        S5      eUS:¼  a  Ub  [        S5      e[        X5      R	                  U R
                  5      u  pnX!:  a  UnUS:  a  X!-
  nU R                  5       (       a  U R                  U[        5        U$ )z)Seek to start frame and calculate length.r   z(start is only allowed for seekable filesz&Only one of {frames, stop} may be used)r  r  r  ÚsliceÚindicesr£   r  r   )rÒ   r¤   r¥   r£   Ú_s        r¸   r´   ÚSoundFile._prepare_read©  sŠ   € à�A‹:˜dŸm™mŸo™oÜÐGÓHÐHØ�Q‹;˜4Ñ+ÜÐDÓEÐEä˜uÓ+×3Ñ3°D·K±KÓ@‰ˆ�QØ‹<ØˆDØ�A‹:Ø‘\ˆFØ�=‰=�?‰?Ø�I‰I�eœXÔ&Øˆrà   c                 óæ   • 0 n[         R                  5        HV  u  p#[        R                  U R                  U5      nU(       d  M.  [
        R                  " U5      R                  SS5      X'   MX     U$ )zýGet 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'.
r    r¡   )r-   Úitemsr   rh  r  r   rG  rH  )rÒ   ÚstrsÚstrtypeÚstridr·   s        r¸   Úcopy_metadataÚSoundFile.copy_metadata¹  s]   € ð ˆÜ(×.Ñ.Ö0‰NˆGÜ×%Ñ% d§j¡j°%Ó8ˆDßˆtÜ $§¢¨DÓ 1× 8Ñ 8¸À)Ó L�“ñ 1ð ˆrà   c                 ól  • U[         ;   d   e[        R                  " S5      n[         U   US'   [        R	                  U R
                  [        R                  U[        R                  " U5      5      nU[        R                  :w  a.  [        R                  U R
                  5      n[        USU 35      eg)z,Call libsndfile's set bitrate mode function.zint[1]r   zError set bitrate mode N)r”   r   rD  r   r  r  ÚSFC_SET_BITRATE_MODErF  r!  r@  rª  )rÒ   rº   Úpointer_bitrate_modere  s       r¸   r#  ÚSoundFile._set_bitrate_modeË  s“   € àœ~Ó-Ð-Ð-ä#Ÿxšx¨Ó1ÐÜ"0°Ñ">Ð˜QÑÜ�o‰o˜dŸj™j¬$×*CÑ*CÐEYÔ[_×[fÒ[fÐg{Ó[|Ó}ˆØ”$—,‘,ÓÜ—-‘- §
¡
Ó+ˆCÜ! #Ð)@ÀÀÐ'OÓPÐPð rà   c                 óx  • SUs=::  a  S::  d  O  [        S5      e[        R                  " S5      nXS'   [        R	                  U R
                  [        R                  U[        R                  " U5      5      nU[        R                  :w  a.  [        R                  U R
                  5      n[        USU 35      eg)z1Call libsndfile's set compression level function.r   r   z)Compression level must be in range [0..1]z	double[1]zError set compression level N)r  r   rD  r   r  r  ÚSFC_SET_COMPRESSION_LEVELrF  r!  r@  rª  )rÒ   r¹   Úpointer_compression_levelre  s       r¸   r"  Ú SoundFile._set_compression_level×  s¤   € àÐ&Õ+¨!Õ+ÜÐHÓIÐIä$(§H¢H¨[Ó$9Ð!Ø'8 !Ñ$Ü�o‰o˜dŸj™j¬$×*HÑ*HÐJcÔei×epÒepð  rKó  fLó  MˆØ”$—,‘,ÓÜ—-‘- §
¡
Ó+ˆCÜ! #Ð)EÐFWÐEXÐ'YÓZÐZð rà   )r  r  r  r  r  r  ró  )	r²   NNNNNTNN)r°   N)éÿÿÿÿr   FNN)r2  N)Nr   r2  r   FNNrÊ   )Prê   rë   rì   rí   rî   r   r¿  rŽ   r   r�   rÓ   rï   rÌ   r
  rª   r£   r«   r¬   r­   r®   rÎ   rÏ   rÐ   r²  rz  r¹   rº   rÑ   r  rè   rS  r   rW  r   r[  rd  rj  rm  rp  rs  r  r   r  r~  r   r   r   rµ   Ú
memoryviewr�  Ú	bytearrayr‘  rÁ   rÀ  r™  r   rÆ   r«  r¯  rR  Ú
_threadingÚLockrÍ  r  r¼  rö  r_  r�  r�  r‚  r‡  r„  rˆ  r•  r´   rô   r(  r#  r"  rð   rñ   rà   r¸   r³   r³   G  sv  † ñð GJØGKØBFØ<@Ø37Ø,0ñA;Ð1ð A;¸¸t¹ð A;Ø  4™ZðA;Ø:=À¹*ðA;à ™*ðA;à58¸4±ZðA;ð ˜t™ðA;ð 6:ðA;ð %*¨D¡Lð	A;ð
  # T™zðA;ð
 6:õA;ñF Ñ+Ó,€DØ*ÙÑ+Ó,€DØ7ÙÑ<Ó=€JØ,ÙÑ4Ó5€FØ1ÙÑ8Ó9€HØ3ÙÙMóO€Fà-ÙÙLóN€Gà4ÙÙLóN€Fà8Ùñ	>ó?€Kð ?Ùñ	=ó>€Lð :ÙÑ8Ó9€HØ3ÙÑ5Ó6€FØ2ÙÑ@ÓA€JØ'Ù Ñ!EÓFÐØ,ÙÑ;Ó<€LØ'àñ<ó ð<ð €EðA˜#ô Aôð˜4ô ð˜cð  dô ð2 ð 2¨Cð 2°Dô 2ðA ð A¨ô Að!˜ô !ð
˜$ô ð
˜Tô ð
3˜$ô 3ð /7ñ '˜3ð '¨ð '¸3õ 'ðR&�cô &ð
 9BØ@DØ37ñ]˜3ð ]¨Ið ]Øð]Ø16¸±ð]à˜\Ñ)¨DÑ0ð]à<EÈÑ<Tõ]ñ@!" #ð !"°9¸tÑ3Cð !"Èzõ !"ðF y°:Ñ'=ÀÑ'Cð ÈIð ÐZ]ô ðB4%˜)ð 4%¨ô 4%ðl% ð %¨yð %¸Tô %ð6 CDØ4=ØCGØ6:ñ]  d¡
ð ]¸Cð ]Øð]Ø(1ð]àð]à49¸D±Lð]ð  Ñ,¨tÑ3ð]ð @IÈÐTXÐZ^ÐI^Ñ?_ÐbkÐlxÐz~ð  AEð  mEñ  cFñ  @Fõ]ñ~#˜s T™zð #°Tõ #ô0'ôð  —_’_Ó&€Nò#òJ1<òfòHò	ò	ò1òfò<òò)òð ˜t C¨ H™~ô ò$	Qõ
[rà   r³   c                 ó"   • U S:w  a	  [        XS9eg)z+Raise LibsndfileError if there is an error.r   r½  N)rª  )re  r¾  s     r¸   rb  rb  ä  s   € à
ˆaƒxÜ˜cÑ1Ð1ð rà   c                 ó„  • [        U 5      nUc  [        U 5      nUc  [        SU < 35      eO$[        U[        5      (       d  [        SU< 35      e U[
        UR                  5          -  nUc  SnO$[        U[        5      (       d  [        SU< 35      e U[        UR                  5          -  n[        R                  " S5      nX4l        SUl        [        R                  U5      [        R                   :X  a  [        S	5      eU$ ! [         a    [        SU< 35      ef = f! [         a    [        SU< 35      ef = f)
z8Return numeric ID for given format|subtype|endian combo.z$No default subtype for major format zInvalid subtype: zUnknown subtype: r†   zInvalid endian-ness: zUnknown endian-ness: úSF_INFO*r   z1Invalid combination of format, subtype and endian)r  r  r  r  r¿  r…   r  r  r  rŠ   r   rD  r¬   r«   r   Úsf_format_checkÚSF_FALSE)r¬   r­   r®   Úresultræ   s        r¸   r  r  ê  sQ  € ä˜6Ó"€FØ�Ü! &Ó)ˆØ‰?ÜØ6°v±jÐAóCð Cð ô ˜¤×%Ñ%ÜÐ+¨G©;Ð7Ó8Ð8ð:Ø”)˜GŸM™M›OÑ,Ñ,ˆð �~Ø‰Ü˜¤×$Ñ$ÜÐ/°©zÐ:Ó;Ð;ð=Ø”(˜6Ÿ<™<›>Ñ*Ñ*ˆô �8Š8�JÓ€DØ„KØ€D„MÜ×Ñ˜DÓ!¤T§]¡]Ó2ÜØ?óAð 	Aà€Møô# ó :ÜÐ,¨W©KÐ8Ó9Ð9ð:ûô ó =ÜÐ0°±
Ð;Ó<Ð<ð=ús   ÁD ÂD% ÄD"Ä%D?c                 ó°  • [        U [        5      (       d  [        SU < 35      e[        U 5      nUR	                  S5      (       d  [        U 5      [        U5      :”  a  [        SU < 35      e[        UR                  S5      5      S:w  a  [        S5      eSU;   a  [        R                  nU$ SU;   a  [        R                  nU$ [        R                  nU$ )z=Check if mode is valid and return its integer representation.zInvalid mode: zxrwb+Úxrwr   z&mode must contain exactly one of 'xrw'rœ  r²   )r  r¿  r  r  Ú
differencerƒ  r  Úintersectionr   ÚSFM_RDWRÚSFM_READrÎ  )r
  Úmode_setr$  s      r¸   r  r  
  sÀ   € ä�dœC× Ñ Ü˜.¨©Ð1Ó2Ð2Ü�4‹y€HØ×Ñ˜7×#Ñ#¤s¨4£y´3°x³=Ó'@Ü˜>¨$©Ð2Ó3Ð3Ü
ˆ8× Ñ  Ó'Ó(¨AÓ-ÜÐAÓBÐBà
ˆhƒÜ—=‘=ˆð
 €Oð	 
�‹Ü—=‘=ˆð €Oô —>‘>ˆØ€Orà   c                 óŒ  • UnUc#  [        X5      n[        U[        5      (       d   eO[        U5        [        R
                  " S5      nSU;  d  UR                  5       S:X  a;  Uc  [        S5      eX(l        Uc  [        S5      eX8l	        [        XEU5      Ul        U$ [        S X#XuU4 5       5      (       a  [        S5      eU$ )z*Check arguments and create SF_INFO struct.r9  r²   r1   zsamplerate must be specifiedzchannels must be specifiedc              3   ó(   #   • U  H  oS Lv •  M
     g 7frÊ   rñ   )Ú.0Úargs     r¸   Ú	<genexpr>Ú&_create_info_struct.<locals>.<genexpr>1  s   é € ð Iò +H 3˜$�ò +Hùs   ‚z\Not allowed for existing files (except 'RAW'): samplerate, channels, format, subtype, endian)Ú_get_format_from_filenamer  r¿  r  r   rD  r  r  rª   r«   r  r¬   Úany)	r¢   r
  rª   r«   r¬   r­   r®   Úoriginal_formatræ   s	            r¸   r  r    sÜ   € ð €OØ�~Ü*¨4Ó6ˆÜ˜&¤#×&Ñ&Ð&Ñ&ä�fÔä�8Š8�JÓ€DØ
�$ƒ˜&Ÿ,™,›.¨EÓ1ØÑÜÐ:Ó;Ð;Ø$ŒØÑÜÐ8Ó9Ð9Ø ŒÜ! &°6Ó:ˆŒð €Kô	 ñ IØ oÀñ+Hó I÷ Iñ Iäð Ló Mð Mà€Krà   c                 ó  • Sn[        U SU 5      n  [        R                  R                  U 5      S   SS nUR	                  SS5      nUR                  5       [        ;  a  SU;  a  [        S	U < 35      eU$ ! [
         a     N;f = f)
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).

rK  rÌ   r2  r   Nr    r¡   r²   zBNo format specified and unable to get format from file extension: )	r  r  rÁ  ÚsplitextrH  Ú	Exceptionr  rH   r  )r¢   r
  r¬   s      r¸   rJ  rJ  8  s—   € ð €FÜ�4˜ Ó&€Dðä—‘×"Ñ" 4Ó(¨Ñ,¨Q¨RÐ0ˆà—‘˜w¨	Ó2ˆð ‡|�|ƒ~œXÓ%¨#°T«/Üð +Ø+/©(ð4ó 5ð 	5à€Møô ó Ùðús   ‘7A7 Á7
BÂBc                 ó|   • [         [        [        4 H'  nUR                  5        H  u  p#X0:X  d  M  Us  s  $    M)     g)z;Return the string representation of a given numeric format.zn/a)rH   r…   rŠ   r$  )Ú
format_intÚ
dictionaryÚkÚvs       r¸   r2  r2  P  s7   € ä¤	¬8Ó3ˆ
Ø×$Ñ$Ö&‰DˆAØ�Ø”ó 'ñ 4ð
 rà   c                 óN  • [         R                  " S5      nXl        [        R	                  [         R
                  X[         R                  " S5      5        UR                  n[        UR                  5      U(       a'  [         R                  " U5      R                  SS5      4$ S4$ )z6Return the ID and short description of a given format.zSF_FORMAT_INFO*ÚSF_FORMAT_INFOr    r¡   rK  )r   rD  r¬   r   r  r   rF  rÌ   r2  rG  rH  )rQ  Úformat_flagrÎ   rÌ   s       r¸   r;  r;  Z  s‡   € ä—(’(Ð,Ó-€KØ#ÔÜ‡O�O”D—I‘I˜{Ü—K’KÐ 0Ó1ô3à×Ñ€DÜ˜×*Ñ*Ó+Þ<@ŒD�KŠK˜Ó×$Ñ$ W¨iÓ8ðJð JØFHðJð Jrà   c              #   óî   #   • [         R                  " S5      n[        R                  [         R                  X[         R
                  " S5      5        [        US   5       H  n[        X15      v •  M     g7f)z8Helper for available_formats() and available_subtypes().zint*rŽ   r   N)r   rD  r   r  r   rF  Úranger;  )Ú
count_flagrW  rä  rQ  s       r¸   rõ   rõ   e  sM   é € ä�HŠH�VÓ€EÜ‡O�O”D—I‘I˜z´$·+²+¸eÓ2DÔEÜ˜E !™H–oˆ
Ü˜:Ó3Ô3ò &ùs   ‚A3A5c                 ó¸   • [        U [        5      (       d  [        SU < 35      e [        U R	                  5          nU$ ! [
         a    [        SU < 35      ef = f)z4Check if `format_str` is valid and return format ID.zInvalid format: zUnknown format: )r  r¿  r  rH   r  r  r  )Ú
format_strrQ  s     r¸   r  r  m  sf   € ä�j¤#×&Ñ&ÜÐ*¨:©.Ð9Ó:Ð:ð<Ü˜j×.Ñ.Ó0Ñ1ˆ
ð Ðøô ó <ÜÐ+¨J©>Ð:Ó;Ð;ð<ús	   ¦? ¿Ac           	      ó  • U[         R                  :H  nU[         R                  :H  n[        [	        U S5      [	        U S5      [	        U S5      =(       d    U[	        U S5      =(       d    [	        U S5      =(       d    U/5      $ )z>Check if file has all the necessary attributes for virtual IO.r  r~  rÁ   rµ   râ  )r   rB  rÎ  ÚallÚhasattr)r¢   r$  ÚreadonlyÚ	writeonlys       r¸   rÌ  rÌ  x  sn   € àœ4Ÿ=™=Ñ(€HØœDŸN™NÑ*€IÜÜ��fÓÜ��fÓÜ��gÓ×* (Ü��fÓ×G¤¨¨zÓ!:×G¸ið	ó ð rà   c                   ó   • \ rS rSrSrSrg)ÚSoundFileErrori„  z-Base class for all soundfile-specific errors.rñ   N©rê   rë   rì   rí   rî   rð   rñ   rà   r¸   rc  rc  „  s   † Ù7Úrà   rc  c                   ó   • \ rS rSrSrSrg)r�  iˆ  zGsoundfile module runtime error.

Errors that used to be `RuntimeError`.rñ   Nrd  rñ   rà   r¸   r�  r�  ˆ  s   † ñ.ò 	rà   r�  c                   óX   • \ rS rSrSrSS\S\SS4S jjr\S\4S j5       r	S\4S	 jr
S
rg)rª  iŽ  zVlibsndfile errors.


Attributes
----------
code
    libsndfile internal error number.
Úcoder¾  r°   Nc                 óH   • [         R                  XU5        Xl        X l        g rÊ   )r�  rÓ   rg  r¾  )rÒ   rg  r¾  s      r¸   rÓ   ÚLibsndfileError.__init__—  s   € Ü×&Ñ& t°6Ô:ØŒ	Ø�rà   c                 ó°   • U R                   (       aE  [        R                  U R                   5      n[        R                  " U5      R                  SS5      $ g)zRaw libsndfile error message.r    r¡   z'(Garbled error message from libsndfile))rg  r   Úsf_error_numberr   rG  rH  )rÒ   Úerr_strs     r¸   Úerror_stringÚLibsndfileError.error_stringœ  s@   € ð �9�9Ü×*Ñ*¨4¯9©9Ó5ˆGÜ—;’;˜wÓ'×.Ñ.¨w¸	ÓBÐBð
 =rà   c                 ó4   • U R                   U R                  -   $ rÊ   )r¾  rm  r'  s    r¸   Ú__str__ÚLibsndfileError.__str__¨  s   € Ø�{‰{˜T×.Ñ.Ñ.Ð.rà   )rg  r¾  ©rK  )rê   rë   rì   rí   rî   rŽ   r¿  rÓ   rï   rm  rp  rð   rñ   rà   r¸   rª  rª  Ž  sH   † ññ˜Sð ¨#ð °tõ ð
 ð	=˜có 	=ó ð	=ð/˜÷ /rà   rª  )r2  r   Nr   FNNNNNNNT)NNNTNN)Nr   r2  r   Nr   FNNNNNNNT)FrÊ   )NNrr  )mrî   Ú__version__Úosr  ÚsysrÈ  Ú	threadingr5  Úcollections.abcr   Úctypes.utilr   Ú_find_libraryr   r   r   Útypingr   r	   r
   r   r   r½   Útyping_extensionsr   Ú
_soundfiler   r   r¿  rŽ   r  r   Ú__annotations__ÚndarrayÚtupler¦   r   r   r   r   r   r   r   r-   rô   rH   r…   rŠ   r‹   r�   r”   rÉ  r–   Ú_machineÚ_packaged_libnameÚ	sysconfigÚ
_sysconfigÚget_platformÚ_win_machinerÃ  Ú_soundfile_datarÁ  ÚdirnameÚ__file__Ú_pathrä   Ú
_full_pathÚdlopenr   ÚImportErrorr  Ú_libnameÚ_explicit_libnameÚisdirÚ_hbrew_pathrG  Úsf_version_stringrH  Ú__libsndfile_version__Ú
startswithrƒ  r   r�   rµ   rÁ   rÆ   rÈ   ræ   rø   rþ   rü   r  r³   rb  r  r  r  rJ  r2  ÚSFC_GET_FORMAT_INFOr;  rõ   r  rÌ  rO  rc  ÚRuntimeErrorr�  rª  rñ   rà   r¸   Ú<module>r–     s\  ðò	ð €ã Û Û Ý %Ý 5ß +Ñ +ß ;Õ ;ã Ý "å "à"%¨¡)¨hÑ"6¸¿¹ÀcÑ9JÑ"JÐ �iÓ JØ—}‘} U¨3°¨8¡_°e·k±kÀ%Ç-Á-ÐRW×R_ÑR_ÑB_Ðbg×bmÑbmÑBmÐpu×p{Ñp{ÑB{Ñ6|Ð%|Ñ}€	ˆ9Ó }ØŸ-™-¨¨c°3¨h©¸¿¹ÀUÇ]Á]ÐUZ×UbÑUbÑEbÐej×epÑepÑEpÐsx×s~Ñs~ÑE~Ñ9Ð(ñ  A€ˆió  AØÐEÑF€	ˆ9Ó FØ	ƒ	Ø	ƒ	ð ØØØØØØØØØñ%€
ˆE�$�s˜C�x‘.Ñ!ó ð#Ø	ˆXð#à
ˆXð#ð 	ˆXð#ð 
ˆXð	#ð
 
ˆXð#ð 
ˆXð#ð ˆXð#ð 
ˆXð#ð ˆXð#ð 
ˆXð#ð ˆXð#ð ˆXð#ð 
ˆXð#ð 	ˆXð#ð 
ˆXð#ð  
ˆXð!#ð" 
ˆXð##ð$ ØØØØØØØØò5#€ˆ%��S˜#�X‘Ñ
ó ð:#$Ø�fð#$à�fð#$ð �fð#$ð �fð	#$ð
 �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð �fð#$ð  �fð!#$ð" �fñ##$ð$ �fð%#$ð& �fð'#$ð( �fð)#$ð* �fð+#$ð, �fð-#$ð. �fð/#$ð0 �fð1#$ð2 �fð3#$ð4 �fð5#$ð6 �fð7#$ð8 �fð9#$ð: �fð;#$ð< �fð=#$ð> �fð?#$ð@ �fðA#$ðB �fðC#$ðD �fñE#$€	ˆ5��c˜3�h‘Ñ ó #ðL ØØØñ	#€ˆ%��S˜#�X‘Ñ
ó ð,Ø	ˆXð,à
ˆXð,ð 	ˆXð,ð
 
ˆXð,ð 
ˆXð,ð ˆXð,ð 
ˆXð,ð ˆXð,ð 
ˆXð,ð ˆXð,ð ˆXð,ð 
ˆXð,ð 	ˆYð,ð 
ˆXð,ð  
ˆXð!,ð" 
ˆXð#,ð$ ˆXð%,ð& ØØØØØØØò5,Ð �5˜˜c 3˜h™Ñ(ó ð< ØØØñ	%€
ˆE�$�s˜C�x‘.Ñ!ó ð ØØñ)€��d˜3 ˜8‘nÑ%ó ð82Ø‡}�}˜Ó Ý0Ø)©H«JÑ6¸ÑAÑØ	�‰˜'Ó	!Û&à!×.Ò.Ó0ˆØ˜;Ó&Ø 6ÑØ˜[Ó(Ø 4ÑØ˜WÓ$Ø 4ÑáÐ<¸\¸NÐKÓLÐLØ	�‰˜'Ó	!Ý0Ù‹:ÐFÓFØ 5Ñà -±³
Ñ :¸UÑ BÑáÐ=Ó>Ð>ãØ�H‰H×Ñ˜_×5Ñ5Ó6€EØ—‘—‘˜uÐ&7Ó8€JØ�;Š;�zÓ"€Dð< Ÿš T×%;Ñ%;Ó%=Ó>×EÑEÀgÈyÓYÐ Ø×$Ñ$ ]×3Ñ3Ø3±C¸Ó4FÐ4GÐHÐð t}ØimØuyØ37ñ\Ð#ð \¨Sð \¸cð \ÈSÐSWÉZð \Ðgpð \Øð\Ø-2°T©\ð\ØGPÐS_ÑG_ÐbfÑGfð\à˜$‘Jð\à14°t±ð\àLOÐRVÉJð\àhkÐnrÑhrð\ð �d‘
ð\ð -1ð\ð =BÀ)ÈlÑBZÐ\_ÐB_Ñ<`õ\ðB <@Ø59Ø,0Ø%)ñ	9Ð$ð 9¨Ið 9À3ð 9Ø˜‘:ð9Ø.1°D©jð9à˜‘*ð9à.2ð9ð # T™\ð9ð ˜d™
ð	9ð /3õ	9ðv @DØ<=Ø7@Ø?CØQUØ=AØ<@Øñ:[Ð%ð :[°#¸±*ð :[Øð:[Ø%(ð:[Ø69ð:[à�t‘ð:[à+4ð:[ð ð:[ð 16¸±ð:[ð ˜LÑ(¨4Ñ/ð	:[ð EHÈ$ÁJð	:[ð
 ˜4‘Zð:[ð
 14°d±
ð:[ð ˜$‘Jð:[ð 03°T©zð:[ð ð:[ð %.¨i¸¸tÐ.CÑ$DÀyÐQ]Ð_cÐeiÐQiÑGjÑ$jõ:[÷z1ñ 1ñh)Ð#ð )¨dð )¸~õ )ðF˜4  S ™>ô Fñ*D˜s T™zð D°T¸#¸s¸(±^õ Dð. 59Ø&*ñ˜ð  s¨T¡zð Ø˜t™ðØ/3õð&1˜Cð 1 C¨$¡Jô 1÷ Z[ñ Z[ôz2òò@ò&ò6ò0ð *.×)AÑ)Aô Jò4òò	ô	�Yô 	ô	˜N¨Lô 	ô/Ð+õ /øð]. 	�˜iÐ(ó 2ð2Ù  Ó+ˆØÑÙÐTÓUÐUØ�{Š{˜8Ó$‹øàó 2à�=‰=˜HÓ$Ø 2ÑØ�]‰]˜gÓ%Ø 0ÑØ�]‰]˜gÓ%Ø /Ñàõ 	1Ø�=‰=˜HÓ$©«°wÓ)>Ø25·(±(·.±.ÐAU×2VÑ2VÑ.Ø&ð à—;’;˜sŸx™xŸ}™}¨[Ð:KÓLÓMŒDà—;’;Ð0Ó1ŒDð'2úð2ús8   ÊD U- Õ-	Y/Õ7%VÖB1Y+ÙY/ÙY+Ù&Y/Ù*Y+Ù+Y/