├── .gitignore ├── LICENSE ├── README.md ├── http_samples ├── csharp_http_sample │ ├── README.md │ ├── csharp_http_sample.sln │ └── csharp_http_sample │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── bin │ │ └── Debug │ │ │ └── supermarket.wav │ │ ├── csharp_http_sample.csproj │ │ └── packages.config ├── flutter_http_sample │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── speechsuper │ │ │ │ │ │ └── flutter_http_sample │ │ │ │ │ │ └── MainActivity.java │ │ │ │ └── res │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-night │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── assets │ │ └── supermarket.wav │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── Runner │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── main.m │ ├── lib │ │ ├── eval.dart │ │ └── main.dart │ ├── pubspec.lock │ ├── pubspec.yaml │ └── test │ │ └── widget_test.dart ├── golang_http_sample │ ├── README.md │ ├── go.mod │ ├── sample.go │ └── supermarket.wav ├── java_http_sample │ ├── README.md │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── speechsuper │ │ │ │ └── Sample.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── speechsuper │ │ │ └── SampleTest.java │ └── supermarket.wav ├── javascript_http_sample │ ├── README.md │ ├── sample.html │ ├── sha.js │ └── supermarket.wav ├── nodejs_http_sample │ ├── README.md │ ├── main.js │ ├── package.json │ └── supermarket.wav ├── php_http_sample │ ├── README.md │ ├── sample.php │ └── supermarket.wav └── python_http_sample │ ├── README.md │ ├── sample.py │ └── supermarket.wav ├── images └── Flowchart.jpg └── websocket_samples ├── csharp_websocket_sample ├── README.md ├── csharp_websocket_sample.sln └── csharp_websocket_sample │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── WebSocketclient.cs │ ├── app.config │ ├── bin │ └── Debug │ │ └── supermarket.wav │ ├── csharp_websocket_sample.csproj │ └── packages.config ├── golang_websocket_sample ├── README.md ├── go.mod ├── sample.go └── supermarket.wav ├── java_websocket_sample ├── README.md ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── speechsuper │ │ │ └── Sample.java │ └── test │ │ └── java │ │ └── com │ │ └── speechsuper │ │ └── SampleTest.java └── supermarket.wav ├── javascript_websocket_sample ├── README.md ├── sample.html ├── sha.js └── supermarket.wav └── python_websocket_sample ├── README.md ├── sample.py └── supermarket.wav /.gitignore: -------------------------------------------------------------------------------- 1 | # vscode 2 | .vs/ 3 | 4 | .DS_Store 5 | 6 | # .idea 7 | .idea/ 8 | 9 | # Python 10 | __pycache__/ 11 | *.py[cod] 12 | 13 | # Golang 14 | **/golang*/**/pkg/ 15 | **/golang*/**/go.sum 16 | 17 | # C# 18 | **/csharp*/**/packages/ 19 | **/csharp*/**/obj/ 20 | **/csharp*/**/*.dll 21 | **/csharp*/**/*.exe 22 | **/csharp*/**/*.xml 23 | **/csharp*/**/*.exe.config 24 | **/csharp*/**/*.pdb 25 | 26 | # Java 27 | **/java*/**/.settings 28 | **/java*/**/.bin 29 | **/java*/**/target 30 | **/java*/**/.classpath 31 | **/java*/**/.project 32 | 33 | # node 34 | **/yarn.lock 35 | **/node_modules 36 | **/package-lock.json 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 speechsuper 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SpeechSuper API 2 | 3 | Enhance your language learning with our Pronunciation Assessment API. Tailored to support language learners, our API evaluates pronunciation by analyzing audio files and text strings, providing comprehensive metrics for speech quality and fluency. 4 | 5 | ## Pronunciation Assessment API (Scripted) 6 | 7 | ### 🌟 Basic Features 8 | The Pronunciation Assessment API (scripted) provided by SpeechSuper offers a comprehensive analysis of learners' audio recordings, providing valuable insights in the following areas: 9 | 10 | - Accurate assessment at phoneme, syllable, word, and sentence levels, aligning with native English speech patterns. 11 | - Fluency metrics, including words correct per minute and pause count, alongside IELTS/PTE score estimation. 12 | 13 | Basic Features: 14 | - Pronunciation score (of phonemes, words, sentences) 15 | - Fluency score 16 | - Completeness score 17 | - Rhythm score or speed 18 | 19 | ### 🪐 Highlight Features 20 | 21 | Explore advanced capabilities with SpeechSuper's Pronunciation Assessment API, complementing its fundamental features. Unleash the power of: 22 | 23 | - Syllable stress analysis 24 | - Liaison detection 25 | - Loss of plosion identification 26 | - Rising/falling tone analysis for sentence endings 27 | - Real-time feedback at the sentence level 28 | - Detection of phoneme-level mispronunciations (insertion, deletion, substitution) 29 | 30 | With SpeechSuper's Pronunciation Assessment API, you access robust tools to evaluate and refine your pronunciation skills within structured contexts. Elevate your language proficiency with precise analysis and instant feedback mechanisms. 31 | 32 |
33 | Spoken languages covered 34 | 35 | * English 36 | * Chinese 37 | * German 38 | * French 39 | * Russian 40 | * Korean 41 | * Japanese 42 | * Spanish 43 | * more to come 44 |
45 | 46 |
47 | Coding languages covered 48 | 49 | * Java 50 | * C/C++ 51 | * Swift 52 | * golang 53 | * php 54 | * C# 55 | * Unity 56 | * Javascript 57 | * Objective-C 58 | * Python 59 | * Node 60 | * Rust 61 | * etc 62 |
63 | 64 |
65 | Platforms supported 66 | 67 | * iOS 68 | * Android 69 | * Web 70 | * Windows 71 | * MacOS 72 | * Linux 73 | * etc 74 |
75 | 76 | 77 | ### 🚀 Getting Started 78 | 79 | 1. **Get the `appKey` and `secretKey`.** 80 | 81 | If you don't have the keys, please go to [SpeechSuper](https://www.speechsuper.com/), and click "Contact us" to fill in the sheet. We will get in touch with you very soon! 82 | 83 | 2. **Git clone this project to your local.** 84 | 85 | ``` 86 | git clone https://github.com/speechsuper/speechsuper-api-samples.git 87 | ``` 88 | 89 | 3. **Choose the example of your interest.** 90 | 91 | We have [http](https://github.com/speechsuper/speechsuper-api-samples/tree/main/http_samples) / [websocket](https://github.com/speechsuper/speechsuper-api-samples/tree/main/websocket_samples) examples in multiple coding languages. Fill in your `appKey` and `secretKey`: 92 | ``` 93 | appKey = "Insert your appKey here" 94 | secretKey = "Insert your secretKey here" 95 | ``` 96 | 97 | 4. **Change the inputs according to your needs.** 98 | ``` 99 | coreType = "sent.eval.promax" // sentence evaluation 100 | refText = "The successful warrior is the average man with laser-like focus." // reference text 101 | audioPath = "The audio path of the spoken sentence." 102 | audioType = "wav" 103 | ``` 104 | 105 | > **Notes on Audio:** SpeechSuper supports most audio formats, such as wav, mp3, opus, ogg, and amr. 106 | > 107 | > To optimize file size and enhance performance, we strongly recommend recording your audio at the following settings: 108 | > | Audio Attribute | Suggestion | 109 | > | --------------- | --------------- | 110 | > | Sample size | 16-bit | 111 | > | Sample rate | 16Khz | 112 | > | Channels | 1 (mono) | 113 | > | Bitrate | ≥ 96kbps | 114 | 115 | 116 | 5. **Launch 🚀 your code and get the result.** 117 | 118 | --- 119 | 120 | 121 | ## English Spontaneous Speech Assessment API (Unscripted) 122 | 123 | ### 🌟 Overview 124 | The English Spontaneous Speech Assessment API (Unscripted) offered by SpeechSuper provides a comprehensive analysis of learners' audio recordings, delivering valuable insights in the following areas: 125 | 126 | - Overall score 127 | - Pronunciation score 128 | - Fluency score 129 | - Grammar score 130 | - Vocabulary score 131 | - Transcription 132 | 133 | ### 🪐 Pro Features 134 | In addition to the basics, the Pro features enhance the analysis by offering detailed information such as: 135 | 136 | - Pause markers 137 | - Frequency of pause fillers 138 | - Speaking rate 139 | - Speech length 140 | - Vocabulary usages 141 | - Detection and correction of grammatical errors 142 | - Word-level pronunciation score 143 | 144 | With SpeechSuper's API, you can unlock a wealth of information to assess and improve your English spontaneous speech skills. 145 | 146 | 147 | ### 🚀 Getting Started 148 | 149 | 1. **Get the `appKey` and `secretKey`.** 150 | If you don't have the keys, please go to [SpeechSuper](https://www.speechsuper.com/), and click "Contact us" to fill in the sheet. We will get in touch with you very soon! 151 | 152 | 153 | 2. **Git clone this project to your local.** 154 | ``` 155 | git clone https://github.com/speechsuper/speechsuper-api-samples.git 156 | ``` 157 | 158 | 3. **Choose the example of your interest.** 159 | 160 | We have [http](https://github.com/speechsuper/speechsuper-api-samples/tree/main/http_samples) / [websocket](https://github.com/speechsuper/speechsuper-api-samples/tree/main/websocket_samples) examples in multiple coding languages. Fill in your `appKey` and `secretKey`: 161 | 162 | ``` 163 | appKey = "Insert your appKey here" 164 | secretKey = "Insert your secretKey here" 165 | ``` 166 | 167 | 4. **Change the inputs according to your needs.** 168 | 169 | ``` 170 | # CoreType for English spontaneous speech assessment 171 | coreType = "speak.eval.pro" 172 | 173 | # Test type, currently supporting only IELTS speaking assessment 174 | test_type = "ielts" 175 | 176 | # Question prompt used to score relevance of the response and penalize irrelevant responses 177 | question_prompt = "What's your favorite food?" 178 | 179 | # Model for transcription accuracy; use "non_native" for non-native speakers, "native" otherwise 180 | model = "non_native" 181 | 182 | # Penalize scores for off-topic responses (1 to penalize, 0 otherwise) 183 | penalize_offtopic = 1 184 | 185 | # Path to the audio file of the speech 186 | audioPath = "The audio path of the speech." 187 | 188 | # Type of the audio file (e.g., "wav") 189 | audioType = "wav" 190 | 191 | ``` 192 | 193 | 194 | > **Notes on Audio:** SpeechSuper supports most audio formats, such as wav, mp3, opus, ogg, and amr. 195 | > 196 | > To optimize file size and enhance performance, we strongly recommend recording your audio at the following settings: 197 | > | Audio Attribute | Suggestion | 198 | > | --------------- | --------------- | 199 | > | Sample size | 16-bit | 200 | > | Sample rate | 16Khz | 201 | > | Channels | 1 (mono) | 202 | > | Bitrate | ≥ 96kbps | 203 | 204 | 5. **Launch 🚀 your code and get the result.** 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install Miscrosoft Visual Studio 2017+ (requirement: Net Framework 4.0+) 4 | 2. Modify the appKey in csharp_http_sample/Program.cs 5 | 3. Modify the secretKey in csharp_http_sample/Program.cs 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/csharp_http_sample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.1705 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_http_sample", "csharp_http_sample\csharp_http_sample.csproj", "{7CD415D6-D7B2-46F4-990B-4C2ACEF4BE75}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7CD415D6-D7B2-46F4-990B-4C2ACEF4BE75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7CD415D6-D7B2-46F4-990B-4C2ACEF4BE75}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7CD415D6-D7B2-46F4-990B-4C2ACEF4BE75}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7CD415D6-D7B2-46F4-990B-4C2ACEF4BE75}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {3EA7214B-314F-4BE1-BCDF-3730622B252C} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/csharp_http_sample/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Net; 5 | using System.IO; 6 | using Newtonsoft.Json.Linq; 7 | using Newtonsoft.Json; 8 | using System.Security.Cryptography; 9 | 10 | namespace csharp_http_sample 11 | { 12 | class Program 13 | { 14 | private static readonly string baseUrl = "https://api.speechsuper.com/"; 15 | private static readonly string appKey = "Insert your appKey here"; 16 | private static readonly string secretKey = "Insert your secretKey here"; 17 | 18 | public static string HttpAPI(int httpTimeout, String audioPath, string audioFormat, int sampleRate, string coreType, Dictionary requests) 19 | { 20 | string res = null; 21 | 22 | HttpWebRequest httpWebRequest = null; 23 | try 24 | { 25 | string param = buildParams(audioFormat, sampleRate, requests); 26 | string boundary = Guid.NewGuid().ToString(); 27 | byte[] beginBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "\r\n"); 28 | byte[] endBoundaryBytes = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n"); 29 | byte[] newLineBytes = Encoding.UTF8.GetBytes("\r\n"); 30 | string contentType = "multipart/form-data"; 31 | MemoryStream memoryStream = new MemoryStream(); 32 | 33 | string url = baseUrl + coreType; 34 | httpWebRequest = WebRequest.Create(url) as HttpWebRequest; // create request 35 | httpWebRequest.ContentType = string.Format(contentType + "; boundary={0}", boundary); 36 | httpWebRequest.Method = WebRequestMethods.Http.Post; 37 | httpWebRequest.Timeout = httpTimeout; 38 | httpWebRequest.Headers.Add("Request-Index:0");//Request-Index is always 0 39 | 40 | //text 41 | string formDataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n" + "{1}\r\n"; 42 | 43 | string formItem = string.Format(formDataTemplate, "text", param); 44 | byte[] formItemBytes = Encoding.UTF8.GetBytes(formItem); 45 | 46 | memoryStream.Write(beginBoundaryBytes, 0, beginBoundaryBytes.Length); 47 | memoryStream.Write(formItemBytes, 0, formItemBytes.Length); 48 | 49 | //audio 50 | const string filePartHeaderTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n" + "Content-Type: application/octet-stream\r\n\r\n"; 51 | 52 | FileInfo fileInfo = new FileInfo(audioPath); 53 | string fileName = fileInfo.Name; 54 | 55 | string fileHeaderItem = string.Format(filePartHeaderTemplate, "audio", fileName); 56 | byte[] fileHeaderItemBytes = Encoding.UTF8.GetBytes(fileHeaderItem); 57 | 58 | memoryStream.Write(newLineBytes, 0, newLineBytes.Length); //newline 59 | memoryStream.Write(beginBoundaryBytes, 0, beginBoundaryBytes.Length); 60 | memoryStream.Write(fileHeaderItemBytes, 0, fileHeaderItemBytes.Length); 61 | 62 | int bytesRead; 63 | byte[] buffer = new byte[1024]; 64 | FileStream fileStream = new FileStream(audioPath, FileMode.Open, FileAccess.Read); 65 | while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) 66 | { 67 | memoryStream.Write(buffer, 0, bytesRead); 68 | } 69 | memoryStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length); 70 | 71 | 72 | httpWebRequest.ContentLength = memoryStream.Length; 73 | 74 | Stream requestStream = httpWebRequest.GetRequestStream(); 75 | 76 | memoryStream.Position = 0; 77 | byte[] tempBuffer = new byte[memoryStream.Length]; 78 | memoryStream.Read(tempBuffer, 0, tempBuffer.Length); 79 | memoryStream.Close(); 80 | 81 | requestStream.Write(tempBuffer, 0, tempBuffer.Length); 82 | requestStream.Close(); 83 | 84 | HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse; 85 | if (httpWebResponse != null) 86 | { 87 | StreamReader reader = new StreamReader(httpWebResponse.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8")); 88 | res = reader.ReadToEnd(); 89 | httpWebResponse.Close(); 90 | } 91 | } 92 | catch (Exception e) 93 | { 94 | Console.WriteLine(e.StackTrace + "\n"); 95 | } 96 | finally 97 | { 98 | if (httpWebRequest != null) 99 | { 100 | httpWebRequest.Abort(); 101 | } 102 | } 103 | return res; 104 | } 105 | 106 | public static string buildParams(string audioFormat, int sampleRate, Dictionary requests) 107 | { 108 | string userId = Guid.NewGuid().ToString(); 109 | string ts = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString();//timestamp 110 | string connectSigStr = appKey + ts + secretKey; 111 | string startSigStr = appKey + ts + userId + secretKey; 112 | string connectSig = sha1Hex(connectSigStr); 113 | string startSig = sha1Hex(startSigStr); 114 | JObject param = new JObject(); 115 | 116 | //connect 117 | JObject connect = new JObject(); 118 | connect.Add("cmd", "connect"); 119 | JObject connectParam = new JObject(); 120 | 121 | JObject connectParamSdk = new JObject(); 122 | connectParamSdk.Add("protocol", 2); 123 | connectParamSdk.Add("version", 16777472); 124 | connectParamSdk.Add("source", 9); 125 | connectParam.Add("sdk", connectParamSdk); 126 | 127 | JObject connectParamApp = new JObject(); 128 | connectParamApp.Add("applicationId", appKey); 129 | connectParamApp.Add("sig", connectSig); 130 | connectParamApp.Add("timestamp", ts); 131 | connectParam.Add("app", connectParamApp); 132 | connect.Add("param", connectParam); 133 | 134 | param.Add("connect", connect); 135 | 136 | //start 137 | JObject start = new JObject(); 138 | start.Add("cmd", "start"); 139 | JObject startParam = new JObject(); 140 | 141 | JObject startParamApp = new JObject(); 142 | startParamApp.Add("applicationId", appKey); 143 | startParamApp.Add("sig", startSig); 144 | startParamApp.Add("timestamp", ts); 145 | startParamApp.Add("userId", userId); 146 | startParam.Add("app", startParamApp); 147 | 148 | JObject startParamAudio = new JObject(); 149 | startParamAudio.Add("sampleBytes", 2); 150 | startParamAudio.Add("channel", 1); 151 | startParamAudio.Add("sampleRate", sampleRate); 152 | startParamAudio.Add("audioType", audioFormat); 153 | startParam.Add("audio", startParamAudio); 154 | 155 | JObject startParamRequest = new JObject(); 156 | startParamRequest = (JObject)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(requests)); 157 | startParamRequest.Add("tokenId", Guid.NewGuid().ToString()); 158 | startParam.Add("request", startParamRequest); 159 | 160 | start.Add("param", startParam); 161 | param.Add("start", start); 162 | 163 | return param.ToString(); 164 | } 165 | 166 | private static string sha1Hex(string s) 167 | { 168 | try 169 | { 170 | SHA1 sha1 = new SHA1CryptoServiceProvider(); 171 | byte[] bytesIn = Encoding.UTF8.GetBytes(s); 172 | byte[] bytesOut = sha1.ComputeHash(bytesIn); 173 | var sb = new StringBuilder(); 174 | foreach (byte b in bytesOut) 175 | { 176 | sb.Append(b.ToString("x2")); 177 | } 178 | 179 | return sb.ToString().ToLower(); 180 | } 181 | catch (Exception ex) 182 | { 183 | throw new Exception("SHA1 encryption error:" + ex.Message); 184 | } 185 | } 186 | 187 | 188 | static void Main(string[] args) 189 | { 190 | int httpTimeout = 50000; //50s 191 | string coreType = "word.eval.promax"; // Change the coreType according to your needs. 192 | string refText = "supermarket"; // Change the reference text according to your needs. 193 | string audioPath = "supermarket.wav"; // Change the audio path corresponding to the reference text. 194 | string audioFormat = "wav"; // Change the audio type corresponding to the audio file. 195 | int sampleRate = 16000; 196 | 197 | Dictionary requests = new Dictionary(); 198 | requests.Add("coreType", coreType); 199 | requests.Add("refText", refText); 200 | string res = HttpAPI(httpTimeout, audioPath, audioFormat, sampleRate, coreType, requests); 201 | Console.WriteLine("result===>" + res); 202 | Console.ReadLine(); 203 | } 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/csharp_http_sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("csharp_http_sample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("csharp_http_sample")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("7cd415d6-d7b2-46f4-990b-4c2acef4be75")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/csharp_http_sample/bin/Debug/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/csharp_http_sample/csharp_http_sample/bin/Debug/supermarket.wav -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/csharp_http_sample/csharp_http_sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7CD415D6-D7B2-46F4-990B-4C2ACEF4BE75} 8 | Exe 9 | csharp_http_sample 10 | csharp_http_sample 11 | v4.0 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\Newtonsoft.Json.13.0.1\lib\net40\Newtonsoft.Json.dll 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /http_samples/csharp_http_sample/csharp_http_sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 17 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 18 | - platform: android 19 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 20 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 21 | - platform: ios 22 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 23 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install Flutter 4 | 2. Modify the appKey in lib/main.dart 5 | 3. Modify the secretKey in lib/main.dart 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. 10 | 8. Run the app -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | defaultConfig { 38 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 39 | applicationId "com.speechsuper.flutter_http_sample" 40 | // You can update the following values to match your application needs. 41 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 42 | minSdkVersion flutter.minSdkVersion 43 | targetSdkVersion flutter.targetSdkVersion 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/java/com/speechsuper/flutter_http_sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.speechsuper.flutter_http_sample; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/assets/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/assets/supermarket.wav -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 13 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 37 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 40 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 41 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 9740EEB11CF90186004384FC /* Flutter */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 64 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 65 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 66 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 67 | ); 68 | name = Flutter; 69 | sourceTree = ""; 70 | }; 71 | 97C146E51CF9000F007C117D = { 72 | isa = PBXGroup; 73 | children = ( 74 | 9740EEB11CF90186004384FC /* Flutter */, 75 | 97C146F01CF9000F007C117D /* Runner */, 76 | 97C146EF1CF9000F007C117D /* Products */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | 97C146EF1CF9000F007C117D /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 97C146EE1CF9000F007C117D /* Runner.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 97C146F01CF9000F007C117D /* Runner */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 92 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 93 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 94 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 95 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 96 | 97C147021CF9000F007C117D /* Info.plist */, 97 | 97C146F11CF9000F007C117D /* Supporting Files */, 98 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 99 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 100 | ); 101 | path = Runner; 102 | sourceTree = ""; 103 | }; 104 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 97C146F21CF9000F007C117D /* main.m */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | /* End PBXGroup section */ 113 | 114 | /* Begin PBXNativeTarget section */ 115 | 97C146ED1CF9000F007C117D /* Runner */ = { 116 | isa = PBXNativeTarget; 117 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 118 | buildPhases = ( 119 | 9740EEB61CF901F6004384FC /* Run Script */, 120 | 97C146EA1CF9000F007C117D /* Sources */, 121 | 97C146EB1CF9000F007C117D /* Frameworks */, 122 | 97C146EC1CF9000F007C117D /* Resources */, 123 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 124 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 125 | ); 126 | buildRules = ( 127 | ); 128 | dependencies = ( 129 | ); 130 | name = Runner; 131 | productName = Runner; 132 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 133 | productType = "com.apple.product-type.application"; 134 | }; 135 | /* End PBXNativeTarget section */ 136 | 137 | /* Begin PBXProject section */ 138 | 97C146E61CF9000F007C117D /* Project object */ = { 139 | isa = PBXProject; 140 | attributes = { 141 | LastUpgradeCheck = 1300; 142 | ORGANIZATIONNAME = ""; 143 | TargetAttributes = { 144 | 97C146ED1CF9000F007C117D = { 145 | CreatedOnToolsVersion = 7.3.1; 146 | }; 147 | }; 148 | }; 149 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 150 | compatibilityVersion = "Xcode 9.3"; 151 | developmentRegion = en; 152 | hasScannedForEncodings = 0; 153 | knownRegions = ( 154 | en, 155 | Base, 156 | ); 157 | mainGroup = 97C146E51CF9000F007C117D; 158 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 159 | projectDirPath = ""; 160 | projectRoot = ""; 161 | targets = ( 162 | 97C146ED1CF9000F007C117D /* Runner */, 163 | ); 164 | }; 165 | /* End PBXProject section */ 166 | 167 | /* Begin PBXResourcesBuildPhase section */ 168 | 97C146EC1CF9000F007C117D /* Resources */ = { 169 | isa = PBXResourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 173 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 174 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 175 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXResourcesBuildPhase section */ 180 | 181 | /* Begin PBXShellScriptBuildPhase section */ 182 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 183 | isa = PBXShellScriptBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | ); 187 | inputPaths = ( 188 | ); 189 | name = "Thin Binary"; 190 | outputPaths = ( 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | shellPath = /bin/sh; 194 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 195 | }; 196 | 9740EEB61CF901F6004384FC /* Run Script */ = { 197 | isa = PBXShellScriptBuildPhase; 198 | buildActionMask = 2147483647; 199 | files = ( 200 | ); 201 | inputPaths = ( 202 | ); 203 | name = "Run Script"; 204 | outputPaths = ( 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | shellPath = /bin/sh; 208 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 209 | }; 210 | /* End PBXShellScriptBuildPhase section */ 211 | 212 | /* Begin PBXSourcesBuildPhase section */ 213 | 97C146EA1CF9000F007C117D /* Sources */ = { 214 | isa = PBXSourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 218 | 97C146F31CF9000F007C117D /* main.m in Sources */, 219 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXSourcesBuildPhase section */ 224 | 225 | /* Begin PBXVariantGroup section */ 226 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 227 | isa = PBXVariantGroup; 228 | children = ( 229 | 97C146FB1CF9000F007C117D /* Base */, 230 | ); 231 | name = Main.storyboard; 232 | sourceTree = ""; 233 | }; 234 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 235 | isa = PBXVariantGroup; 236 | children = ( 237 | 97C147001CF9000F007C117D /* Base */, 238 | ); 239 | name = LaunchScreen.storyboard; 240 | sourceTree = ""; 241 | }; 242 | /* End PBXVariantGroup section */ 243 | 244 | /* Begin XCBuildConfiguration section */ 245 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_ANALYZER_NONNULL = YES; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_COMMA = YES; 257 | CLANG_WARN_CONSTANT_CONVERSION = YES; 258 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 259 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 260 | CLANG_WARN_EMPTY_BODY = YES; 261 | CLANG_WARN_ENUM_CONVERSION = YES; 262 | CLANG_WARN_INFINITE_RECURSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 266 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 267 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 268 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 269 | CLANG_WARN_STRICT_PROTOTYPES = YES; 270 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 276 | ENABLE_NS_ASSERTIONS = NO; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu99; 279 | GCC_NO_COMMON_BLOCKS = YES; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 287 | MTL_ENABLE_DEBUG_INFO = NO; 288 | SDKROOT = iphoneos; 289 | SUPPORTED_PLATFORMS = iphoneos; 290 | TARGETED_DEVICE_FAMILY = "1,2"; 291 | VALIDATE_PRODUCT = YES; 292 | }; 293 | name = Profile; 294 | }; 295 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 296 | isa = XCBuildConfiguration; 297 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 301 | ENABLE_BITCODE = NO; 302 | INFOPLIST_FILE = Runner/Info.plist; 303 | LD_RUNPATH_SEARCH_PATHS = ( 304 | "$(inherited)", 305 | "@executable_path/Frameworks", 306 | ); 307 | PRODUCT_BUNDLE_IDENTIFIER = com.speechsuper.flutterHttpSample; 308 | PRODUCT_NAME = "$(TARGET_NAME)"; 309 | VERSIONING_SYSTEM = "apple-generic"; 310 | }; 311 | name = Profile; 312 | }; 313 | 97C147031CF9000F007C117D /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ALWAYS_SEARCH_USER_PATHS = NO; 317 | CLANG_ANALYZER_NONNULL = YES; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = dwarf; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | ENABLE_TESTABILITY = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_DYNAMIC_NO_PIC = NO; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_OPTIMIZATION_LEVEL = 0; 350 | GCC_PREPROCESSOR_DEFINITIONS = ( 351 | "DEBUG=1", 352 | "$(inherited)", 353 | ); 354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 356 | GCC_WARN_UNDECLARED_SELECTOR = YES; 357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 358 | GCC_WARN_UNUSED_FUNCTION = YES; 359 | GCC_WARN_UNUSED_VARIABLE = YES; 360 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 361 | MTL_ENABLE_DEBUG_INFO = YES; 362 | ONLY_ACTIVE_ARCH = YES; 363 | SDKROOT = iphoneos; 364 | TARGETED_DEVICE_FAMILY = "1,2"; 365 | }; 366 | name = Debug; 367 | }; 368 | 97C147041CF9000F007C117D /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ALWAYS_SEARCH_USER_PATHS = NO; 372 | CLANG_ANALYZER_NONNULL = YES; 373 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 374 | CLANG_CXX_LIBRARY = "libc++"; 375 | CLANG_ENABLE_MODULES = YES; 376 | CLANG_ENABLE_OBJC_ARC = YES; 377 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_COMMA = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 382 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 383 | CLANG_WARN_EMPTY_BODY = YES; 384 | CLANG_WARN_ENUM_CONVERSION = YES; 385 | CLANG_WARN_INFINITE_RECURSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 388 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 389 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 392 | CLANG_WARN_STRICT_PROTOTYPES = YES; 393 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 394 | CLANG_WARN_UNREACHABLE_CODE = YES; 395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 397 | COPY_PHASE_STRIP = NO; 398 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 399 | ENABLE_NS_ASSERTIONS = NO; 400 | ENABLE_STRICT_OBJC_MSGSEND = YES; 401 | GCC_C_LANGUAGE_STANDARD = gnu99; 402 | GCC_NO_COMMON_BLOCKS = YES; 403 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 404 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 405 | GCC_WARN_UNDECLARED_SELECTOR = YES; 406 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 407 | GCC_WARN_UNUSED_FUNCTION = YES; 408 | GCC_WARN_UNUSED_VARIABLE = YES; 409 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 410 | MTL_ENABLE_DEBUG_INFO = NO; 411 | SDKROOT = iphoneos; 412 | SUPPORTED_PLATFORMS = iphoneos; 413 | TARGETED_DEVICE_FAMILY = "1,2"; 414 | VALIDATE_PRODUCT = YES; 415 | }; 416 | name = Release; 417 | }; 418 | 97C147061CF9000F007C117D /* Debug */ = { 419 | isa = XCBuildConfiguration; 420 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 421 | buildSettings = { 422 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 423 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 424 | ENABLE_BITCODE = NO; 425 | INFOPLIST_FILE = Runner/Info.plist; 426 | LD_RUNPATH_SEARCH_PATHS = ( 427 | "$(inherited)", 428 | "@executable_path/Frameworks", 429 | ); 430 | PRODUCT_BUNDLE_IDENTIFIER = com.speechsuper.flutterHttpSample; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | VERSIONING_SYSTEM = "apple-generic"; 433 | }; 434 | name = Debug; 435 | }; 436 | 97C147071CF9000F007C117D /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 442 | ENABLE_BITCODE = NO; 443 | INFOPLIST_FILE = Runner/Info.plist; 444 | LD_RUNPATH_SEARCH_PATHS = ( 445 | "$(inherited)", 446 | "@executable_path/Frameworks", 447 | ); 448 | PRODUCT_BUNDLE_IDENTIFIER = com.speechsuper.flutterHttpSample; 449 | PRODUCT_NAME = "$(TARGET_NAME)"; 450 | VERSIONING_SYSTEM = "apple-generic"; 451 | }; 452 | name = Release; 453 | }; 454 | /* End XCBuildConfiguration section */ 455 | 456 | /* Begin XCConfigurationList section */ 457 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 458 | isa = XCConfigurationList; 459 | buildConfigurations = ( 460 | 97C147031CF9000F007C117D /* Debug */, 461 | 97C147041CF9000F007C117D /* Release */, 462 | 249021D3217E4FDB00AE95B9 /* Profile */, 463 | ); 464 | defaultConfigurationIsVisible = 0; 465 | defaultConfigurationName = Release; 466 | }; 467 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | 97C147061CF9000F007C117D /* Debug */, 471 | 97C147071CF9000F007C117D /* Release */, 472 | 249021D4217E4FDB00AE95B9 /* Profile */, 473 | ); 474 | defaultConfigurationIsVisible = 0; 475 | defaultConfigurationName = Release; 476 | }; 477 | /* End XCConfigurationList section */ 478 | }; 479 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 480 | } 481 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Flutter Http Sample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_http_sample 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/lib/eval.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:flutter/services.dart' show rootBundle; 5 | import 'package:flutter/material.dart'; 6 | import 'package:http/http.dart' as http; 7 | import 'package:crypto/crypto.dart'; 8 | 9 | class EvalScreen extends StatefulWidget { 10 | const EvalScreen({Key? key}) : super(key: key); 11 | 12 | @override 13 | State createState() => _EvalScreenState(); 14 | } 15 | 16 | class _EvalScreenState extends State { 17 | final String appKey = "Insert your appKey here"; 18 | final String secretKey = "Insert your secretKey here"; 19 | final String userId = "uid"; 20 | final String baseHOST = "api.speechsuper.com"; 21 | 22 | final String coreType = "word.eval.promax"; // Change the coreType according to your needs. 23 | final refText = "supermarket"; // Change the reference text according to your needs. 24 | final audioPath = "assets/supermarket.wav"; // Change the audio path corresponding to the reference text. 25 | final audioType = "wav"; // Change the audio type corresponding to the audio file. 26 | final audioSampleRate = "16000"; 27 | 28 | TextEditingController resultController = new TextEditingController(); 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Scaffold( 33 | body: Center( 34 | child: Column( 35 | mainAxisAlignment: MainAxisAlignment.center, 36 | children: [ 37 | TextField( 38 | keyboardType: TextInputType.multiline, 39 | maxLength: null, 40 | minLines: 6, 41 | maxLines: 22, 42 | readOnly: true, 43 | controller: resultController, 44 | decoration: InputDecoration(hintText: "Result:", contentPadding: const EdgeInsets.symmetric(vertical: 20.0),), 45 | ), 46 | SizedBox(height: 30.0,), 47 | TextButton( 48 | onPressed: doEval, 49 | style: ButtonStyle( 50 | overlayColor: MaterialStateProperty.all(Colors.transparent),//splashColor 51 | backgroundColor: MaterialStateProperty.all(Color(0xFFFFC800)), 52 | elevation: MaterialStateProperty.all(0), 53 | ), 54 | child: Text("Click me") 55 | ) 56 | ], 57 | ) 58 | ) 59 | ); 60 | } 61 | 62 | void doEval() { 63 | String timestamp = DateTime.now().millisecondsSinceEpoch.toString(); 64 | String connectSig = sha1.convert(utf8.encode("${appKey}${timestamp}${secretKey}")).toString(); 65 | String startSig = sha1.convert(utf8.encode("${appKey}${timestamp}${userId}${secretKey}")).toString(); 66 | String tokenId = DateTime.now().millisecondsSinceEpoch.toString(); 67 | var params = { 68 | "connect": { 69 | "cmd": "connect", 70 | "param": { 71 | "sdk": { 72 | "version": 16777472, 73 | "source": 9, 74 | "protocol": 2 75 | }, 76 | "app": { 77 | "applicationId": appKey, 78 | "sig": connectSig, 79 | "timestamp": timestamp 80 | } 81 | } 82 | }, 83 | "start": { 84 | "cmd": "start", 85 | "param": { 86 | "app": { 87 | "applicationId": appKey, 88 | "sig": startSig, 89 | "userId": userId, 90 | "timestamp": timestamp 91 | }, 92 | "audio": { 93 | "audioType": audioType, 94 | "sampleRate": audioSampleRate, 95 | "channel": 1, 96 | "sampleBytes":2 97 | }, 98 | "request": { 99 | "refText": refText, 100 | "tokenId": tokenId 101 | } 102 | } 103 | } 104 | }; 105 | 106 | rootBundle.load(audioPath).then((ByteData data) async { 107 | var url = Uri.https(baseHOST, coreType); 108 | var request = http.MultipartRequest("POST", url) 109 | ..fields["text"] = jsonEncode(params) 110 | ..files.add(http.MultipartFile.fromBytes("audio", data.buffer.asUint8List())) 111 | ..headers["Request-Index"] = "0"; 112 | 113 | var response = await request.send(); 114 | if(response.statusCode != 200) { 115 | resultController.text = "HTTP status code ${response.statusCode}"; 116 | } else { 117 | response.stream.transform(utf8.decoder).join().then((String str) { 118 | if(str.contains("error")) { 119 | resultController.text = str; 120 | } else { 121 | var respJson = jsonDecode(str); 122 | resultController.text = "overall: ${respJson["result"]["overall"]}"; 123 | } 124 | }); 125 | } 126 | }); 127 | 128 | 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import './eval.dart'; 4 | 5 | void main() { 6 | runApp(const MyApp()); 7 | } 8 | 9 | class MyApp extends StatelessWidget { 10 | const MyApp({Key? key}) : super(key: key); 11 | 12 | // This widget is the root of your application. 13 | @override 14 | Widget build(BuildContext context) { 15 | return MaterialApp( 16 | title: 'speechsuper demo', 17 | theme: ThemeData( 18 | // This is the theme of your application. 19 | // 20 | // Try running your application with "flutter run". You'll see the 21 | // application has a blue toolbar. Then, without quitting the app, try 22 | // changing the primarySwatch below to Colors.green and then invoke 23 | // "hot reload" (press "r" in the console where you ran "flutter run", 24 | // or simply save your changes to "hot reload" in a Flutter IDE). 25 | // Notice that the counter didn't reset back to zero; the application 26 | // is not restarted. 27 | primarySwatch: Colors.blue, 28 | ), 29 | home: const MyHomePage(title: 'Speechsuper Demo Home Page'), 30 | routes: { 31 | "EvalScreen": (BuildContext context) => new EvalScreen() 32 | } 33 | ); 34 | } 35 | } 36 | 37 | class MyHomePage extends StatefulWidget { 38 | const MyHomePage({Key? key, required this.title}) : super(key: key); 39 | 40 | // This widget is the home page of your application. It is stateful, meaning 41 | // that it has a State object (defined below) that contains fields that affect 42 | // how it looks. 43 | 44 | // This class is the configuration for the state. It holds the values (in this 45 | // case the title) provided by the parent (in this case the App widget) and 46 | // used by the build method of the State. Fields in a Widget subclass are 47 | // always marked "final". 48 | 49 | final String title; 50 | 51 | @override 52 | State createState() => _MyHomePageState(); 53 | } 54 | 55 | class _MyHomePageState extends State { 56 | int _counter = 0; 57 | 58 | void _incrementCounter() { 59 | setState(() { 60 | // This call to setState tells the Flutter framework that something has 61 | // changed in this State, which causes it to rerun the build method below 62 | // so that the display can reflect the updated values. If we changed 63 | // _counter without calling setState(), then the build method would not be 64 | // called again, and so nothing would appear to happen. 65 | _counter++; 66 | }); 67 | } 68 | 69 | @override 70 | Widget build(BuildContext context) { 71 | // This method is rerun every time setState is called, for instance as done 72 | // by the _incrementCounter method above. 73 | // 74 | // The Flutter framework has been optimized to make rerunning build methods 75 | // fast, so that you can just rebuild anything that needs updating rather 76 | // than having to individually change instances of widgets. 77 | return Scaffold( 78 | appBar: AppBar( 79 | // Here we take the value from the MyHomePage object that was created by 80 | // the App.build method, and use it to set our appbar title. 81 | title: Text(widget.title), 82 | ), 83 | body: Center( 84 | // Center is a layout widget. It takes a single child and positions it 85 | // in the middle of the parent. 86 | child: Column( 87 | // Column is also a layout widget. It takes a list of children and 88 | // arranges them vertically. By default, it sizes itself to fit its 89 | // children horizontally, and tries to be as tall as its parent. 90 | // 91 | // Invoke "debug painting" (press "p" in the console, choose the 92 | // "Toggle Debug Paint" action from the Flutter Inspector in Android 93 | // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) 94 | // to see the wireframe for each widget. 95 | // 96 | // Column has various properties to control how it sizes itself and 97 | // how it positions its children. Here we use mainAxisAlignment to 98 | // center the children vertically; the main axis here is the vertical 99 | // axis because Columns are vertical (the cross axis would be 100 | // horizontal). 101 | mainAxisAlignment: MainAxisAlignment.center, 102 | children: [ 103 | TextButton( 104 | style: ButtonStyle( 105 | overlayColor: MaterialStateProperty.all(Colors.transparent),//splashColor 106 | backgroundColor: MaterialStateProperty.all(Color(0xFFFFC800)), 107 | elevation: MaterialStateProperty.all(0), 108 | ), 109 | onPressed: () { 110 | Navigator.pushNamed(context, "EvalScreen"); 111 | }, child: Text("go to eval screen") 112 | ) 113 | ], 114 | ), 115 | ), 116 | ); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.2" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.16.0" 46 | crypto: 47 | dependency: "direct dev" 48 | description: 49 | name: crypto 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "3.0.2" 53 | cupertino_icons: 54 | dependency: "direct main" 55 | description: 56 | name: cupertino_icons 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.0.5" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.3.0" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_lints: 73 | dependency: "direct dev" 74 | description: 75 | name: flutter_lints 76 | url: "https://pub.dartlang.org" 77 | source: hosted 78 | version: "2.0.1" 79 | flutter_test: 80 | dependency: "direct dev" 81 | description: flutter 82 | source: sdk 83 | version: "0.0.0" 84 | http: 85 | dependency: "direct dev" 86 | description: 87 | name: http 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.13.5" 91 | http_parser: 92 | dependency: transitive 93 | description: 94 | name: http_parser 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "4.0.2" 98 | lints: 99 | dependency: transitive 100 | description: 101 | name: lints 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.0.1" 105 | matcher: 106 | dependency: transitive 107 | description: 108 | name: matcher 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "0.12.11" 112 | material_color_utilities: 113 | dependency: transitive 114 | description: 115 | name: material_color_utilities 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "0.1.4" 119 | meta: 120 | dependency: transitive 121 | description: 122 | name: meta 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.7.0" 126 | path: 127 | dependency: transitive 128 | description: 129 | name: path 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.8.1" 133 | sky_engine: 134 | dependency: transitive 135 | description: flutter 136 | source: sdk 137 | version: "0.0.99" 138 | source_span: 139 | dependency: transitive 140 | description: 141 | name: source_span 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.8.2" 145 | stack_trace: 146 | dependency: transitive 147 | description: 148 | name: stack_trace 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.10.0" 152 | stream_channel: 153 | dependency: transitive 154 | description: 155 | name: stream_channel 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "2.1.0" 159 | string_scanner: 160 | dependency: transitive 161 | description: 162 | name: string_scanner 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.0" 166 | term_glyph: 167 | dependency: transitive 168 | description: 169 | name: term_glyph 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.2.0" 173 | test_api: 174 | dependency: transitive 175 | description: 176 | name: test_api 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "0.4.9" 180 | typed_data: 181 | dependency: transitive 182 | description: 183 | name: typed_data 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "1.3.1" 187 | vector_math: 188 | dependency: transitive 189 | description: 190 | name: vector_math 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "2.1.2" 194 | sdks: 195 | dart: ">=2.17.1 <3.0.0" 196 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_http_sample 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.17.1 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | 33 | 34 | # The following adds the Cupertino Icons font to your application. 35 | # Use with the CupertinoIcons class for iOS style icons. 36 | cupertino_icons: ^1.0.2 37 | 38 | dev_dependencies: 39 | flutter_test: 40 | sdk: flutter 41 | 42 | # The "flutter_lints" package below contains a set of recommended lints to 43 | # encourage good coding practices. The lint set provided by the package is 44 | # activated in the `analysis_options.yaml` file located at the root of your 45 | # package. See that file for information about deactivating specific lint 46 | # rules and activating additional ones. 47 | flutter_lints: ^2.0.0 48 | 49 | http: ^0.13.5 50 | crypto: ^3.0.2 51 | 52 | # For information on the generic Dart part of this file, see the 53 | # following page: https://dart.dev/tools/pub/pubspec 54 | 55 | # The following section is specific to Flutter packages. 56 | flutter: 57 | 58 | # The following line ensures that the Material Icons font is 59 | # included with your application, so that you can use the icons in 60 | # the material Icons class. 61 | uses-material-design: true 62 | 63 | assets: 64 | - assets/ 65 | # To add assets to your application, add an assets section, like this: 66 | # assets: 67 | # - images/a_dot_burr.jpeg 68 | # - images/a_dot_ham.jpeg 69 | 70 | # An image asset can refer to one or more resolution-specific "variants", see 71 | # https://flutter.dev/assets-and-images/#resolution-aware 72 | 73 | # For details regarding adding assets from package dependencies, see 74 | # https://flutter.dev/assets-and-images/#from-packages 75 | 76 | # To add custom fonts to your application, add a fonts section here, 77 | # in this "flutter" section. Each entry in this list should have a 78 | # "family" key with the font family name, and a "fonts" key with a 79 | # list giving the asset and other descriptors for the font. For 80 | # example: 81 | # fonts: 82 | # - family: Schyler 83 | # fonts: 84 | # - asset: fonts/Schyler-Regular.ttf 85 | # - asset: fonts/Schyler-Italic.ttf 86 | # style: italic 87 | # - family: Trajan Pro 88 | # fonts: 89 | # - asset: fonts/TrajanPro.ttf 90 | # - asset: fonts/TrajanPro_Bold.ttf 91 | # weight: 700 92 | # 93 | # For details regarding fonts from package dependencies, 94 | # see https://flutter.dev/custom-fonts/#from-packages 95 | -------------------------------------------------------------------------------- /http_samples/flutter_http_sample/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_http_sample/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /http_samples/golang_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install Golang 4 | 2. Modify the appKey in sample.go 5 | 3. Modify the secretKey in sample.go 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. 10 | 8. Run the following command: 11 | ``` 12 | go run sample.go 13 | ``` -------------------------------------------------------------------------------- /http_samples/golang_http_sample/go.mod: -------------------------------------------------------------------------------- 1 | module golang_http_sample 2 | 3 | go 1.15 4 | 5 | require github.com/google/uuid v1.3.0 6 | -------------------------------------------------------------------------------- /http_samples/golang_http_sample/sample.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "crypto/sha1" 6 | "fmt" 7 | "io" 8 | "io/ioutil" 9 | "log" 10 | "mime/multipart" 11 | "net/http" 12 | "os" 13 | "strconv" 14 | "time" 15 | 16 | "github.com/google/uuid" 17 | ) 18 | 19 | func main() { 20 | appKey := "Insert your appKey here" 21 | secretKey := "Insert your secretKey here" 22 | 23 | baseURL := "https://api.speechsuper.com/" 24 | 25 | coreType := "word.eval.promax" // Change the coreType according to your needs. 26 | refText := "supermarket" // Change the reference text according to your needs. 27 | audioPath := "supermarket.wav" // Change the audio path corresponding to the reference text. 28 | audioType := "wav" // Change the audio type corresponding to the audio file. 29 | audioSampleRate := "16000" 30 | userId := "guest" // Required and customizable. This value is required when generating startSig 31 | 32 | url := baseURL + coreType 33 | method := "POST" 34 | payload := &bytes.Buffer{} 35 | writer := multipart.NewWriter(payload) 36 | 37 | timestamp := strconv.FormatInt(time.Now().Unix(), 10) 38 | 39 | connectData := []byte(appKey + timestamp + secretKey) 40 | startData := []byte(appKey + timestamp + userId + secretKey) 41 | connectSig := fmt.Sprintf("%x", sha1.Sum(connectData)) 42 | startSig := fmt.Sprintf("%x", sha1.Sum(startData)) 43 | 44 | 45 | // request param 46 | requestParam := `{"connect": {"cmd": "connect", "param": {"sdk": {"version": 16777472, "source": 9, "protocol": 2}, "app":{"applicationId":"` + appKey + `","sig":"` + connectSig + `","timestamp":"` + timestamp + `"}}}, "start": {"cmd": "start", "param": {"app":{"applicationId":"` + appKey + `","sig":"` + startSig + `","timestamp":"` + timestamp + `","userId":"` + userId + `"}, "audio": {"audioType": "` + audioType + `", "channel": 1, "sampleBytes": 2, "sampleRate":` + audioSampleRate + `}, "request": {"coreType": "` + coreType + `", "refText":"` + refText + `", "tokenId": "` + uuid.New().String() + `"}}}}` 47 | err := writer.WriteField("text", requestParam) 48 | if err != nil { 49 | log.Fatal(err) 50 | } 51 | 52 | // send audio 53 | part2, err := writer.CreateFormFile("audio", audioPath) 54 | if err != nil { 55 | log.Fatal(err) 56 | } 57 | 58 | file, err := os.Open(audioPath) 59 | if err != nil { 60 | log.Fatal(err) 61 | } 62 | defer file.Close() 63 | _, err = io.Copy(part2, file) 64 | if err != nil { 65 | log.Fatal(err) 66 | } 67 | 68 | err = writer.Close() 69 | if err != nil { 70 | fmt.Println(err) 71 | } 72 | 73 | client := &http.Client{} 74 | req, err := http.NewRequest(method, url, payload) 75 | if err != nil { 76 | log.Fatal(err) 77 | } 78 | 79 | req.Header.Set("Content-Type", writer.FormDataContentType()) 80 | req.Header.Set("Request-Index", "0") // Request-Index is always 0 81 | 82 | res, err := client.Do(req) 83 | if err != nil { 84 | log.Fatal(err) 85 | } 86 | 87 | defer res.Body.Close() 88 | body, err := ioutil.ReadAll(res.Body) 89 | if err != nil { 90 | log.Fatal(err) 91 | } 92 | 93 | log.Printf("result===> %s", body) 94 | } 95 | -------------------------------------------------------------------------------- /http_samples/golang_http_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/golang_http_sample/supermarket.wav -------------------------------------------------------------------------------- /http_samples/java_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | - Modify the appKey in src\main\java\com\speechsuper\Sample.java 3 | - Modify the secretKey in src\main\java\com\speechsuper\Sample.java 4 | - Change the coreType according to your needs. 5 | - Change the reference text according to your needs. 6 | - Change the audio path corresponding to the reference text. 7 | - Change the audio type corresponding to the audio file. 8 | 9 | # Requirements 10 | - Java JDK 1.7+ 11 | - Maven 12 | 13 | # Command lines 14 | - Compile: 15 | ``` 16 | mvn clean compile 17 | ``` 18 | - Run the `Sample` class: 19 | ``` 20 | mvn compile exec:java -Dexec.mainClass="com.speechsuper.Sample" 21 | ``` -------------------------------------------------------------------------------- /http_samples/java_http_sample/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.speechsuper 6 | java_http_sample 7 | 0.0.1-SNAPSHOT 8 | jar 9 | 10 | sample 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 16 | 17 | 18 | 19 | junit 20 | junit 21 | 3.8.1 22 | test 23 | 24 | 25 | org.apache.httpcomponents 26 | httpclient 27 | 4.5.13 28 | 29 | 30 | org.apache.httpcomponents 31 | httpmime 32 | 4.5.13 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /http_samples/java_http_sample/src/main/java/com/speechsuper/Sample.java: -------------------------------------------------------------------------------- 1 | package com.speechsuper; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | import org.apache.http.HttpEntity; 6 | import org.apache.http.client.ClientProtocolException; 7 | import org.apache.http.client.methods.CloseableHttpResponse; 8 | import org.apache.http.client.methods.HttpPost; 9 | import org.apache.http.entity.ContentType; 10 | import org.apache.http.entity.mime.MultipartEntityBuilder; 11 | import org.apache.http.entity.mime.content.FileBody; 12 | import org.apache.http.entity.mime.content.StringBody; 13 | import org.apache.http.impl.client.CloseableHttpClient; 14 | import org.apache.http.impl.client.DefaultHttpClient; 15 | import org.apache.http.util.EntityUtils; 16 | 17 | 18 | import java.io.File; 19 | import java.io.IOException; 20 | import java.security.MessageDigest; 21 | 22 | public class Sample { 23 | 24 | public static final String baseUrl = "https://api.speechsuper.com/"; 25 | public static final String appKey = "Insert your appKey here"; 26 | public static final String secretKey = "Insert your secretKey here"; 27 | 28 | public static String HttpAPI(String audioPath, String audioType, String audioSampleRate, String refText, String coreType) { 29 | String url = baseUrl + coreType; 30 | //userId is randomly generated because the userId cannot be same during concurrent access 31 | String userId = getRandomString(5); 32 | String res = null; 33 | CloseableHttpClient httpclient = new DefaultHttpClient(); 34 | String params = buildParam(appKey, secretKey, userId, audioType, audioSampleRate, refText, coreType); 35 | try { 36 | 37 | HttpPost httppost = new HttpPost(url); 38 | httppost.addHeader("Request-Index", "0"); 39 | 40 | StringBody comment = new StringBody(params, ContentType.APPLICATION_JSON); 41 | 42 | FileBody bin = new FileBody(new File(audioPath)); 43 | HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("text", comment).addPart("audio", bin).build(); 44 | httppost.setEntity(reqEntity); 45 | 46 | CloseableHttpResponse response = httpclient.execute(httppost); 47 | 48 | try { 49 | HttpEntity resEntity = response.getEntity(); 50 | if (resEntity != null) { 51 | res = EntityUtils.toString(resEntity, "UTF-8"); 52 | } 53 | } finally { 54 | response.close(); 55 | } 56 | } catch (ClientProtocolException e) { 57 | e.printStackTrace(); 58 | } catch (IOException e) { 59 | e.printStackTrace(); 60 | } finally { 61 | try { 62 | httpclient.close(); 63 | } catch (IOException e) { 64 | e.printStackTrace(); 65 | } 66 | } 67 | return res; 68 | } 69 | 70 | private static String buildParam(String appkey, String secretKey, String userId, String audioType, String audioSampleRate, String refText, String coreType) { 71 | 72 | MessageDigest digest = DigestUtils.getSha1Digest(); 73 | 74 | long timeReqMillis = System.currentTimeMillis(); 75 | String connectSigStr = appkey + timeReqMillis + secretKey; 76 | String connectSig = Hex.encodeHexString(digest.digest(connectSigStr.getBytes())); 77 | 78 | long timeStartMillis = System.currentTimeMillis(); 79 | String startSigStr = appkey + timeStartMillis + userId + secretKey; 80 | String startSig = Hex.encodeHexString(digest.digest(startSigStr.getBytes())); 81 | //request param 82 | String params = "{" 83 | + "\"connect\":{" 84 | + "\"cmd\":\"connect\"," 85 | + "\"param\":{" 86 | + "\"sdk\":{" 87 | + "\"protocol\":2," 88 | + "\"version\":16777472," 89 | + "\"source\":9" 90 | + "}," 91 | + "\"app\":{" 92 | + "\"applicationId\":\"" + appkey + "\"," 93 | + "\"sig\":\"" + connectSig + "\"," 94 | + "\"timestamp\":\"" + timeReqMillis + "\"" 95 | + "}" 96 | + "}" 97 | + "}," 98 | + "\"start\":{" 99 | + "\"cmd\":\"start\"," 100 | + "\"param\":{" 101 | + "\"app\":{" 102 | + "\"applicationId\":\"" + appkey + "\"," 103 | + "\"timestamp\":\"" + timeStartMillis + "\"," 104 | + "\"sig\":\"" + startSig + "\"," 105 | + "\"userId\":\"" + userId + "\"" 106 | + "}," 107 | + "\"audio\":{" 108 | + "\"sampleBytes\":2," 109 | + "\"channel\":1," 110 | + "\"sampleRate\":" + audioSampleRate + "," 111 | + "\"audioType\":\"" + audioType + "\"" 112 | + "}," 113 | + "\"request\":{" 114 | + "\"tokenId\":\"tokenId\"," 115 | + "\"refText\":\"" + refText + "\"," 116 | + "\"coreType\":\"" + coreType + "\"" 117 | + "}" 118 | + "}" 119 | + "}" 120 | + "}"; 121 | return params; 122 | } 123 | 124 | 125 | private static int getRandom(int count) { 126 | return (int) Math.round(Math.random() * (count)); 127 | } 128 | 129 | private static String charString = "abcdefghijklmnopqrstuvwxyz123456789"; 130 | 131 | private static String getRandomString(int length) { 132 | StringBuffer sb = new StringBuffer(); 133 | int len = charString.length(); 134 | for (int i = 0; i < length; i++) { 135 | sb.append(charString.charAt(getRandom(len - 1))); 136 | } 137 | return sb.toString(); 138 | } 139 | 140 | public static void main(String[] args) { 141 | String coreType = "word.eval.promax"; // Change the coreType according to your needs. 142 | String refText = "supermarket"; // Change the reference text according to your needs. 143 | String audioPath = "supermarket.wav"; // Change the audio path corresponding to the reference text. 144 | String audioType = "wav"; // Change the audio type corresponding to the audio file. 145 | String audioSampleRate = "16000"; 146 | String result = HttpAPI(audioPath, audioType, audioSampleRate, refText, coreType); 147 | System.out.println("result===>" + result); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /http_samples/java_http_sample/src/test/java/com/speechsuper/SampleTest.java: -------------------------------------------------------------------------------- 1 | package com.speechsuper; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple Sample. 9 | */ 10 | public class SampleTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public SampleTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( SampleTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testSample() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /http_samples/java_http_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/java_http_sample/supermarket.wav -------------------------------------------------------------------------------- /http_samples/javascript_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Modify the appKey in sample.html 4 | 2. Modify the secretKey in sample.html 5 | 3. Change the coreType according to your needs. 6 | 5. Change the reference text according to your needs. 7 | 6. Select the audio corresponding to the reference text. 8 | 7. Change the audio type corresponding to the audio file. 9 | 8. Double click sample.html -------------------------------------------------------------------------------- /http_samples/javascript_http_sample/sample.html: -------------------------------------------------------------------------------- 1 | 2 |

