Skip to content

Commit

Permalink
Merge pull request #133 from Azure-Samples/improveJavaSample
Browse files Browse the repository at this point in the history
Improve Custom voice API java sample
  • Loading branch information
neoguo0601 authored Sep 10, 2019
2 parents 7886245 + 70f7000 commit ff422d9
Show file tree
Hide file tree
Showing 94 changed files with 332 additions and 387 deletions.
4 changes: 2 additions & 2 deletions CustomVoice-API-Samples/Java/en-US.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is the waistline , and it's falling .
This is the waistline , and it's falling .
Alexis , meet Bill and Hillary , and the rest of America .
This is Jordan , Scottie Pippen and the ring dynasty .
The more I looked , the gloomier I got .
Expand Down Expand Up @@ -47,4 +47,4 @@ The industry has been cannibalizing itself .
The chiffon stretch , the chiffon silk , wool .
We thank you for your consideration , and look forward to hearing from you .
Like Philip Barry , Mike , the reporter , is an outsider .
The language in the settlement is unacceptable .
The language in the settlement is unacceptable .
184 changes: 117 additions & 67 deletions CustomVoice-API-Samples/Java/pom.xml
Original file line number Diff line number Diff line change
@@ -1,81 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>voiceSynthesis</groupId>
<artifactId>voiceSynthesis-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>CustomVoiceAPI-Java</groupId>
<artifactId>CustomVoiceAPI-Java</artifactId>
<version>1.0-SNAPSHOT</version>

<name>voiceSynthesis-java</name>
<url>http://maven.apache.org</url>
<name>CustomVoiceAPI-Java</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>


<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>logging-interceptor</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>logging-interceptor</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>
</dependencies>


<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package CustomVoiceAPI;

import java.io.File;
import java.util.List;
import java.util.UUID;

import io.swagger.client.ApiClient;
import io.swagger.client.ApiException;
import io.swagger.client.api.VoiceSynthesisApi;
import io.swagger.client.model.Voice;
import io.swagger.client.model.VoiceSynthesis;

public class VoiceSynthesisLib {

private VoiceSynthesisApi voiceApi;

public VoiceSynthesisLib(ApiClient apiClient) {
voiceApi = new VoiceSynthesisApi(apiClient);
}

public List<Voice> GetVoice() throws ApiException{
return voiceApi.getSupportedVoicesForVoiceSynthesis();
}

public List<VoiceSynthesis> GetVoiceSynthesis() throws ApiException{
return voiceApi.getVoiceSyntheses();
}

public VoiceSynthesis GetVoiceSynthesis(UUID id) throws ApiException{
return voiceApi.getVoiceSynthesis(id);
}

public void SubmitSynthesis(String name, String description, String locale, List<UUID> model,
String outputFormat, String properties, File script) throws ApiException{
voiceApi.createVoiceSynthesis(name, description, locale, model, outputFormat, properties, script);
return;
}

public void DeleteSynthesis(UUID id) throws ApiException{
voiceApi.deleteVoiceSynthesis(id);
return;
}
}
Loading

0 comments on commit ff422d9

Please sign in to comment.