Add a Clip to the Database

After creating a database, train Media Server to recognize each audio clip by running the action TrainAudioMatchClip.

To add an audio clip to the database

  • Add a clip using the action TrainAudioMatchClip. Set the following parameters:

    database The name of the database to add the clip to. The database must already exist.
    identifier (Optional) A unique identifier for the clip (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically.
    audiodata (Set this or audiopath, but not both). The audio data. 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). The path of the audio clip. The path must be absolute or relative to the Media Server executable file.

    For example:

    curl http://localhost:14000 -F action=TrainAudioMatchClip
                                -F database=Music
                                -F audiodata=@clip1.wav

    Alternatively, the following example provides the path of the audio clip rather than sending the audio data:

    curl http://localhost:14000 -F action=TrainAudioMatchClip
                                -F database=Music
                                -F audiopath=clip1.wav

    Media Server adds the clip to the database and returns the identifier.