Ejemplo n.º 1
0
 //Create Long Audio Dataset
 public void UploadLongAudioDataset(string waveZipUpload, string scriptZipUpload, string name, string description, string locale, string gender)
 {
     var properties = new Dictionary <string, string>
     {
         { "Gender", gender }
     };
     var datasetDefinition = new DatasetDefinition(name, description, locale, properties, "CustomVoice");
     var submitResponse    = VoiceAPIHelper.SubmitLongAudioDataset(datasetDefinition, waveZipUpload, scriptZipUpload, CreateLongAudioDatasetUrl, this.subscriptionKey);
 }
 public void CreateVoiceSynthesis(string name, string description, string locale, string inputTextPath, Guid modelId)
 {
     Console.WriteLine("Creating batch synthesiss.");
     var properties = new Dictionary <string, string>
     {
         { "ConcatenateResult", "true" }
     };
     var model = ModelIdentity.Create(modelId);
     var voiceSynthesisDefinition = VoiceSynthesisDefinition.Create(name, description, locale, model, properties);
     var submitResponse           = VoiceAPIHelper.SubmitVoiceSynthesis(voiceSynthesisDefinition, inputTextPath, VoiceSynthesisUrl, this.subscriptionKey);
 }
Ejemplo n.º 3
0
 //Create Endpoint
 public void CreateEndpoint(string name, string description, string locale, List <ModelIdentity> ModelIds)
 {
     var endpointDefinition = new EndpointDefinition(name,
                                                     description,
                                                     locale,
                                                     ModelIds,
                                                     null,
                                                     0,
                                                     false);
     var submitResponse = VoiceAPIHelper.Submit <EndpointDefinition>(endpointDefinition, CreateEndpointUrl, this.subscriptionKey);
 }
 //Create Models
 public void CreateModel(string name, string description, string locale, string gender, List<DatasetIdentity> DatasetIds)
 {
     var properties = new Dictionary<string, string>();
     properties.Add("Gender", gender);
     var modelDefinition = new ModelDefinition(name,
         description,
         locale,
         "CustomVoice",
         null,
         DatasetIds,
         properties);
     var submitResponse = VoiceAPIHelper.Submit<ModelDefinition>(modelDefinition, CreateModelUrl, this.subscriptionKey);
 }
 public async Task<Uri> CreateVoiceSynthesis(string name, string description, string locale, string outputFormat, string inputTextPath, IEnumerable<Guid> modelIds, bool concatenateResult)
 {
     Console.WriteLine("Creating batch synthesiss.");
     var properties = new Dictionary<string, string>();
     if (concatenateResult)
     {
         properties.Add("ConcatenateResult", "true");
     }
     var voiceSynthesisDefinition = VoiceSynthesisDefinition.Create(name, description, locale, outputFormat, modelIds, properties);
     using (var submitResponse = VoiceAPIHelper.SubmitVoiceSynthesis(voiceSynthesisDefinition, inputTextPath, VoiceSynthesisUrl, this.subscriptionKey))
     {
         return await GetLocationFromPostResponseAsync(submitResponse).ConfigureAwait(false);
     }
 }
Ejemplo n.º 6
0
        //Create Voice Test
        public void CreateVoiceTest(string ModelId, string script, bool isSSML)
        {
            VoiceTestDefinition testDefinition;

            if (isSSML)
            {
                testDefinition = new VoiceTestDefinition(new ModelIdentity(new Guid(ModelId)),
                                                         script,
                                                         "SSML");
            }
            else
            {
                testDefinition = new VoiceTestDefinition(new ModelIdentity(new Guid(ModelId)),
                                                         script,
                                                         "Text");
            }

            var submitResponse = VoiceAPIHelper.Submit <VoiceTestDefinition>(testDefinition, CreateVoiceTestUrl, this.subscriptionKey);
        }
Ejemplo n.º 7
0
        public void CreateBatchSynthesis(string name, string description, string locale, string inputTextPath, Guid modelId, string azureStorageConnectionString)
        {
            Console.WriteLine($"upload text to azure storage blob : {inputTextPath}");
            var containerName = "voicesynthesisinputfiles";

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(azureStorageConnectionString);
            var blobClient         = storageAccount.CreateCloudBlobClient();
            var containerReference = blobClient.GetContainerReference(containerName);

            containerReference.CreateIfNotExists();

            var fileName = $"SubscriptionKey_{Guid.NewGuid().ToString()}.txt";

            StorageHelper.UploadFileAsync(containerReference, fileName, inputTextPath);

            var textUrl = StorageHelper.GetBlobSas(blobClient, containerName, fileName, DateTime.MaxValue);


            Console.WriteLine("Creating batch synthesiss.");
            var model = ModelIdentity.Create(modelId);
            var batchSynthesisDefinition = BatchSynthesisDefinition.Create(name, description, locale, new Uri($"{ textUrl }"), model);
            var submitResponse           = VoiceAPIHelper.Submit <BatchSynthesisDefinition>(batchSynthesisDefinition, VoiceSynthesisUrl, this.subscriptionKey);
        }
Ejemplo n.º 8
0
 //Get VoiceTest
 public IEnumerable <VoiceTest> GetVoiceTests(string modelID)
 {
     return(VoiceAPIHelper.Get <VoiceTest>(this.subscriptionKey, string.Format(CultureInfo.InvariantCulture, GetVoiceTestsUrl, modelID)));
 }
Ejemplo n.º 9
0
 public IEnumerable <Voice> GetVoices()
 {
     return(VoiceAPIHelper.Get <Voice>(this.subscriptionKey, GetVoicesUrl));
 }
Ejemplo n.º 10
0
 //Get Model
 public IEnumerable <Model> GetModels()
 {
     return(VoiceAPIHelper.Get <Model>(this.subscriptionKey, GetModelsUrl));
 }
Ejemplo n.º 11
0
 //Get Endpoint
 public IEnumerable <Endpoint> GetEndpoints()
 {
     return(VoiceAPIHelper.Get <Endpoint>(this.subscriptionKey, GetEndpointsUrl));
 }
Ejemplo n.º 12
0
 public void UpdateSynthesis(Guid id, string newName, string newDesc)
 {
     VoiceAPIHelper.PatchVoiceSynthesis(VoiceSynthesisUpdate.Create(newName, newDesc), this.subscriptionKey, string.Format(CultureInfo.InvariantCulture, DeleteSynthesisUrl, id.ToString()));
 }
Ejemplo n.º 13
0
 //Get Dataset
 public IEnumerable <Dataset> GetDatasets()
 {
     return(VoiceAPIHelper.Get <Dataset>(this.subscriptionKey, GetDatasetsUrl));
 }
Ejemplo n.º 14
0
 public Synthesis GetSynthesis(Guid id)
 {
     return(VoiceAPIHelper.GetVoiceSynthesis(this.subscriptionKey, string.Format(CultureInfo.InvariantCulture, DeleteSynthesisUrl, id.ToString())));
 }
Ejemplo n.º 15
0
 public void DeleteSynthesis(Guid id)
 {
     VoiceAPIHelper.Delete(this.subscriptionKey, string.Format(CultureInfo.InvariantCulture, DeleteSynthesisUrl, id.ToString()));
 }
Ejemplo n.º 16
0
 public IEnumerable <Synthesis> GetSyntheses()
 {
     return(VoiceAPIHelper.Get <Synthesis>(this.subscriptionKey, VoiceSynthesisUrl));
 }
Ejemplo n.º 17
0
 //Get Dataset
 public List <Dataset> GetDatasets(string SubscriptionKey)
 {
     return(VoiceAPIHelper.Get <Dataset>(SubscriptionKey, GetDatasetsUrl));
 }
Ejemplo n.º 18
0
 //Get Model
 public List <Model> GetModels(string SubscriptionKey)
 {
     return(VoiceAPIHelper.Get <Model>(SubscriptionKey, GetModelsUrl));
 }
Ejemplo n.º 19
0
 //Get Endpoint
 public List <Endpoint> GetEndpoints(string SubscriptionKey)
 {
     return(VoiceAPIHelper.Get <Endpoint>(SubscriptionKey, GetEndpointsUrl));
 }
Ejemplo n.º 20
0
 //Get VoiceTest
 public List <VoiceTest> GetVoiceTests(string SubscriptionKey, string modelID)
 {
     return(VoiceAPIHelper.Get <VoiceTest>(SubscriptionKey, string.Format(CultureInfo.InvariantCulture, GetVoiceTestsUrl, modelID)));
 }