o
    i>                  	   @   s   d dl mZmZmZmZmZ d dlZd dlm	Z	 d dl
mZ d dlmZ d dlmZmZ d dlmZ d dlmZ d d	lmZ d d
lmZ ddededeee  defddZdedeee ef fddZg dZdS )    )AnyIteratorListOptionalUnionN)LibsndfileError)aformat)Graph)
UINT32_MAX
AudioFrame)BackendInfo)Reader)StreamReaderFfileforced_decodingbackendsreturnc                 C   s   t | ||dS )am  
    Get the information of an audio file.

    Args:
        file: The input audio file, audio url, path to audio file, bytes of audio data, etc.
        forced_decoding: Whether to forced decoding the audio file to get the duration.
        backends: The list of backends to use to get the information.
    Returns:
        The information of the audio file.
    )r   r   r   )r   r   r    r   L/home/ubuntu/.local/lib/python3.10/site-packages/audiolab/reader/__init__.pyinfo   s   r   c              
   K   s   t | fi |}|jtk rt|S ztt|W S  ttfyA } zt|tr/t|dkr/|t	
g |jfW  Y d }~S d }~ww )NzInternal psf_fseek() failed.)r   
frame_sizer
   iternextStopIterationr   
isinstancestrnparrayrate)r   kwargsreaderer   r   r   
load_audio+   s   
r$   )r	   r   r   r   r$   )FN)typingr   r   r   r   r   numpyr   	soundfiler   audiolab.avr   audiolab.av.graphr	   audiolab.av.typingr
   r   audiolab.reader.backendr   audiolab.reader.infor   audiolab.reader.readerr   audiolab.reader.stream_readerr   boolr   r$   __all__r   r   r   r   <module>   s   $