§
    ØŽ’jk  ã            	       ó2   — d Z ddlZ	 	 	 ddededed	efd
„ZdS )z.Audio utilities shared across model providers.é    NéÀ]  é   é   Úsample_rateÚchannelsÚbits_per_sampleÚreturnc           
      óø   — | |z  |z  dz  }||z  dz  }dt          j        dd¦  «        z   dz   dz   t          j        dd¦  «        z   t          j        dd	|| |||¦  «        z   d
z   t          j        dd¦  «        z   S )a\  Build a 44-byte WAV/RIFF header for streaming PCM.

    The RIFF and ``data`` chunk sizes are set to ``0xFFFFFFFF`` since the
    total length isn't known yet. Decoders that only need sample-rate,
    channel count and bit depth (e.g. the web ``WavStreamPlayer``) treat
    everything after the ``data`` chunk header as PCM, so this is
    sufficient for live decoding of an open-ended stream.

    Both DashScope omni and OpenAI streaming deliver raw PCM upstream;
    prefixing the first chunk with this header lets the frontend start
    playback immediately without buffering the whole response.
    é   s   RIFFz<Il   ÿÿ s   WAVEs   fmt r   z<HHIIHHr   s   data)ÚstructÚpack)r   r   r   Ú	byte_rateÚblock_aligns        úFC:\Projects\DSCons\.venv\Lib\site-packages\agentscope\_utils\_audio.pyÚ_build_streaming_wav_headerr      s¶   € ð" ˜hÑ&¨Ñ8¸AÑ=€IØ˜_Ñ,°Ñ1€KàÝ
Œ+�d˜JÑ
'Ô
'ñ	(à
ñ	ð ñ	õ Œ+�d˜BÑ
Ô
ñ		 õ
 Œ+ØØØØØØØñ
ô 
ñ	
ð ñ	õ Œ+�d˜JÑ
'Ô
'ñ	(ðó    )r   r   r   )Ú__doc__r   ÚintÚbytesr   © r   r   ú<module>r      sf   ðà 4Ð 4Ø €€€ð ØØð$ð $Øð$àð$ð ð$ð ð	$ð $ð $ð $ð $ð $r   