-----------javascript http sample-----------

3 |
4 |
  5 | refText: supermarket
  6 | 
7 | 8 | 9 | 10 |
 11 | 
 12 | 
13 |
14 | 15 | -------------------------------------------------------------------------------- /http_samples/javascript_http_sample/sha.js: -------------------------------------------------------------------------------- 1 | /* 2 | A JavaScript implementation of the SHA family of hashes, as 3 | defined in FIPS PUB 180-2 as well as the corresponding HMAC implementation 4 | as defined in FIPS PUB 198a 5 | 6 | Copyright Brian Turek 2008-2015 7 | Distributed under the BSD License 8 | See http://caligatio.github.com/jsSHA/ for more information 9 | 10 | Several functions taken from Paul Johnston 11 | */ 12 | 'use strict';(function(U){function z(a,b,c){var e=0,f=[0],k="",h=null,k=c||"UTF8";if("UTF8"!==k&&"UTF16BE"!==k&&"UTF16LE"!==k)throw"encoding must be UTF8, UTF16BE, or UTF16LE";if("HEX"===b){if(0!==a.length%2)throw"srcString of HEX type must be in byte increments";h=D(a);e=h.binLen;f=h.value}else if("TEXT"===b||"ASCII"===b)h=L(a,k),e=h.binLen,f=h.value;else if("B64"===b)h=M(a),e=h.binLen,f=h.value;else if("BYTES"===b)h=N(a),e=h.binLen,f=h.value;else throw"inputFormat must be HEX, TEXT, ASCII, B64, or BYTES"; 13 | this.getHash=function(a,b,c,k){var h=null,d=f.slice(),n=e,m;3===arguments.length?"number"!==typeof c&&(k=c,c=1):2===arguments.length&&(c=1);if(c!==parseInt(c,10)||1>c)throw"numRounds must a integer >= 1";switch(b){case "HEX":h=O;break;case "B64":h=P;break;case "BYTES":h=Q;break;default:throw"format must be HEX, B64, or BYTES";}if("SHA-1"===a)for(m=0;mm/8){for(;d.length<=b;)d.push(0);d[b]&=4294967040}for(n=0;n<=b;n+=1)r[n]=d[n]^ 16 | 909522486,u[n]=d[n]^1549556828;c="SHA-1"===c?A(u.concat(A(r.concat(f),a+e)),a+t):w(u.concat(w(r.concat(f),a+e,c)),a+t,c);return h(c,R(q))}}function q(a,b){this.a=a;this.b=b}function L(a,b){var c=[],e,f=[],k=0,h,p,q;if("UTF8"===b)for(h=0;he?f.push(e):2048>e?(f.push(192|e>>>6),f.push(128|e&63)):55296>e||57344<=e?f.push(224|e>>>12,128|e>>>6&63,128|e&63):(h+=1,e=65536+((e&1023)<<10|a.charCodeAt(h)&1023),f.push(240|e>>>18,128|e>>>12&63,128|e>>>6&63,128|e&63)), 17 | p=0;p>>2;c.length<=q;)c.push(0);c[q]|=f[p]<<24-k%4*8;k+=1}else if("UTF16BE"===b||"UTF16LE"===b)for(h=0;h>8);for(q=k>>>2;c.length<=q;)c.push(0);c[q]|=e<<16-k%4*8;k+=2}return{value:c,binLen:8*k}}function D(a){var b=[],c=a.length,e,f,k;if(0!==c%2)throw"String of HEX type must be in byte increments";for(e=0;e>>3;b.length<=k;)b.push(0);b[e>>>3]|=f<<24-e%8*4}return{value:b,binLen:4*c}}function N(a){var b=[],c,e,f;for(e=0;e>>2,b.length<=f&&b.push(0),b[f]|=c<<24-e%4*8;return{value:b,binLen:8*a.length}}function M(a){var b=[],c=0,e,f,k,h,p;if(-1===a.search(/^[a-zA-Z0-9=+\/]+$/))throw"Invalid character in base-64 string";f=a.indexOf("=");a=a.replace(/\=/g,"");if(-1!==f&&f { 85 | fs.readFile(audioPath) 86 | .then(audioData=> { 87 | let fd = new FormData(); 88 | fd.append("text", JSON.stringify(params)); 89 | fd.append("audio", audioData); 90 | let options = { 91 | host: baseHOST, 92 | path: "/" + coreType, 93 | method: "POST", 94 | protocol: "https:", 95 | headers: {"Request-Index": "0"} 96 | }; 97 | 98 | try{ 99 | const req = fd.submit(options, (err, res) => { 100 | if(err){ 101 | return reject(new Error(err.message)); 102 | } 103 | if(res.statusCode < 200 || res.statusCode > 299) { 104 | return reject(new Error(`HTTP status code ${res.statusCode}`)); 105 | } 106 | const body = []; 107 | res.on('data', (chunk) => body.push(chunk)); 108 | res.on('end', ()=>{ 109 | const resString = Buffer.concat(body).toString(); 110 | resolve(resString); 111 | }); 112 | }) 113 | }catch(e){ 114 | reject(e); 115 | }; 116 | }).catch(e=> { 117 | reject(e); 118 | }) 119 | }); 120 | } 121 | 122 | 123 | const requestParams = { 124 | coreType: coreType, 125 | refText: refText 126 | }; 127 | 128 | doEval(userId, audioType, audioSampleRate, requestParams, audioPath) 129 | .then(data=>{console.log(data)}) 130 | .catch(e=>{console.log(e)}); -------------------------------------------------------------------------------- /http_samples/nodejs_http_sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs_http_sample", 3 | "version": "0.1.0", 4 | "private": true, 5 | "type": "module", 6 | "dependencies": { 7 | "crypto": "^1.0.1", 8 | "form-data": "^4.0.0" 9 | }, 10 | "scripts": { 11 | "start": "node main.js" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /http_samples/nodejs_http_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/nodejs_http_sample/supermarket.wav -------------------------------------------------------------------------------- /http_samples/php_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install PHP (requirement: CURL library) 4 | 2. Modify the appKey in sample.php 5 | 3. Modify the secretKey in sample.php 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. 10 | 8. Run the following command: 11 | ``` 12 | php sample.php 13 | ``` -------------------------------------------------------------------------------- /http_samples/php_http_sample/sample.php: -------------------------------------------------------------------------------- 1 | 23 | ' 24 | { 25 | "connect": { 26 | "cmd": "connect", 27 | "param": { 28 | "sdk": { 29 | "protocol": 2, 30 | "version": 16777472, 31 | "source": 9 32 | }, 33 | "app": { 34 | "applicationId": "'.$appKey.'", 35 | "sig": "'. $conSig .'", 36 | "timestamp": "'. $ts.'" 37 | } 38 | } 39 | }, 40 | "start": { 41 | "cmd": "start", 42 | "param": { 43 | "app": { 44 | "applicationId": "'.$appKey.'", 45 | "timestamp": "'.$ts.'", 46 | "sig": "'.$startSig.'", 47 | "userId": "'.$userId.'" 48 | }, 49 | "audio": { 50 | "channel": 1, 51 | "sampleBytes": 2, 52 | "sampleRate": '.$audioSampleRate.', 53 | "audioType": "'.$audioType.'" 54 | }, 55 | "request": { 56 | "tokenId": "uuu", 57 | "coreType": "'.$coreType.'", 58 | "refText": "'.$refText.'" 59 | } 60 | } 61 | } 62 | } 63 | ', 64 | 'audio'=>file_get_contents(ltrim($audioPath))); 65 | curl_setopt($ch, CURLOPT_URL, $url); 66 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 67 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 68 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 69 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 70 | curl_setopt($ch, CURLOPT_AUTOREFERER, 1); 71 | curl_setopt($ch, CURLOPT_TIMEOUT_MS,30000); 72 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 30000); 73 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 74 | curl_setopt($ch, CURLOPT_POSTFIELDS, $strData); 75 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 76 | $output = curl_exec($ch); 77 | if($output === false) 78 | { 79 | echo 'Curl error: ' . curl_error($ch) . "\n"; 80 | } 81 | curl_close($ch); 82 | echo ($output); 83 | -------------------------------------------------------------------------------- /http_samples/php_http_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/php_http_sample/supermarket.wav -------------------------------------------------------------------------------- /http_samples/python_http_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install python 4 | 2. Modify the appKey in sample.py 5 | 3. Modify the secretKey in sample.py 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. 10 | 8. Run the following command: 11 | ``` 12 | python sample.py 13 | ``` -------------------------------------------------------------------------------- /http_samples/python_http_sample/sample.py: -------------------------------------------------------------------------------- 1 | #_*_encoding:utf-8_*_ 2 | import time 3 | import hashlib 4 | import requests 5 | import json 6 | 7 | appKey = "Insert your appKey here" 8 | secretKey = "Insert your secretKey here" 9 | 10 | baseURL = "https://api.speechsuper.com/" 11 | 12 | timestamp = str(int(time.time())) 13 | 14 | coreType = "word.eval.promax" # Change the coreType according to your needs. 15 | refText = "supermarket" # Change the reference text according to your needs. 16 | audioPath = "supermarket.wav" # Change the audio path corresponding to the reference text. 17 | audioType = "wav" # Change the audio type corresponding to the audio file. 18 | audioSampleRate = 16000 19 | userId = "guest" 20 | 21 | url = baseURL + coreType 22 | connectStr = (appKey + timestamp + secretKey).encode("utf-8") 23 | connectSig = hashlib.sha1(connectStr).hexdigest() 24 | startStr = (appKey + timestamp + userId + secretKey).encode("utf-8") 25 | startSig = hashlib.sha1(startStr).hexdigest() 26 | 27 | params={ 28 | "connect":{ 29 | "cmd":"connect", 30 | "param":{ 31 | "sdk":{ 32 | "version":16777472, 33 | "source":9, 34 | "protocol":2 35 | }, 36 | "app":{ 37 | "applicationId":appKey, 38 | "sig":connectSig, 39 | "timestamp":timestamp 40 | } 41 | } 42 | }, 43 | "start":{ 44 | "cmd":"start", 45 | "param":{ 46 | "app":{ 47 | "userId":userId, 48 | "applicationId":appKey, 49 | "timestamp":timestamp, 50 | "sig":startSig 51 | }, 52 | "audio":{ 53 | "audioType":audioType, 54 | "channel":1, 55 | "sampleBytes":2, 56 | "sampleRate":audioSampleRate 57 | }, 58 | "request":{ 59 | "coreType":coreType, 60 | "refText":refText, 61 | "tokenId":"tokenId" 62 | } 63 | 64 | } 65 | } 66 | } 67 | 68 | datas=json.dumps(params) 69 | data={'text':datas} 70 | headers={"Request-Index":"0"} 71 | files={"audio":open(audioPath,'rb')} 72 | res=requests.post(url, data=data, headers=headers, files=files) 73 | print(res.text.encode('utf-8', 'ignore').decode('utf-8')) 74 | -------------------------------------------------------------------------------- /http_samples/python_http_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/http_samples/python_http_sample/supermarket.wav -------------------------------------------------------------------------------- /images/Flowchart.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/images/Flowchart.jpg -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install Miscrosoft Visual Studio 2017+ (requirement: Net Framework 4.6+) 4 | 2. Modify the appKey in csharp_websocket_sample/Program.cs 5 | 3. Modify the secretKey in csharp_websocket_sample/Program.cs 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.1705 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_websocket_sample", "csharp_websocket_sample\csharp_websocket_sample.csproj", "{3B996F18-3740-4131-B3D5-2D3AA1A44E2B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {3B996F18-3740-4131-B3D5-2D3AA1A44E2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {3B996F18-3740-4131-B3D5-2D3AA1A44E2B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {3B996F18-3740-4131-B3D5-2D3AA1A44E2B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {3B996F18-3740-4131-B3D5-2D3AA1A44E2B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {4678B448-ABDE-46CE-83B1-E532793C5CF9} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/Program.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Security.Cryptography; 7 | using System.Text; 8 | using System.Net.WebSockets; 9 | using System.Threading.Tasks; 10 | 11 | namespace csharp_websocket_sample 12 | { 13 | class Program 14 | { 15 | private static readonly string baseUrl = "wss://api.speechsuper.com/"; 16 | private static readonly string appKey = "Insert your appKey here"; 17 | private static readonly string secretKey = "Insert your secretKey here"; 18 | 19 | 20 | public static async Task WebsocketAPIAsync(String audioPath, string audioType, int sampleRate, string coreType, Dictionary requests) { 21 | Dictionary paramDic = buildParams(audioType, sampleRate, requests); 22 | string connectionRequest = paramDic["connect"]; 23 | string startRequest = paramDic["start"]; 24 | string stopRequest = paramDic["stop"]; 25 | 26 | WebSocketclient ws = new WebSocketclient(); 27 | ws.OnClose = () => 28 | { 29 | Console.WriteLine("Close connection to websocket"); 30 | }; 31 | 32 | ws.OnError = (Exception e) => 33 | { 34 | Console.WriteLine($"error===>{e.StackTrace}"); 35 | }; 36 | 37 | ws.OnMessage = (string msg) => 38 | { 39 | Console.WriteLine($"result===>{msg}"); 40 | }; 41 | 42 | await ws.ConnectAsync(baseUrl + coreType); 43 | 44 | //Send auth 45 | await ws.SendAsync(Encoding.UTF8.GetBytes(connectionRequest), WebSocketMessageType.Text); 46 | 47 | //Send start request 48 | await ws.SendAsync(Encoding.UTF8.GetBytes(startRequest), WebSocketMessageType.Text); 49 | 50 | //Send audio 51 | byte[] audio = FileContent(audioPath); 52 | await ws.SendAsync(audio, WebSocketMessageType.Binary); 53 | 54 | //Send stop request 55 | await ws.SendAsync(Encoding.UTF8.GetBytes(stopRequest), WebSocketMessageType.Text); 56 | } 57 | 58 | private static byte[] FileContent(string fileName) 59 | { 60 | using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) 61 | { 62 | try 63 | { 64 | byte[] buffur = new byte[fs.Length]; 65 | fs.Read(buffur,0,(int)fs.Length); 66 | fs.Read(buffur,0,(int)fs.Length); 67 | return buffur; 68 | } 69 | catch (Exception ex) 70 | { 71 | throw ex; 72 | } 73 | } 74 | } 75 | 76 | private static Dictionary buildParams(string audioType, int sampleRate, Dictionary requests) 77 | { 78 | Dictionary paramDic = new Dictionary(); 79 | 80 | string userId = Guid.NewGuid().ToString(); 81 | string ts = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString();//timestamp 82 | string connectSigStr = appKey + ts + secretKey; 83 | string startSigStr = appKey + ts + userId + secretKey; 84 | string connectSig = sha1Hex(connectSigStr); 85 | string startSig = sha1Hex(startSigStr); 86 | 87 | //connect 88 | JObject connect = new JObject(); 89 | connect.Add("cmd", "connect"); 90 | JObject connectParam = new JObject(); 91 | 92 | JObject connectParamSdk = new JObject(); 93 | connectParamSdk.Add("protocol", 2); 94 | connectParamSdk.Add("version", 16777472); 95 | connectParamSdk.Add("source", 9); 96 | connectParam.Add("sdk", connectParamSdk); 97 | 98 | JObject connectParamApp = new JObject(); 99 | connectParamApp.Add("applicationId", appKey); 100 | connectParamApp.Add("sig", connectSig); 101 | connectParamApp.Add("timestamp", ts); 102 | connectParam.Add("app", connectParamApp); 103 | connect.Add("param", connectParam); 104 | 105 | paramDic.Add("connect", connect.ToString()); 106 | 107 | //start 108 | JObject start = new JObject(); 109 | start.Add("cmd", "start"); 110 | JObject startParam = new JObject(); 111 | 112 | JObject startParamApp = new JObject(); 113 | startParamApp.Add("applicationId", appKey); 114 | startParamApp.Add("sig", startSig); 115 | startParamApp.Add("timestamp", ts); 116 | startParamApp.Add("userId", userId); 117 | startParam.Add("app", startParamApp); 118 | 119 | JObject startParamAudio = new JObject(); 120 | startParamAudio.Add("sampleBytes", 2); 121 | startParamAudio.Add("channel", 1); 122 | startParamAudio.Add("sampleRate", sampleRate); 123 | startParamAudio.Add("audioType", audioType); 124 | startParam.Add("audio", startParamAudio); 125 | 126 | JObject startParamRequest = new JObject(); 127 | startParamRequest = (JObject)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(requests)); 128 | startParamRequest.Add("tokenId", Guid.NewGuid().ToString()); 129 | startParam.Add("request", startParamRequest); 130 | 131 | start.Add("param", startParam); 132 | 133 | paramDic.Add("start", start.ToString()); 134 | 135 | //stop 136 | paramDic.Add("stop", "{\"cmd\":\"stop\"}"); 137 | 138 | return paramDic; 139 | } 140 | 141 | private static string sha1Hex(string s) 142 | { 143 | try 144 | { 145 | SHA1 sha1 = new SHA1CryptoServiceProvider(); 146 | byte[] bytesIn = Encoding.UTF8.GetBytes(s); 147 | byte[] bytesOut = sha1.ComputeHash(bytesIn); 148 | var sb = new StringBuilder(); 149 | foreach (byte b in bytesOut) 150 | { 151 | sb.Append(b.ToString("x2")); 152 | } 153 | 154 | return sb.ToString().ToLower(); 155 | } 156 | catch (Exception ex) 157 | { 158 | throw new Exception("SHA1 encryption error:" + ex.Message); 159 | } 160 | } 161 | 162 | static void Main(string[] args) 163 | { 164 | string coreType = "word.eval.promax"; // Change the coreType according to your needs. 165 | string refText = "supermarket" // Change the reference text according to your needs. 166 | string audioPath = "supermarket.wav"; // Change the audio path corresponding to the reference text. 167 | string audioType = "wav"; // Change the audio type corresponding to the audio file. 168 | int sampleRate = 16000; 169 | 170 | Dictionary requests = new Dictionary(); 171 | requests.Add("coreType", coreType); 172 | requests.Add("refText", refText); 173 | WebsocketAPIAsync(audioPath, audioType, sampleRate, coreType, requests); 174 | Console.ReadLine(); 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("csharp_websocket_sample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("csharp_websocket_sample")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("3b996f18-3740-4131-b3d5-2d3aa1a44e2b")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/WebSocketclient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net.WebSockets; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | namespace csharp_websocket_sample 11 | { 12 | class WebSocketclient 13 | { 14 | private readonly SemaphoreSlim sendResource = new SemaphoreSlim(1, 1); 15 | 16 | private readonly ClientWebSocket ws; 17 | 18 | private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); 19 | 20 | public WebSocketclient() 21 | { 22 | ws = new ClientWebSocket(); 23 | } 24 | 25 | public Action OnMessage { get; set; } 26 | public Action OnClose { get; set; } 27 | public Action OnError { get; set; } 28 | 29 | public async Task ConnectAsync(string url, CancellationToken cancellationToken = default(CancellationToken)) 30 | { 31 | await ws.ConnectAsync(new Uri(url), cancellationToken).ConfigureAwait(false); 32 | Receive(); 33 | 34 | } 35 | 36 | private async void Receive() 37 | { 38 | while(true) 39 | { 40 | byte[] bytes = new byte[4096]; 41 | 42 | try 43 | { 44 | var result = await ws.ReceiveAsync(new ArraySegment(bytes), cancellationTokenSource.Token).ConfigureAwait(false); 45 | if(result != null && (result.CloseStatus.HasValue || result.MessageType == WebSocketMessageType.Close)) 46 | { 47 | if (OnClose != null) 48 | { 49 | OnClose(); 50 | } 51 | break; 52 | } else 53 | { 54 | using (var stream = new MemoryStream()) 55 | { 56 | stream.Write(bytes, 0, result.Count); 57 | while (!result.EndOfMessage) 58 | { 59 | result = await ws.ReceiveAsync(new ArraySegment(bytes), CancellationToken.None); 60 | stream.Write(bytes, 0, result.Count); 61 | } 62 | 63 | stream.Seek(0, SeekOrigin.Begin); 64 | using (var reader = new StreamReader(stream, Encoding.UTF8)) 65 | { 66 | string message = reader.ReadToEnd(); 67 | if(OnMessage != null) 68 | { 69 | OnMessage(message); 70 | } 71 | } 72 | } 73 | } 74 | } catch(OperationCanceledException) 75 | { 76 | if(OnClose != null) 77 | { 78 | OnClose(); 79 | } 80 | break; 81 | } catch (Exception e) 82 | { 83 | if(OnError != null) 84 | { 85 | OnError(e); 86 | } 87 | break; 88 | } 89 | } 90 | } 91 | 92 | public async Task SendAsync(byte[] buffer, WebSocketMessageType messageType, CancellationToken _cancellationToken = default(CancellationToken)) 93 | { 94 | await sendResource.WaitAsync(_cancellationToken).ConfigureAwait(false); 95 | try 96 | { 97 | var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_cancellationToken, cancellationTokenSource.Token); 98 | await ws.SendAsync(new ArraySegment(buffer), messageType, true, linkedTokenSource.Token).ConfigureAwait(false); 99 | }finally 100 | { 101 | sendResource.Release(); 102 | } 103 | } 104 | 105 | public void Cancel() 106 | { 107 | cancellationTokenSource.Cancel(); 108 | if (ws != null) 109 | { 110 | if(ws.State == WebSocketState.Open) 111 | { 112 | ws.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None); 113 | ws.Dispose(); 114 | } 115 | } 116 | } 117 | 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/bin/Debug/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/websocket_samples/csharp_websocket_sample/csharp_websocket_sample/bin/Debug/supermarket.wav -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/csharp_websocket_sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3B996F18-3740-4131-B3D5-2D3AA1A44E2B} 8 | Exe 9 | csharp_websocket_sample 10 | csharp_websocket_sample 11 | v4.6 12 | 512 13 | true 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\packages\Newtonsoft.Json.13.0.1\lib\net40\Newtonsoft.Json.dll 40 | 41 | 42 | 43 | 44 | ..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /websocket_samples/csharp_websocket_sample/csharp_websocket_sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /websocket_samples/golang_websocket_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Install Golang 4 | 2. Modify the appKey in sample.go 5 | 3. Modify the secretKey in sample.go 6 | 4. Change the coreType according to your needs. 7 | 5. Change the reference text according to your needs. 8 | 6. Change the audio path corresponding to the reference text. 9 | 7. Change the audio type corresponding to the audio file. 10 | 8. Run the app -------------------------------------------------------------------------------- /websocket_samples/golang_websocket_sample/go.mod: -------------------------------------------------------------------------------- 1 | module golang_websocket_sample 2 | 3 | go 1.15 4 | 5 | require ( 6 | github.com/google/uuid v1.3.0 7 | github.com/gorilla/websocket v1.5.0 8 | ) 9 | -------------------------------------------------------------------------------- /websocket_samples/golang_websocket_sample/sample.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | //Import packages used by the project 4 | import ( 5 | "crypto/sha1" 6 | "sync" 7 | 8 | "flag" 9 | "fmt" 10 | "io/ioutil" 11 | "strconv" 12 | 13 | "log" 14 | 15 | "os" 16 | "os/signal" 17 | "time" 18 | 19 | "github.com/google/uuid" 20 | "github.com/gorilla/websocket" 21 | ) 22 | 23 | 24 | func main() { 25 | flag.Parse() 26 | log.SetFlags(0) 27 | 28 | interrupt := make(chan os.Signal, 1) 29 | signal.Notify(interrupt, os.Interrupt) 30 | 31 | appKey := "Insert your appKey here" 32 | secretKey := "Insert your secretKey here" 33 | 34 | baseURL := "wss://api.speechsuper.com/" 35 | 36 | coreType := "word.eval.promax" // Change the coreType according to your needs. 37 | refText := "supermarket" // Change the reference text according to your needs. 38 | audioPath := "supermarket.wav" // Change the audio path corresponding to the reference text. 39 | audioType := "wav" // Change the audio type corresponding to the audio file. 40 | audioSampleRate := "16000" 41 | userId := "guest" // Required and customizable. This value is required when generating startSig 42 | 43 | //create connect 44 | url := baseURL + coreType 45 | wsClient, _, err := websocket.DefaultDialer.Dial(url, nil) 46 | if err != nil { 47 | log.Fatal("dial:", err) 48 | } 49 | 50 | wg := new(sync.WaitGroup) 51 | wg.Add(1) 52 | 53 | go func(wsClient *websocket.Conn) { 54 | defer wg.Done() 55 | _, message, err := wsClient.ReadMessage() 56 | if err != nil { 57 | log.Println("websocket error:", err) 58 | return 59 | } 60 | log.Printf("result===> %s", message) 61 | }(wsClient) 62 | 63 | //send connect request 64 | timestamp := strconv.FormatInt(time.Now().Unix(), 10) 65 | data := []byte(appKey + timestamp + secretKey) 66 | connectSig := fmt.Sprintf("%x", sha1.Sum(data)) 67 | //connect param 68 | connectStr := `{"cmd":"connect","param":{"sdk":{"version":16777472,"source":1,"protocol":1},"app":{"applicationId":"`+ appKey + `","sig":"` + connectSig + `","timestamp":"` + timestamp + `"}}}` 69 | wsClient.WriteMessage(websocket.TextMessage, []byte(connectStr)) 70 | 71 | //send start request 72 | timestamp = strconv.FormatInt(time.Now().Unix(), 10) 73 | data = []byte(appKey + timestamp + userId + secretKey) 74 | startSig := fmt.Sprintf("%x", sha1.Sum(data)) 75 | tokenId := uuid.New().String() 76 | //start param 77 | startStr := `{"cmd":"start","param":{"app":{"applicationId":"` + appKey + `","sig":"` + startSig+ `","timestamp":"` + timestamp + `","userId":"` + userId + `"},"audio":{"audioType":"` + audioType + `","sampleRate":` + audioSampleRate + `,"channel":1,"sampleBytes":2},"request":{"coreType":"` + coreType + `","refText":"` + refText + `","tokenId":"` + tokenId + `"}}}` 78 | wsClient.WriteMessage(websocket.TextMessage, []byte(startStr)) 79 | 80 | //send audio 81 | f, _ := os.Open(audioPath) 82 | defer f.Close() 83 | voiceBytes, _ := ioutil.ReadAll(f) 84 | wsClient.WriteMessage(websocket.BinaryMessage, voiceBytes) 85 | 86 | //send stop request 87 | stopStr := `{"cmd":"stop"}` 88 | wsClient.WriteMessage(websocket.TextMessage, []byte(stopStr)) 89 | 90 | wg.Wait() 91 | } 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /websocket_samples/golang_websocket_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/websocket_samples/golang_websocket_sample/supermarket.wav -------------------------------------------------------------------------------- /websocket_samples/java_websocket_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | - Modify the appKey in src\main\java\com\speechsuper\Sample.java 3 | - Modify the secretKey in src\main\java\com\speechsuper\Sample.java 4 | - Change the coreType according to your needs. 5 | - Change the reference text according to your needs. 6 | - Change the audio path corresponding to the reference text. 7 | - Change the audio type corresponding to the audio file. 8 | 9 | # Requirements 10 | - Java JDK 1.7+ 11 | - Maven 12 | 13 | # Command lines 14 | - Compile: 15 | ``` 16 | mvn clean compile 17 | ``` 18 | - Run the `Sample` class: 19 | ``` 20 | mvn compile exec:java -Dexec.mainClass="com.speechsuper.Sample" 21 | ``` -------------------------------------------------------------------------------- /websocket_samples/java_websocket_sample/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.speechsuper 6 | java_websocket_sample 7 | 0.0.1-SNAPSHOT 8 | jar 9 | 10 | java_websocket_sample 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 16 | 17 | 18 | 19 | junit 20 | junit 21 | 3.8.1 22 | test 23 | 24 | 25 | commons-codec 26 | commons-codec 27 | 1.15 28 | 29 | 30 | org.java-websocket 31 | Java-WebSocket 32 | 1.5.2 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /websocket_samples/java_websocket_sample/src/main/java/com/speechsuper/Sample.java: -------------------------------------------------------------------------------- 1 | package com.speechsuper; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | import org.java_websocket.client.WebSocketClient; 6 | import org.java_websocket.handshake.ServerHandshake; 7 | 8 | import java.io.IOException; 9 | import java.net.URISyntaxException; 10 | import java.security.MessageDigest; 11 | import java.net.URI; 12 | import java.util.ArrayList; 13 | import java.io.FileInputStream; 14 | import java.io.FileNotFoundException; 15 | 16 | public class Sample { 17 | public static final String baseUrl = "wss://api.speechsuper.com/"; 18 | public static final String appKey = "Insert your appKey here"; 19 | public static final String secretKey = "Insert your secretKey here"; 20 | 21 | public static void WebsocketAPI(String audioPath, String audioType, String audioSampleRate, String refText, String coreType) { 22 | String url = baseUrl + coreType; 23 | //Randomly generate userId 24 | String userId = getRandomString(5); 25 | final ArrayList param = buildParam(appKey, secretKey, userId, audioType, audioSampleRate, refText, coreType); 26 | try { 27 | MyWebSocketClient client = new MyWebSocketClient(url, param, audioPath); 28 | client.connect(); 29 | } catch (Exception e) { 30 | e.printStackTrace(); 31 | } 32 | } 33 | 34 | private static ArrayList buildParam(String appkey, String secretKey, String userId, String audioType, String audioSampleRate, String refText, String coreType) { 35 | //SHA1 algorithm tool 36 | MessageDigest digest = DigestUtils.getSha1Digest(); 37 | 38 | //connect timestamp 39 | long timeReqMillis = System.currentTimeMillis(); 40 | String connectSigStr = appkey + timeReqMillis + secretKey; 41 | String connectSig = Hex.encodeHexString(digest.digest(connectSigStr.getBytes())); 42 | 43 | //start timestamp 44 | long timeStartMillis = System.currentTimeMillis(); 45 | String startSigStr = appkey + timeStartMillis + userId + secretKey; 46 | String startSig = Hex.encodeHexString(digest.digest(startSigStr.getBytes())); 47 | 48 | //request param 49 | String connect = "{" 50 | + "\"cmd\":\"connect\"," 51 | + "\"param\":{" 52 | + "\"sdk\":{" 53 | + "\"protocol\":2," 54 | + "\"version\":16777472," 55 | + "\"source\":9" 56 | + "}," 57 | + "\"app\":{" 58 | + "\"applicationId\":\"" + appkey + "\"," 59 | + "\"sig\":\"" + connectSig + "\"," 60 | + "\"timestamp\":\"" + timeReqMillis + "\"" 61 | + "}" 62 | + "}" 63 | + "}"; 64 | 65 | String start = "{" 66 | + "\"cmd\":\"start\"," 67 | + "\"param\":{" 68 | + "\"app\":{" 69 | + "\"applicationId\":\"" + appkey + "\"," 70 | + "\"timestamp\":\"" + timeStartMillis + "\"," 71 | + "\"sig\":\"" + startSig + "\"," 72 | + "\"userId\":\"" + userId + "\"" 73 | + "}," 74 | + "\"audio\":{" 75 | + "\"sampleBytes\":2," 76 | + "\"channel\":1," 77 | + "\"sampleRate\":" + audioSampleRate + "," 78 | + "\"audioType\":\"mp3\"" 79 | + "}," 80 | + "\"request\":{" 81 | + "\"tokenId\":\"sfasdfadsfasewqaf\"," 82 | + "\"refText\":\"" + refText + "\"," 83 | + "\"coreType\":\"" + coreType + "\"" 84 | + "}" 85 | + "}" 86 | + "}"; 87 | 88 | String stop = "{" 89 | + "\"cmd\":\"stop\"" 90 | + "}"; 91 | 92 | ArrayList params = new ArrayList(); 93 | params.add(connect); 94 | params.add(start); 95 | params.add(stop); 96 | return params; 97 | } 98 | 99 | private static int getRandom(int count) { 100 | return (int) Math.round(Math.random() * (count)); 101 | } 102 | 103 | private static String charString = "abcdefghijklmnopqrstuvwxyz123456789"; 104 | 105 | private static String getRandomString(int length) {//Generate random string 106 | StringBuffer sb = new StringBuffer(); 107 | int len = charString.length(); 108 | for (int i = 0; i < length; i++) { 109 | sb.append(charString.charAt(getRandom(len - 1))); 110 | } 111 | return sb.toString(); 112 | } 113 | 114 | public static void main(String[] args) { 115 | String coreType = "word.eval.promax"; // Change the coreType according to your needs. 116 | String refText = "supermarket"; // Change the reference text according to your needs. 117 | String audioPath = "supermarket.wav"; // Change the audio path corresponding to the reference text. 118 | String audioType = "wav"; // Change the audio type corresponding to the audio file. 119 | String audioSampleRate = "16000"; 120 | 121 | WebsocketAPI(audioPath, audioType, audioSampleRate, refText, coreType); 122 | /*Analog blocking*/ 123 | try { 124 | Thread.sleep(2000); 125 | } catch (InterruptedException e) { 126 | e.printStackTrace(); 127 | } 128 | } 129 | } 130 | 131 | /** 132 | * Customized WebSocketClient 133 | */ 134 | class MyWebSocketClient extends WebSocketClient { 135 | public int bytes; 136 | public ArrayList param; 137 | public String audioPath; 138 | 139 | public MyWebSocketClient(String url, ArrayList param, String audioPath) throws URISyntaxException { 140 | super(new URI(url)); 141 | this.param = param; 142 | this.audioPath = audioPath; 143 | } 144 | 145 | public void onOpen(ServerHandshake serverHandshake) { 146 | this.send(param.get(0).toString()); 147 | this.send(param.get(1).toString()); 148 | try { 149 | FileInputStream fs = new FileInputStream(audioPath); 150 | byte[] buffer = new byte[1024]; 151 | while ((bytes = fs.read(buffer)) > 0) { 152 | //send audio 153 | this.send(buffer); 154 | } 155 | fs.close(); 156 | } catch (FileNotFoundException e) { 157 | 158 | e.printStackTrace(); 159 | } catch (IOException e) { 160 | e.printStackTrace(); 161 | } 162 | this.send(param.get(2).toString()); 163 | } 164 | 165 | @Override 166 | public void onMessage(String msg) { 167 | //Receive results 168 | System.out.println("result===>" + msg); 169 | } 170 | 171 | @Override 172 | public void onClose(int code, String reason, boolean remote) { 173 | //Disconnect 174 | } 175 | 176 | @Override 177 | public void onError(Exception e) { 178 | e.printStackTrace(); 179 | } 180 | } 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /websocket_samples/java_websocket_sample/src/test/java/com/speechsuper/SampleTest.java: -------------------------------------------------------------------------------- 1 | package com.speechsuper; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple Sample. 9 | */ 10 | public class SampleTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public SampleTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( SampleTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testSample() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /websocket_samples/java_websocket_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/websocket_samples/java_websocket_sample/supermarket.wav -------------------------------------------------------------------------------- /websocket_samples/javascript_websocket_sample/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Modify the appKey in sample.html 4 | 2. Modify the secretKey in sample.html 5 | 3. Change the coreType according to your needs. 6 | 4. Change the reference text according to your needs. 7 | 5. Select the audio corresponding to the reference text. 8 | 6. Change the audio type corresponding to the audio file. 9 | 7. Double click sample.html -------------------------------------------------------------------------------- /websocket_samples/javascript_websocket_sample/sample.html: -------------------------------------------------------------------------------- 1 | 2 |

-----------javascript websocket sample-----------

3 |
4 |
  5 | refText: supermarket
  6 | 
7 | 8 | 9 | 10 |
 11 | 
 12 | 
13 |
14 | 15 | -------------------------------------------------------------------------------- /websocket_samples/javascript_websocket_sample/sha.js: -------------------------------------------------------------------------------- 1 | /* 2 | A JavaScript implementation of the SHA family of hashes, as 3 | defined in FIPS PUB 180-2 as well as the corresponding HMAC implementation 4 | as defined in FIPS PUB 198a 5 | 6 | Copyright Brian Turek 2008-2015 7 | Distributed under the BSD License 8 | See http://caligatio.github.com/jsSHA/ for more information 9 | 10 | Several functions taken from Paul Johnston 11 | */ 12 | 'use strict';(function(U){function z(a,b,c){var e=0,f=[0],k="",h=null,k=c||"UTF8";if("UTF8"!==k&&"UTF16BE"!==k&&"UTF16LE"!==k)throw"encoding must be UTF8, UTF16BE, or UTF16LE";if("HEX"===b){if(0!==a.length%2)throw"srcString of HEX type must be in byte increments";h=D(a);e=h.binLen;f=h.value}else if("TEXT"===b||"ASCII"===b)h=L(a,k),e=h.binLen,f=h.value;else if("B64"===b)h=M(a),e=h.binLen,f=h.value;else if("BYTES"===b)h=N(a),e=h.binLen,f=h.value;else throw"inputFormat must be HEX, TEXT, ASCII, B64, or BYTES"; 13 | this.getHash=function(a,b,c,k){var h=null,d=f.slice(),n=e,m;3===arguments.length?"number"!==typeof c&&(k=c,c=1):2===arguments.length&&(c=1);if(c!==parseInt(c,10)||1>c)throw"numRounds must a integer >= 1";switch(b){case "HEX":h=O;break;case "B64":h=P;break;case "BYTES":h=Q;break;default:throw"format must be HEX, B64, or BYTES";}if("SHA-1"===a)for(m=0;mm/8){for(;d.length<=b;)d.push(0);d[b]&=4294967040}for(n=0;n<=b;n+=1)r[n]=d[n]^ 16 | 909522486,u[n]=d[n]^1549556828;c="SHA-1"===c?A(u.concat(A(r.concat(f),a+e)),a+t):w(u.concat(w(r.concat(f),a+e,c)),a+t,c);return h(c,R(q))}}function q(a,b){this.a=a;this.b=b}function L(a,b){var c=[],e,f=[],k=0,h,p,q;if("UTF8"===b)for(h=0;he?f.push(e):2048>e?(f.push(192|e>>>6),f.push(128|e&63)):55296>e||57344<=e?f.push(224|e>>>12,128|e>>>6&63,128|e&63):(h+=1,e=65536+((e&1023)<<10|a.charCodeAt(h)&1023),f.push(240|e>>>18,128|e>>>12&63,128|e>>>6&63,128|e&63)), 17 | p=0;p>>2;c.length<=q;)c.push(0);c[q]|=f[p]<<24-k%4*8;k+=1}else if("UTF16BE"===b||"UTF16LE"===b)for(h=0;h>8);for(q=k>>>2;c.length<=q;)c.push(0);c[q]|=e<<16-k%4*8;k+=2}return{value:c,binLen:8*k}}function D(a){var b=[],c=a.length,e,f,k;if(0!==c%2)throw"String of HEX type must be in byte increments";for(e=0;e>>3;b.length<=k;)b.push(0);b[e>>>3]|=f<<24-e%8*4}return{value:b,binLen:4*c}}function N(a){var b=[],c,e,f;for(e=0;e>>2,b.length<=f&&b.push(0),b[f]|=c<<24-e%4*8;return{value:b,binLen:8*a.length}}function M(a){var b=[],c=0,e,f,k,h,p;if(-1===a.search(/^[a-zA-Z0-9=+\/]+$/))throw"Invalid character in base-64 string";f=a.indexOf("=");a=a.replace(/\=/g,"");if(-1!==f&&f' + message) 111 | except websockets.exceptions.ConnectionClosedError: 112 | print('Close connection to websocket') 113 | 114 | 115 | asyncio.get_event_loop().run_until_complete(main_logic()) -------------------------------------------------------------------------------- /websocket_samples/python_websocket_sample/supermarket.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/speechsuper/SpeechSuper-API-Samples/0d6bb10ca7a86e62a9848c81225f1a17d189ce27/websocket_samples/python_websocket_sample/supermarket.wav --------------------------------------------------------------------------------