# UniTAP.dev.ports.modules.ag.ag

class AudioGenerator:

Class `AudioGenerator` allows working with generating audio from Source (TX - transmitter). You can configure audio generator `setup`, apply settings and start generate audio `apply`, stop generate audio `stop_generate`, read audio generator `status` and get current `audio_mode`.

AudioGenerator( port_io: UniTAP.libs.lib_tsi.tsi_io.PortIO, memory_manager: UniTAP.dev.modules.memory_manager.memory_manager.MemoryManager)
def setup( self, audio_mode: UniTAP.common.audio_mode.AudioMode = < UniTAP.common.audio_mode.AudioMode object>, audio_pattern: Union[ UniTAP.dev.ports.modules.ag.types.AudioPattern , str] = <AudioPattern.SignalSine: 0>, signal_frequency: int = 1000, amplitude: int = 60):

Configure audio generator. Possible two variants of configuration:

- From 'wav' or 'bin' file.
- From `AudioPattern` parameters.

###### Arguments:

- audio_mode (AudioMode) - object of `AudioMode`
- audio_pattern (Union[AudioPattern, str]) - object of `AudioPattern` or path to audio file ('bin' or 'wave')
- signal_frequency (int)
- amplitude (int)

def apply(self) -> bool:

Apply settings and start generate audio.

###### Returns:

> object of `bool` type - generation was enabled successfully or not.

def stop_generate(self) -> bool:

Stop generate audio.

###### Returns:

> object of `bool` type - generation was disabled successfully or not.

status: UniTAP.dev.ports.modules.ag.types.AGStatus

Return audio generator status.

###### Returns:

> object of `AGStatus` type

audio_mode: UniTAP.common.audio_mode.AudioMode

Return current audio mode.

###### Returns:

> object of `AudioMode` type