CoolFace
Apppublic

Shailesh-Kumar/bsc-voice-agent-openai

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
utils.cpython-311.pyc25 linesDownload Raw Back to __pycache__
1�

2�f3h��4��ddlZddlZdefd�Zdejdefd�Zdededed	edejf5d6�Z	dededed	edejf7d�Z8dS)
�N�returnc�N�ddl}t|�|����S)z)Hash function to detect code changes9    rN)�inspect�hash�	getsource)�objrs  �.E:\Futwork-dev\bsc-voice-agent-openai\utils.py�hash_by_coder10s)���N�N�N���!�!�#�&�&�'�'�'��framec�N�|������S)N)�11to_ndarray�tobytes)rs r	�audio_frame_to_pcm_audior
s �������%�%�'�'�'r�	pcm_audio�format�layout�sample_ratec��tj|tj���dd��}tj�|||���}||_|S)N������)rr)�np�12frombuffer�int16�reshape�av�13AudioFrame�from_ndarrayr)rrrr�raw_datars      r	�pcm_audio_to_audio_framer sP���}�Y���1�1�9�9�!�R�@�@�H��M�&�&�x�&�6�&�R�R�E�#�E���Lr�samplesc��tj|||���}|jD])}|�t	|j�����*||_|S)N)rrr!)rr�planes�update�bytes�buffer_sizer)rrr!rr�ps      r	�get_blank_audio_framer(sW��
�M�6�F�g�N�N�N�E�
�\�'�'��	����q�}�%�%�&�&�&�&�#�E���Lr)r�numpyr�intr14rr%r�strr r(�rr	�<module>r-s���	�	�	�	�����(��(�(�(�(�(�B�M�(�e�(�(�(�(�15��16�
�17�
�	18�19�20��]�
21�22�23�24����
���	�25���]�
�����r