To call Azure Marketplace Translation (and Speech) service
Dependencies: EthernetInterface-FRDM HTTPClient-SSL R_BSP SDFileSystem TLV320_RBSP USBHost mbed-rtos mbed-src
The program calls Azure Marketplace Translation (and Speech) service.
How to use - Create an account for Microsoft Azure Marketplace - Get client ID and client secret. - Change client ID and client secret in main.cpp
The program was created based on the following libraries.
CodePlex Text-To-Speech with Microsoft Translator Service http://translatorservice.codeplex.com/
MBED HTTPClient-SSL Library https://developer.mbed.org/teams/MultiTech/code/HTTPClient-SSL/
SpeechSynthesizer.h@0:40a09c55e5be, 2015-11-07 (annotated)
- Committer:
- ksekimoto
- Date:
- Sat Nov 07 12:21:19 2015 +0000
- Revision:
- 0:40a09c55e5be
The frist version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ksekimoto | 0:40a09c55e5be | 1 | //////////////////////////////////////////////////////////////////////////// |
ksekimoto | 0:40a09c55e5be | 2 | // Licensed under the Apache License, Version 2.0 (the "License"); |
ksekimoto | 0:40a09c55e5be | 3 | // you may not use this file except in compliance with the License. |
ksekimoto | 0:40a09c55e5be | 4 | // You may obtain a copy of the License at |
ksekimoto | 0:40a09c55e5be | 5 | // |
ksekimoto | 0:40a09c55e5be | 6 | // http://www.apache.org/licenses/LICENSE-2.0 |
ksekimoto | 0:40a09c55e5be | 7 | // |
ksekimoto | 0:40a09c55e5be | 8 | // Unless required by applicable law or agreed to in writing, software |
ksekimoto | 0:40a09c55e5be | 9 | // distributed under the License is distributed on an "AS IS" BASIS, |
ksekimoto | 0:40a09c55e5be | 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ksekimoto | 0:40a09c55e5be | 11 | // See the License for the specific language governing permissions and |
ksekimoto | 0:40a09c55e5be | 12 | // limitations under the License. |
ksekimoto | 0:40a09c55e5be | 13 | // |
ksekimoto | 0:40a09c55e5be | 14 | // Copyright (c) Microsoft Corporation. All rights reserved. |
ksekimoto | 0:40a09c55e5be | 15 | // Portions Copyright (c) Kentaro Sekimoto All rights reserved. |
ksekimoto | 0:40a09c55e5be | 16 | // |
ksekimoto | 0:40a09c55e5be | 17 | // Based on Text-To-Speech for .NET Micro Framework with Microsoft |
ksekimoto | 0:40a09c55e5be | 18 | // Translator Service |
ksekimoto | 0:40a09c55e5be | 19 | // https://code.msdn.microsoft.com/Text-To-Speech-for-NET-9cea4462 |
ksekimoto | 0:40a09c55e5be | 20 | // |
ksekimoto | 0:40a09c55e5be | 21 | //////////////////////////////////////////////////////////////////////////// |
ksekimoto | 0:40a09c55e5be | 22 | |
ksekimoto | 0:40a09c55e5be | 23 | #include "mbed.h" |
ksekimoto | 0:40a09c55e5be | 24 | |
ksekimoto | 0:40a09c55e5be | 25 | class SpeechSynthesizer |
ksekimoto | 0:40a09c55e5be | 26 | { |
ksekimoto | 0:40a09c55e5be | 27 | public: |
ksekimoto | 0:40a09c55e5be | 28 | SpeechSynthesizer(const char *clientID, const char *clientSecret); |
ksekimoto | 0:40a09c55e5be | 29 | void GetSpeakStream(char *filename, char *text, char *language); |
ksekimoto | 0:40a09c55e5be | 30 | void UpdateToken(); |
ksekimoto | 0:40a09c55e5be | 31 | char *Translate(char *text, char *to); |
ksekimoto | 0:40a09c55e5be | 32 | ~SpeechSynthesizer(); |
ksekimoto | 0:40a09c55e5be | 33 | private: |
ksekimoto | 0:40a09c55e5be | 34 | char *id; |
ksekimoto | 0:40a09c55e5be | 35 | char *secret; |
ksekimoto | 0:40a09c55e5be | 36 | char *language; |
ksekimoto | 0:40a09c55e5be | 37 | char *audioFormat; |
ksekimoto | 0:40a09c55e5be | 38 | char *audioQuality; |
ksekimoto | 0:40a09c55e5be | 39 | char token[512]; |
ksekimoto | 0:40a09c55e5be | 40 | }; |