TrainSpeaker
Trains Media Server to recognize a speaker.
Running this action is equivalent to running the following actions in the following order:
- NewSpeaker
- AddSpeakerAudio
- AddSpeakerMetadata (optional)
- BuildSpeaker
- NullSpeakerAudioData (optional)
Type: asynchronous
| Parameter | Description | Required |
|---|---|---|
audiodata
|
The audio data to use for training. Send files to Media Server using a multipart/form-data HTTP POST request. | Set this or audiopath |
audiopath
|
The path of the audio file to use for training. The path must be absolute, or relative to the Media Server executable file. | Set this or audiodata |
database
|
The name of the database to add the speaker to. The database must already exist. | Yes |
identifier
|
A unique identifier for the speaker (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically. | No |
metadata
|
A comma-separated list of metadata key-value pairs to add to the speaker. Separate keys from values using a colon (:). To include a comma or colon in a key name or value, you must enclose the key name or value in quotation marks (") and escape any quotation marks that occur within the string with a backslash (\). |
No |
nullaudiodata
|
A Boolean value (default false) that specifies whether to discard the audio data when training is complete, rather than storing it in the database. | No |
numparallel
|
The maximum number of threads to use to complete the training (default 1), subject to the limit specified by MaxNumParallel. |
No |
Example
The following example trains Media Server by sending the path of an audio file:
curl http://localhost:14000/action=TrainSpeaker
-F database=news
-F identifier=newsreader
-F audiopath=newsreader.wav
Alternatively, you can train Media Server by sending the audio data, for example:
curl http://localhost:14000/action=TrainSpeaker
-F database=news
-F identifier=newsreader2
-F audiodata=@newsreader2.wav
Response
This action is asynchronous, so Media Server always returns success accompanied by a token. You can use this token with the QueueInfo action to retrieve the status of your request.
<autnresponse>
<action>QUEUEINFO</action>
<response>SUCCESS</response>
<responsedata>
<actions>
<action>
<status>Finished</status>
<queued_time>2024-Apr-25 14:20:30</queued_time>
<time_in_queue>8</time_in_queue>
<process_start_time>2024-Apr-25 14:20:38</process_start_time>
<time_processing>371</time_processing>
<process_end_time>2024-Apr-25 14:26:49</process_end_time>
<build>
<audio>
<index>1</index>
<label>256f1729b84a8350f0185d5d67c8cace</label>
<status>trained</status>
</audio>
</build>
<database>news</database>
<identifier>newsreader</identifier>
<numaudio>1</numaudio>
<numtrained>1</numtrained>
<token>...</token>
</action>
</actions>
</responsedata>
</autnresponse>
The identifier element contains the identifier that was assigned to the new speaker.