o
    OZh                  
   @   s  d Z ddlZddlZddlmZmZmZmZ ddl	m
Z
 ejdddd e  ed	Zee g Zg Zd
d Zdd Ze
e eed d	deddeedZed ee eded  d ed ed ejjdedZed e  ed e  dS )zw pygame.examples.audiocapture

A pygame 2 experiment.

* record sound from a microphone
* play back the recorded sound
    N)get_audio_device_namesAudioDevice	AUDIO_F32AUDIO_ALLOW_FORMAT_CHANGE)set_post_mixiD         i   Tc                 C   s   t t| dS )ztThis is called in the sound thread.

    Note, that the frequency and such you request may not be what you get.
    N)sound_chunksappendbytes)Zaudiodeviceaudiomemoryview r   K/var/www/auris/lib/python3.10/site-packages/pygame/examples/audiocapture.pycallback    s   r   c                 C   s   t t|t| t |  dS )zTThis is called in the sound thread.

    At the end of mixing we get this data.
    N)printtypelen)Zpostmixr   r   r   r   postmix_callback*   s   r   )Z
devicenameZ	iscaptureZ	frequencyZaudioformatZnumchannels	chunksizeZallowed_changesr   zrecording with ''   z"Turning data into a pg.mixer.Sound    )bufferzplaying back recorded sound)__doc__ZpygameZpgtimeZpygame._sdl2r   r   r   r   Zpygame._sdl2.mixerr   ZmixerZpre_initinitnamesr   Zsoundsr	   r   r   ZaudiopausesleepZSoundjoinsoundZplayquitr   r   r   r   <module>   sD   
	


