Elevenlabs Speech Synthesis

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIS. - AI Speech Synthesis >

Elevenlabs Speech Synthesis

AIS.Post Any

Previous Top Next


MiniRobotLanguage (MRL)

 

AIS.Post Any

Executes custom POST requests to Elevenlabs.io API.

 

 

Intention

 

This command is particularly useful for advanced users who need to perform custom operations that are not covered by the standard AIS. commands.

The AIS.Post Any command is used to execute POST requests to various endpoints of the Elevenlabs.io API.
The output will always be in an file that is to be specified in P5.

The command takes up to 6 parameters, with P1 specifying the endpoint number (1-9) to which the POST request will be sent.

 

Number

Endpoint

Description

1

/v1/text-to-speech/{voice_id}

Text To Speech

P2= voice_id

2

/v1/text-to-speech/{voice_id}/stream

Text To Speech Stream

P2= voice_id

3

/v1/voices/{voice_id}/settings/edit

Edit Voice Settings   P2= voice_id

4

/v1/voices/add

Add Voice

5

/v1/voices/{voice_id}/edit

Edit Voice P2= voice_id

6

/v1/history/download

Download History Items

7

/v1/projects/add

Add Project

8

/v1/projects/{project_id}/convert

Convert Project P2= project_id

9

/v1/projects/{project_id}/chapters/{chapter_id}/convert

Convert Chapter P2= project_id

P3= chapter_id

10

Custom URL in OptionalParam2

User Defined Endpoint

 

 

 

' Sample calling Endpoint 1

' will create an mp3-file as result

'

'***********************************

' AIS.-Sample

'***********************************

AIS.Set Key|file

' Prepare JSON

$$TXT=Hallo how are you today

VAR.$$PJ1=eleven_multilingual_v2

VFP.$$PJ2=0.5

VFP.$$PJ3=0.75

VFP.$$PJ4=0

VFP.$$PJ5=1

AIS.Generate Json|$$TXT|$$PJ1|$$PJ2|$$PJ3|$$PJ4|$$PJ5|$$JSO

' See used JSON in Editor

DBP.$$JSO

 

' Endpoint to call

VIN.$$PA1=1

 

' Get Voice ID to $$PA2

AIS.Get Any Voice Id|2|$$PA2

 

' Define Output File

VAF.$$OUF=?exeloc\Outfile.mp3

 

AIS.Post Any|$$PA1|$$PA2|$$PA3|$$JSO|$$OUF|$$RET

MBX.$$RET

ENR.

 

 

'***********************************

' AIS.-Sample 2

' Here we define the JSON manually that gives you perfect flexibility

'***********************************

AIS.Set Key|file

$$TXT=Hallo how are you today

VAR.$$PJ1=eleven_multilingual_v2

VAR.$$PJ5=0

$$JSO={  "text": "$$TXT",

$$JSO+  "model_id": "$$PJ1",

$$JSO  "voice_settings": {

$$JSO    "stability": 0,

$$JSO    "similarity_boost": $$PJ5,

$$JSO    "use_speaker_boost": true

$$JSO  }}

VIN.$$PA1=1

AIS.Get Any Voice Id|2|$$PA2

VAF.$$OUF=?exeloc\Outfile.mp3

AIS.Post Any|$$PA1|$$PA2|$$PA3|$$JSO|$$OUF|$$RET

' Please see Outfile.mp3

MBX.$$RET

ENR.

 

Syntax

 

 

AIS.Post Any|P1|P2|P3|P4[|P5]

AIS.Pan|P1|P2|P3|P4[|P5]

 

 

Parameter Explanation

 

P1: Required. An integer between 1-9 representing the API endpoint. See  table above.

P2: Required or not - depending on P1. The first parameter for the API call.

P3: Required or not - depending on P1. The second parameter for the API call.

P4: Required or not - depending on P1. The JSON body to be sent with the API call. This may be useful for special options like P1=15.

P5: Optional Filename for result. if omitted or empty, a temporary file is created, the filename is on TOS.

P6: Optional. The variable where the API response will be stored. If omitted, TOS is used.
     Please do not use binary returns (like wav or mp3 formats) that may be in P6, these are invalid due to technical limitations.
     Always use the result from the File in P5.
    The content in P6 may vary, depending on the Endpoint and if there is an error or not, P6 may contain an message with an error,
     but may also contain invalid binary data.

 

 

Example

 

' Sample calling Endpoint 1

' will create an mp3-file as result

'

'***********************************

' AIS.-Sample

'***********************************

AIS.Set Key|file

' Prepare JSON

$$TXT=Hallo how are you today

VAR.$$PJ1=eleven_multilingual_v2

VFP.$$PJ2=0.5

VFP.$$PJ3=0.75

VFP.$$PJ4=0

VFP.$$PJ5=1

AIS.Generate Json|$$TXT|$$PJ1|$$PJ2|$$PJ3|$$PJ4|$$PJ5|$$JSO

' See used JSON in Editor

DBP.$$JSO

 

' Endpoint to call

VIN.$$PA1=1

 

' Get Voice ID to $$PA2

AIS.Get Any Voice Id|2|$$PA2

 

' Define Output File

VAF.$$OUF=?exeloc\Outfile.mp3

 

' Generate an MP3-File like with the commands that are easier for that purpose.

AIS.Post Any|$$PA1|$$PA2|$$PA3|$$JSO|$$OUF|$$RET

MBX.$$RET

ENR.

 

 

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: