Search in sources :

Example 6 with AddWordOptions

use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions in project java-sdk by watson-developer-cloud.

the class CustomizationsIT method testSynthesize.

/**
 * Test synthesize.
 *
 * @throws IOException Signals that an I/O exception has occurred.
 */
@Test
public void testSynthesize() throws IOException {
    model = createVoiceModel();
    final Word expected = instantiateWords().get(0);
    AddWordOptions addOptions = new AddWordOptions.Builder().word(expected.getWord()).translation(expected.getTranslation()).customizationId(model.getCustomizationId()).build();
    service.addWord(addOptions).execute();
    SynthesizeOptions synthesizeOptions1 = new SynthesizeOptions.Builder().text(expected.getWord()).voice(SynthesizeOptions.Voice.EN_US_MICHAELVOICE).accept(SynthesizeOptions.Accept.AUDIO_WAV).build();
    final InputStream stream1 = service.synthesize(synthesizeOptions1).execute();
    SynthesizeOptions synthesizeOptions2 = new SynthesizeOptions.Builder().text(expected.getWord()).voice(SynthesizeOptions.Voice.EN_US_MICHAELVOICE).accept(SynthesizeOptions.Accept.AUDIO_WAV).customizationId(model.getCustomizationId()).build();
    final InputStream stream2 = service.synthesize(synthesizeOptions2).execute();
    assertFalse(TestUtils.streamContentEquals(stream1, stream2));
}
Also used : AddWordOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions) Word(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word) InputStream(java.io.InputStream) SynthesizeOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.SynthesizeOptions) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest) Test(org.junit.Test)

Aggregations

AddWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions)5 Word (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word)5 Test (org.junit.Test)5 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)3 ListWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions)3 Words (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words)3 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)2 DeleteWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteWordOptions)2 SynthesizeOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.SynthesizeOptions)2 InputStream (java.io.InputStream)2 MockResponse (okhttp3.mockwebserver.MockResponse)2 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2 AddWordOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddWordOptions)1 CustomWord (com.ibm.watson.developer_cloud.speech_to_text.v1.model.CustomWord)1 Word (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Word)1 AddWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions)1 CreateVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.CreateVoiceModelOptions)1 DeleteVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteVoiceModelOptions)1 GetWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions)1 ListVoiceModelsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListVoiceModelsOptions)1