通过google cloud API 使用 WaveNet
Cloud Text-to-Speech 中使用了WaveNet,用于TTS,页面上有Demo。目前是BETA版
使用方法
- 注册及认证参考:Quickstart: Text-to-Speech
- 安装google clould 的python库
- 安装 Google Cloud Text-to-Speech API Python 依赖(Dependencies),参见github说明
- ----其中包括了,安装pip install google-cloud-texttospeech==0.1.0
为了implicit调用,设置环境变量GOOGLE_APPLICATION_CREDENTIALS到你的API Key(json文件),完成后重启

python脚本:text到mp3
# [START tts_synthesize_text]
def synthesize_text(text):
"""Synthesizes speech from the input string of text."""
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient() input_text = texttospeech.types.SynthesisInput(text=text) # Note: the voice can also be specified by name.
# Names of voices can be retrieved with client.list_voices().
voice = texttospeech.types.VoiceSelectionParams(
language_code='en-US',
ssml_gender=texttospeech.enums.SsmlVoiceGender.FEMALE) audio_config = texttospeech.types.AudioConfig(
audio_encoding=texttospeech.enums.AudioEncoding.MP3) response = client.synthesize_speech(input_text, voice, audio_config) # The response's audio_content is binary.
with open('output.mp3', 'wb') as out:
out.write(response.audio_content)
print('Audio content written to file "output.mp3"')
# [END tts_synthesize_text]
WaveNet特性
目前支持的6种voice type


参数说明
https://cloud.google.com/text-to-speech/docs/reference/rest/v1beta1/text/synthesize#audioconfig
- input_text

- voice

- audio_config


通过google cloud API 使用 WaveNet的更多相关文章
- 【Google Cloud技术咨询】「Contact Center AI」引领我们走向高度智能客服的时代
前提背景 我们距离"不再智障"的智能客服还有多远?对于智能客服,用户一直都是"批评多于褒奖",究其原因是在于人们对于AI客服的期待很高,而AI客服在实际应用中的 ...
- 利用Google Speech API实现Speech To Text
很久很久以前, 网上流传着一个免费的,识别率暴高的,稳定的 Speech To Text API, 那就是Google Speech API. 但是最近再使用的时候,总是返回500 Error. 后来 ...
- Getting Started(Google Cloud Storage Client Library)
在运行下面的步骤之前,请确保: 1.你的项目已经激活了Google Cloud Storage和App Engine,包括已经创建了至少一个Cloud Storage bucket. 2.你已经下载了 ...
- Activating Google Cloud Storage
先决条件 你需要下面的内容: 1.一个Google账户,比如来自Gmail.如果你没有,请在Google account signup site注册. 2.一个新的或已经存在的Google Devel ...
- Downloading the Google Cloud Storage Client Library
Google Cloud Storage client是一个客户端库,与任何一个生产环境使用的App Engine版本都相互独立.如果你想使用App Engine Development server ...
- Java Client for Google Cloud Storage
关于Google Cloud Storage Google Cloud Storage有益于大文件的存储与服务(serve).此外,Cloud Storage提供了对访问控制列表(ACLs)的使用,提 ...
- 使用GCM服务(Google Cloud Messaging)实现Android消息推送
最近在网上查了关于很多Android消息推送的资料,其中主要有四种方法. 1) 使用GCM服务(Google Cloud Messaging) 2) 使用XMPP协议(Openfire + Spark ...
- Asp.net MVC集成Google Calendar API(附Demo源码)
Asp.net MVC集成Google Calendar API(附Demo源码) Google Calendar是非常方便的日程管理应用,很多人都非常熟悉.Google的应用在国内不稳定,但是在国外 ...
- 使用Google Cloud Platform构建机器学习项目-宠物识别
宠物识别我们使用到了tensorflow object-detection API (https://github.com/tensorflow/models/tree/master/researc ...
随机推荐
- Java前后端依赖
有时候我们的一个类需要依赖另外一个类,这种就是依赖关系,创建对象的工作一般由spring容器来完成然后注入给调用者,这种就是依赖注入. 代码可参考1227210565朋友空间 DispatcherSe ...
- WEBBASE篇: 第十篇, JavaScript知识5
JavaScript知识5 <!doctype html> <html lang="en"> <head> <meta charset=& ...
- @NotNull和@NotEmpty和@NotBlank 区别
1.@NotNull:不能为null,但可以为empty:用在基本类型上. 2.@NotEmpty:不能为null,而且长度必须大于0:用在集合类上面. 3.@NotBlank:只能作用在String ...
- 学习flask需要用到的包
Flask 需要下载的包 1.pip install flask 2.pip install flask-script 3.pip install flask-sqlalchemy 4.pip ins ...
- js中数组常用方法总结
操作数组 印象中数组有很多方法,系统的整理一下,放在自己家里方便回头查~ Array.map() 此方法是将数组中的每个元素调用一个提供的函数,结果作为一个新的数组返回,并没有改变原来的数组 1 2 ...
- idea上手
IntelliJ Idea 常用快捷键列表 最常用: Ctrl+P,可以显示参数信息 Alt+Insert,可以生成构造器/Getter/Setter等 Ctrl+Enter,导入包,自动修正 Ctr ...
- springAop整合自定义注解做方法日志配置(源码在附件)
package com.aop.log.anno; import java.lang.annotation.ElementType; import java.lang.annotation.Reten ...
- (转)volatile 的理解
对于(volatile unsigned char *)0x20我们再分析一下,它是由两部分组成: 1) (unsigned char *)0x20,0x20只是个值,前面加(unsigned cha ...
- PythonStudy——Global关键字
# 作用:将局部的变量提升为全局变量# 1.全局没有同名变量,直接提升局部变量为全局变量# 2.有同名全局变量,就是统一全局与局部的同名变量# -- 如果局部想改变全局变量的值(发生地址的变化),可以 ...
- python 基础之自动类型转换和强制类型转换
一:自动类型转换 自动类型转换注意针对Number数据类型来说的 当2个不同类型的数据进行运算的时候,默认向更高精度转换 数据类型精度从低到高:bool int float complex #关于bo ...