csharp: 百度语音合成
public string API_id = "3333"; //你的ID
public string API_record = null;
public string API_record_format = null;
public string API_record_HZ = null;
public string API_key = "geovindu"; //你的KEY
public string API_secret_key = "geovindu"; //你的SECRRET_KEY
public string API_language = null;
public string API_access_token = null;
public string strJSON = "";
private const string tex = "远去的山河沉寂,恋过的风景如昔." +
"苍何斩落了情迷,生死轻付了别离." +
"捣一脉相思成泥,沐四海悲风无迹." +
"往生海烟波又起,妙华镜风雪共历."; /// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{ }
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button1_Click(object sender, EventArgs e)
{
API_access_token = getStrAccess(API_key, API_secret_key);
Guid cid = new Guid();
Response.Redirect("http://tsn.baidu.com/text2audio?tex=" + tex + "&lan=zh&cuid=" + cid.ToString() + "&ctp=1&tok=" + API_access_token); }
/// <summary>
///
/// </summary>
/// <param name="para_API_key">你的KEY</param>
/// <param name="para_API_secret_key">你的SECRRET_KEY</param>
/// <returns></returns>
public string getStrAccess(string para_API_key, string para_API_secret_key)
{ //方法参数说明:
//para_API_key:API_key(你的KEY)
//para_API_secret_key(你的SECRRET_KEY)
//方法返回值说明:
//百度认证口令码,access_token
string access_html = null;
string access_token = null;
string getAccessUrl = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials" + "&client_id=" + para_API_key + "&client_secret=" + para_API_secret_key;
try
{
HttpWebRequest getAccessRequest = WebRequest.Create(getAccessUrl) as HttpWebRequest;
//getAccessRequest.Proxy = null;
getAccessRequest.ContentType = "multipart/form-data";
getAccessRequest.Accept = "*/*";
getAccessRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)";
getAccessRequest.Timeout = 30000;//30秒连接不成功就中断
getAccessRequest.Method = "post";
HttpWebResponse response = getAccessRequest.GetResponse() as HttpWebResponse;
using (StreamReader strHttpComback = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
access_html = strHttpComback.ReadToEnd();
}
}
catch (WebException ex)
{
Response.Write(ex.ToString());
} JObject jo = JObject.Parse(access_html);
access_token = jo["access_token"].ToString();//得到返回的toke
return access_token;
}
程序还未完善。
注:有效符号多或特殊符号的,无法读文章,百度有字数限制。可能要特珠服务需要购买。
网址DEMO:http://www.dusystem.com/news/show-184.html
API请求方式基本说明
http://yuyin.baidu.com/docs/tts/136
语音合成接口支持 POST 和 GET两种方式
正式地址:http://tsn.baidu.com/text2audio
csharp: 百度语音合成的更多相关文章
- C# 百度语音合成
		
语音合成及TTS,我们尝试使用百度的语音合成技术 不过我发现 有一种缺点在于没有离线包让我有些很不舒服,可能是在线版的 原因微软语音识别技术在Windows 2000是默认集成在系统组件中 或许我们不 ...
 - 百度语音合成AI
		
注意:不要使用Dw编辑PHP代码,会因为编码问题出错!!<?php require_once 'AipSpeech.php'; // 你的 APPID AK SK const APP_ID = ...
 - flask 第六章 人工智能 百度语音合成 识别 NLP自然语言处理+simnet短文本相似度 图灵机器人
		
百度智能云文档链接 : https://cloud.baidu.com/doc/SPEECH/index.html 1.百度语音合成 概念: 顾名思义,就是将你输入的文字合成语音,例如: from a ...
 - Android 开发 框架系列 百度语音合成
		
官方文档:http://ai.baidu.com/docs#/TTS-Android-SDK/6d5d6899 官方百度语音合成控制台:https://cloud.baidu.com/product/ ...
 - 树莓派3b安装Nginx和php7和百度语音合成模块
		
1.安装sox系统mp3音频播放模块(项目需要) sudo apt-get install lame sudo apt-get install sox sudo apt-get install lib ...
 - Android 百度语音合成集成
		
一.环境配置: 下载资料:http://ai.baidu.com/sdk 官方视频讲解:http://ai.baidu.com/support/video 接入指南:http://ai.baidu.c ...
 - 百度语音合成api/sdk及demo
		
1.流程 1)换取token 用Api Key 和 SecretKey.访问https://openapi.baidu.com/oauth/2.0/token 换取 token // appKey = ...
 - Python实战---制作专属有声小说(调用百度语音合成接口)
		
这一次的目标是使用百度云的人工智能接口,实现文字转语音的实时转换,将小说文字转换成语音朗读出来. 百度云接口调用 百度的这个接口对于我们普通用户非常友好,他的很多功能都是免费的,而且我们每天可以免费调 ...
 - 文本转音频(百度语音合成api)(python)(原创)
		
应之前的一家小学教育培训机构的要求设计的一款 将文字转音频的程序.(注:后面应该是生成音频才对,没有改过来) 技术难点: ①语音合成,如果没有现在这么多的云服务-百度云语音合成,我估计这个程序会费很大 ...
 
随机推荐
- 支持取消操作和暂停操作的Backgroundworker
			
这也是今天讨论的话题.取消是默认就支持的,而暂停则默认不支持.但通过ManualResetEvent可以对其进行干预. using System; using System.Collections.G ...
 - [GraphQL] Use GraphQL's Object Type for Basic Types
			
We can create the most basic components of our GraphQL Schema using GraphQL's Object Types. These ty ...
 - URL 学习总结
			
1.绝对路径(以"/"斜线开头的路径,代表相对于当前Web应用): a)地址给服务器用,web应用名称可以省略. 请求包含:request.getRequestDispatcher ...
 - 兼容IE与firefox的css 线性渐变(linear-gradient)
			
IE系列 filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FF0000',endColorStr='#F9F900 ...
 - LeetCode:5_Longest Palindromic Substring | 最长的回文子串 | Medium
			
题目: Given a , and there exists one unique longest palindromic substring. 解题思路:1.简单思路:暴力破解法,时间复杂度O(n^ ...
 - RTImageAssets 自动生成 AppIcon 和 @2x @1x 比例图片
			
下载地址:https://github.com/rickytan/RTImageAssets 此插件用来生成 @3x 的图片资源对应的 @2x 和 @1x 版本,只要拖拽高清图到 @3x 的位置上,然 ...
 - VMware的使用
			
1.问题的提出 现在所有的组装台式机,均以64位操作系统作为平台 而且USB接口均以USB3.0默认 windows7 64位和windows 10 64位是主流 那么建立在windo ...
 - QPaintDevice: Cannot destroy paint device that is being painted
			
在paintEvent中,使用QPainter * 绘制图像出现此问题.解决: 1.改为不使用QPainter指针. 2.添上begin(), end() QPainter * painter = n ...
 - 转:Transform Web.Config when Deploying a Web Application Project
			
Introduction One of the really cool features that are integrated with Visual Studio 2010 is Web.Conf ...
 - ionic 通过下载apk升级App
			
上篇通过更新文件升级APP,如果遇到了比如更新插件之类的问题,上篇是无法解决的,所以为了解决这个问题,需要下载apk文件升级APP. 1.配置文件如下:{'appVersion':'1.0.0', ...