Voice API

class mini.apis.api_sound.TTSControlType(value)[source]

Bases: enum.Enum

TTS control type

START: start playing tts

STOP: Stop playing tts

START = 1
STOP = 0
class mini.apis.api_sound.StartPlayTTS(is_serial: bool = True, text: Optional[str] = None)[source]

Bases: mini.apis.base_api.BaseApi

Start playing TTS api

The robot plays the synthesized TTS voice

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • text (str) – The text to be played, cannot be empty or None

#ControlTTSResponse.isSuccess: Is it successful, True or False

#ControlTTSResponse.resultCode: Return code

async execute()[source]

Execute the TTS command to start playing

Returns

ControlTTSResponse

class mini.apis.api_sound.StopPlayTTS(is_serial: bool = True)[source]

Bases: mini.apis.base_api.BaseApi

Stop playing TTS api

The robot stops playing TTS voice

Parameters

is_serial (bool) – Whether to wait for a reply, the default is True

#ControlTTSResponse.isSuccess: Is it successful

#ControlTTSResponse.resultCode: Return code

async execute()[source]

Execute the stop playing TTS command

Returns

ControlTTSResponse

class mini.apis.api_sound.AudioStorageType(value)[source]

Bases: enum.Enum

Audio storage type

NET_PUBLIC: public network

PRESET_LOCAL: The robot is built locally

CUSTOMIZE_LOCAL: Robot local customization

NET_PUBLIC = 2
PRESET_LOCAL = 3
CUSTOMIZE_LOCAL = 4
class mini.apis.api_sound.PlayAudio(is_serial: bool = True, url: Optional[str] = None, storage_type: mini.apis.api_sound.AudioStorageType = AudioStorageType.NET_PUBLIC, volume: float = 1.0)[source]

Bases: mini.apis.base_api.BaseApi

Play audio api

The robot plays the specified audio, supports mp3, wav, amr, etc.

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • url (str) – audio address, when storage_type is NET_PUBLIC, url is the URL of the audio file; when storage_type is PRESET_LOCAL/CUSTOMIZE_LOCAL, url is the local audio name (the local audio name can be obtained through the FetchAudioList interface)

  • storage_type (AudioStorageType) – Audio storage type, default NET_PUBLIC, public network

  • volume (float) – volume size, range [0.0,1.0], default 1.0

#PlayAudioResponse.isSuccess: Is it successful

#PlayAudioResponse.resultCode: Return code

async execute()[source]

Execute the play audio command

Returns

PlayAudioResponse

class mini.apis.api_sound.StopAllAudio(is_serial: bool = True)[source]

Bases: mini.apis.base_api.BaseApi

Stop all audio APIs

The robot stops all audio being played

Parameters

is_serial (bool) – Whether to wait for a reply, the default is True

#StopAudioResponse.isSuccess: Is it successful

#StopAudioResponse.resultCode: Return code

async execute()[source]

Execute stop all audio commands

Returns

StopAudioResponse

class mini.apis.api_sound.AudioSearchType(value)[source]

Bases: enum.Enum

Audio query type

INNER (built-in): unmodifiable sound effects built into the robot,

CUSTOM (custom): placed in the sdcard/customize/music directory and can be modified by the developer

INNER = 0
CUSTOM = 1
class mini.apis.api_sound.FetchAudioList(is_serial: bool = True, search_type: mini.apis.api_sound.AudioSearchType = AudioSearchType.INNER)[source]

Bases: mini.apis.base_api.BaseApi

Get the audio list api of the robot

Get the audio list stored in the robot rom or sdcard

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • search_type (AudioSearchType) – search type, default INNER, built-in robot

#GetAudioListResponse.audio ([Audio]): Audio effect list

#Audio.name: Audio effect name

#Audio.suffix: audio suffix

#GetAudioListResponse.isSuccess: Is it successful

#GetAudioListResponse.resultCode: Return code

async execute()[source]

Execute get audio list command

Returns

GetAudioListResponse

class mini.apis.api_sound.ChangeRobotVolume(is_serial: bool = True, volume: float = 0.5)[source]

Bases: mini.apis.base_api.BaseApi

Set robot volume api

Adjust the robot volume

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • volume (float) – volume, range [0.0,1.0], default 0.5

#ChangeRobotVolumeResponse.isSuccess: Is it successful

#ChangeRobotVolumeResponse.resultCode: Return code

async execute()[source]

Send command to set robot volume

Returns

ChangeRobotVolumeResponse

class mini.apis.api_sound.RobotAudioRecordControlType(value)[source]

Bases: enum.Enum

Robot recording control type

START_RECORD = 0
STOP_RECORD = 1
START_PLAY = 2
STOP_PLAY = 3
PAUSE_PLAY = 4
CONTINUE_PLAY = 5
RENAME_FILE = 6
class mini.apis.api_sound.ControlRobotAudioRecord(is_serial: bool = True, control_type: mini.apis.api_sound.RobotAudioRecordControlType = RobotAudioRecordControlType.START_RECORD, time_limit: int = 60000, file_name: Optional[str] = None, new_file_name: Optional[str] = None)[source]

Bases: mini.apis.base_api.BaseApi

Control robot recording/playing api

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • control_type (RobotAudioRecordControlType) – control type, default START_RECORD, start recording

  • time_limit (int) – The length of the recording, in ms, the default is 60000ms, which is 60s

  • file_name (str) – Recording file storage name

  • new_file_name (str) – rename the name of the recording file

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

async execute()[source]

Send control recording instructions

Returns

ControlRobotRecordResponse

class mini.apis.api_sound.RobotAudioStartRecord(is_serial: bool = True, time_limit: int = 60000)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

Robot starts recording api

Control the robot to start recording

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • time_limit (int) – The length of the recording, in ms, the default is 60000ms, which is 60s

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

class mini.apis.api_sound.RobotAudioStopRecord(is_serial: bool = True)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

Robot stop recording api

Control the robot to stop recording

Parameters

is_serial (bool) – Whether to wait for a reply, the default is True

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

class mini.apis.api_sound.RobotAudioStartPlay(is_serial: bool = True, file_name: Optional[str] = None)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

The robot starts to play the recording api

Control the robot to start playing the recording

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • file_name (str) – recording file name, cannot be empty or None

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

class mini.apis.api_sound.RobotAudioStopPlay(is_serial: bool = True)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

The robot stops playing the recording api

Control the robot to stop playing the recording

Parameters

is_serial (bool) – Whether to wait for a reply, the default is True

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

class mini.apis.api_sound.RobotAudioPausePlay(is_serial: bool = True)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

The robot pauses the recording api

Control the robot to pause the recording

Parameters

is_serial (bool) – Whether to wait for a reply, the default is True

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

class mini.apis.api_sound.RobotAudioContinuePlay(is_serial: bool = True)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

The robot continues to play the recording api

Control the robot to continue playing the recording

Parameters

is_serial (bool) – Whether to wait for a reply, the default is True

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file

class mini.apis.api_sound.RobotAudioRenameFile(is_serial: bool = True, file_name: Optional[str] = None, new_file_name: Optional[str] = None)[source]

Bases: mini.apis.api_sound.ControlRobotAudioRecord

Robot rename recording file api

Control the robot to rename the recording file

Parameters
  • is_serial (bool) – Whether to wait for a reply, the default is True

  • file_name (str) – recording file name, cannot be empty or None

#ControlRobotRecordResponse.isSuccess: Is it successful

#ControlRobotRecordResponse.resultCode: Return code

#ControlRobotRecordResponse.id: The name of the generated recording file