o
    lWi                     @   sn   d dl Z ddlmZmZ ddlmZ ddlmZmZ ddl	m
Z
 e e jdZG d	d
 d
ZG dd dZdS )    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions   ) AsyncRawTextToSoundEffectsClientRawTextToSoundEffectsClient),TextToSoundEffectsConvertRequestOutputFormat.c                   @      e Zd ZdefddZedefddZdeeeeddd	e	d
e
je de
je de
je de
je de
je	 de
je de
je fddZdS )TextToSoundEffectsClientclient_wrapperc                C      t |d| _d S N)r   )r   _raw_clientselfr    r   k/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/text_to_sound_effects/client.py__init__      z!TextToSoundEffectsClient.__init__returnc                 C      | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawTextToSoundEffectsClient
        r   r   r   r   r   with_raw_response      	z*TextToSoundEffectsClient.with_raw_responseNoutput_formatloopduration_secondsprompt_influencemodel_idrequest_optionstextr   r   r   r    r!   r"   c          	   	   c   sN    | j j|||||||d}|jE dH  W d   dS 1 s w   Y  dS )u{  
        Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world.

        Parameters
        ----------
        text : str
            The text that will get converted into a sound effect.

        output_format : typing.Optional[TextToSoundEffectsConvertRequestOutputFormat]
            Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs.

        loop : typing.Optional[bool]
            Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'.

        duration_seconds : typing.Optional[float]
            The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None.

        prompt_influence : typing.Optional[float]
            A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3.

        model_id : typing.Optional[str]
            The model ID to use for the sound generation.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.Iterator[bytes]
            The generated sound effect as an MP3 file

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.text_to_sound_effects.convert(
            text="Spacious braam suitable for high-impact movie trailer moments",
        )
        r#   r   r   r   r    r!   r"   Nr   convertdata)	r   r#   r   r   r   r    r!   r"   rr   r   r   r&      s   5"z TextToSoundEffectsClient.convert)__name__
__module____qualname__r   r   propertyr   r   OMITstrtypingOptionalr	   boolfloatr   Iteratorbytesr&   r   r   r   r   r      6    	
r   c                   @   r
   )AsyncTextToSoundEffectsClientr   c                C   r   r   )r   r   r   r   r   r   r   _   r   z&AsyncTextToSoundEffectsClient.__init__r   c                 C   r   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawTextToSoundEffectsClient
        r   r   r   r   r   r   b   r   z/AsyncTextToSoundEffectsClient.with_raw_responseNr   r#   r   r   r   r    r!   r"   c          
   	   C  sr   | j j|||||||d4 I dH }|j2 z	3 dH W }	|	V  q6 W d  I dH  dS 1 I dH s2w   Y  dS )u  
        Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world.

        Parameters
        ----------
        text : str
            The text that will get converted into a sound effect.

        output_format : typing.Optional[TextToSoundEffectsConvertRequestOutputFormat]
            Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs.

        loop : typing.Optional[bool]
            Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'.

        duration_seconds : typing.Optional[float]
            The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None.

        prompt_influence : typing.Optional[float]
            A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3.

        model_id : typing.Optional[str]
            The model ID to use for the sound generation.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.AsyncIterator[bytes]
            The generated sound effect as an MP3 file

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.text_to_sound_effects.convert(
                text="Spacious braam suitable for high-impact movie trailer moments",
            )


        asyncio.run(main())
        r$   Nr%   )
r   r#   r   r   r   r    r!   r"   r(   _chunkr   r   r   r&   m   s   =.z%AsyncTextToSoundEffectsClient.convert)r)   r*   r+   r   r   r,   r   r   r-   r.   r/   r0   r	   r1   r2   r   AsyncIteratorr4   r&   r   r   r   r   r6   ^   r5   r6   )r/   core.client_wrapperr   r   core.request_optionsr   
raw_clientr   r   9types.text_to_sound_effects_convert_request_output_formatr	   castAnyr-   r   r6   r   r   r   r   <module>   s   P