
    %jk                     2   d dl Z d dlZd dlmZ ddlmZ dZ	 d dlZ ej                    5   ej	        de
            ej	        de           d dlZd dlZddd           n# 1 swxY w Y   n# e$ r  ej                    ZY nw xY wddd	ed
edefdZdS )    N)BinaryIO   )MissingDependencyExceptionignore)categorywav)audio_formatfile_streamr	   returnc                   t           9t          d          t           d                             t           d                   |dv r| }nw|dv rat          j                            | |          }t          j                    }|                    |d           |	                    d           nt          d	|           t          j                    }t          j        |          5 }|                    |          }|                    |                                          }|d
k    rdn|cd d d            S # 1 swxY w Y   d S )NzSpeech transcription requires installing MarkItdown with the [audio-transcription] optional dependencies. E.g., `pip install markitdown[audio-transcription]` or `pip install markitdown[all]`   r   )r   aiffflac)mp3mp4)formatr   r   zUnsupported audio format:  z[No speech detected])_dependency_exc_infor   with_tracebackpydubAudioSegment	from_fileioBytesIOexportseek
ValueErrorsr
Recognizer	AudioFilerecordrecognize_googlestrip)r
   r	   audio_sourceaudio_segment
recognizersourceaudio
transcripts           o/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/markitdown/converters/_transcribe_audio.pytranscribe_audior+      s   '( M
 
#

. #
 
		
 ..."		'	'*44[4VVz||\%888!DlDDEEEJ	l	#	# Jv!!&))0077==??
)3r)9)9%%zJ J J J J J J J J J J J J J J J J Js   &AD99D= D=)r   systypingr   _exceptionsr   r   warningscatch_warningsfilterwarningsDeprecationWarningSyntaxWarningspeech_recognitionr   r   ImportErrorexc_infostrr+        r*   <module>r:      s~   				 



       4 4 4 4 4 4  *OOO	 	 	"	"  3EFFFF=AAAA''''	              
  * * *'3<>>*
 DI J J J( JS JS J J J J J Js4   A0 -A$A0 $A((A0 +A(,A0 0BB