o
    tVg                  
   @   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)audiodeviceaudiomemoryview r   P/home/ubuntu/.local/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)postmixr   r   r   r   postmix_callback*   s   r   )
devicename	iscapture	frequencyaudioformatnumchannels	chunksizeallowed_changesr   zrecording with ''   z"Turning data into a pg.mixer.Sound    )bufferzplaying back recorded sound)__doc__pygamepgtimepygame._sdl2r   r   r   r   pygame._sdl2.mixerr   mixerpre_initinitnamesr   soundsr	   r   r   audiopausesleepSoundjoinsoundplayquitr   r   r   r   <module>   sD   
	


