# Add Speakers to a Database

To add a speaker to a speaker database, follow these steps.

To add a speaker

1. Create a new speaker using the `NewSpeaker` action. Set the following parameters:

   `database` | The name of the database to add the speaker to. The database must already exist.
   `identifier` | (Optional) A unique identifier for the speaker (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically.

   For example:

       curl http://localhost:14000 -F action=NewSpeaker
                                   -F database=news
                                   -F identifier=newsreader

   Media Server adds the speaker and returns the identifier.

2. Add audio samples for the speaker using the `AddSpeakerAudio` action. Set the following parameters:

   `database` | The name of the database that contains the speaker.
   `identifier` | The identifier for the speaker, as returned by the `NewSpeaker` action.
   `audiodata` | (Set this or `audiopath`, but not both). The audio data to add. Files must be uploaded as multipart/form-data. For more information about sending data to Media Server, see Send Data by Using a POST Method.
   `audiopath` | (Set this or `audiodata`, but not both). A comma-separated list of paths to the audio files. The paths must be absolute or relative to the Media Server executable file.
   `audiolabels` | (Optional) A comma-separated list of labels to identify the audio samples that you are adding (maximum 254 bytes for each label). Every audio sample added to the same speaker must have a unique label, so the number of labels must match the number of samples provided using either `audiodata` or `audiopath`. If you do not set this parameter, Media Server generates labels automatically.

   For example:

       curl http://localhost:14000 -F action=AddSpeakerAudio
                                   -F database=news
                                   -F identifier=newsreader
                                   -F audiodata=@sample1.wav,sample2.wav
                                   -F audiolabels=sample1,sample2

3. Train Media Server to recognize the speaker by running the `BuildSpeaker` action. Set the following parameters:

   `database` | The name of the database that contains the speaker.
   `identifier` | The identifier for the speaker, as returned by the `NewSpeaker` action.

   For example:

       curl http://localhost:14000 -F action=BuildSpeaker
                                   -F database=news
                                   -F identifier=newsreader

_FT_HTML5_bannerTitle.htm