资源简介
百度语音合成,并播放!
代码片段和文件信息
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Text;
public class aduio : MonoBehaviour {
private const string lan = “zh“;
private const string per = “0“;
private const string ctp = “1“;
private const string spd = “3“;
private const string pit = “6“;
private const string vol = “9“;
private const string cuid = “00-12-7B-16-74-8D“;
private const string tex = “现在大家都在看人民的名义!我也追剧“;
private const string tok = “24.f82fcc0eeca4dcfad825253d0f1fceb4.2592000.1494907265.282335-9411061“;
private const string rest = “tex={0}&lan={1}&per={2}&ctp={3}&cuid={4}&tok={5}&spd={6}&pit={7}&vol={8}“;
private const int NULL = 0 ERROR_SUCCESS = NULL;
[System.Runtime.InteropServices.DllImport(“WinMm.dll“ CharSet = System.Runtime.InteropServices.CharSet.Auto CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
private static extern int mciSendString(string lpstrCommand string lpstrReturnString int uReturnLength int hwndCallback);
public void creatMp3(string strFilename)
{
string strUpdateData = string.Format(rest tex lan per ctp cuid tok spd pit vol);
HttpWebRequest req = WebRequest.Create(“http://tsn.baidu.com/text2audio“) as HttpWebRequest;
req.Method = “POST“;
req.ContentType = “application/x-www-form-urlencoded“;
req.ContentLength = Encoding.UTF8.GetByteCount(strUpdateData);
using (StreamWriter sw = new StreamWriter(req.GetRequestStream()))
sw.Write(strUpdateData);
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
//直到request.GetResponse()程序才开始向目标网页发送Post请求
Stream responseStream = res.GetResponseStream();
//创建本地文件写入流
Stream stream = new FileStream(Application.streamingAssetsPath + “//Ogg//“+ strFilename + “.mp3“ FileMode.Create);
byte[] bArr = new byte[1024];
int size = responseStream.Read(bArr 0 (int)bArr.Length);
while (size > 0)
{
stream.Write(bArr 0 size);
size = responseStream.Read(bArr 0 (int)bArr.Length);
}
stream.Close();
responseStream.Close();
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 47616 2017-04-19 12:19 PlayMp3\PlayMp3\.vs\PlayMp3\v15\.suo
文件 5461 2017-04-19 11:59 PlayMp3\PlayMp3\Assembly-CSharp.csproj
文件 471040 2015-03-06 03:56 PlayMp3\PlayMp3\Assets\Plugins\NAudio.dll
..A..H. 486 2017-04-19 11:59 PlayMp3\PlayMp3\Assets\Plugins\NAudio.dll.me
..A..H. 191 2017-04-19 11:57 PlayMp3\PlayMp3\Assets\Plugins.me
文件 15980 2017-04-19 10:21 PlayMp3\PlayMp3\Assets\Scenes\main.unity
..A..H. 174 2017-04-19 10:21 PlayMp3\PlayMp3\Assets\Scenes\main.unity.me
..A..H. 191 2017-04-19 10:21 PlayMp3\PlayMp3\Assets\Scenes.me
文件 2447 2017-04-19 12:19 PlayMp3\PlayMp3\Assets\sc
..A..H. 262 2017-04-19 11:28 PlayMp3\PlayMp3\Assets\sc
文件 1343 2017-04-19 12:20 PlayMp3\PlayMp3\Assets\sc
..A..H. 262 2017-04-19 10:02 PlayMp3\PlayMp3\Assets\sc
..A..H. 191 2017-04-19 10:01 PlayMp3\PlayMp3\Assets\sc
文件 460044 2017-04-19 10:24 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\10.wav
..A..H. 174 2017-04-19 10:24 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\10.wav.me
文件 37872 2017-04-19 11:38 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\2.ogg
..A..H. 174 2017-04-19 11:38 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\2.ogg.me
文件 37872 2017-04-19 11:35 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\2.wav
..A..H. 174 2017-04-19 11:34 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\2.wav.me
文件 37872 2017-04-19 12:07 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\3.mp3
..A..H. 174 2017-04-19 12:05 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\3.mp3.me
文件 605998 2017-04-19 12:10 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\3.wav
..A..H. 174 2017-04-19 12:11 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\3.wav.me
文件 37872 2017-04-19 12:13 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\4.mp3
..A..H. 174 2017-04-19 12:16 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\4.mp3.me
文件 605998 2017-04-19 12:13 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\4.wav
..A..H. 174 2017-04-19 12:16 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\4.wav.me
文件 11160 2017-04-19 10:24 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\Alarm_Rooster_02.ogg
..A..H. 174 2017-04-19 10:24 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\Alarm_Rooster_02.ogg.me
文件 10800 2017-04-19 12:19 PlayMp3\PlayMp3\Assets\StreamingAssets\Ogg\b2cb01e6-4b5e-4f73-894b-91b6c7240be7.mp3
............此处省略1140个文件信息
相关资源
- unity案例入门坦克大战源码
- Unigui 1.50.0.1481(含keygen)
- NVIDIA-linux-x86_64-384.98.run
- Graph And Chart 1.91.unitypackage
- Animated Steel Coaster 1.51.rar
- Nonexistence of formal first integrals for non
- AV Foundation 开发秘籍 英文版 Learning
- opencv3.0交叉编译用parallel.cpp
- 精通Unreal游戏引擎
- Unity3D游戏开发.pdf 宣雨松著完整高清
- 国际标准超大字符集字体支持包Unif
- Unity3D版水果忍者
- unity3d爆炸特效包
- unity3d_见缝插针源码及报告.zip
- Unity3d车库场景模型
- 空气动力学资料合集.Anderson.Fundament
- ubuntu linux 指南 基础篇+管理篇
- Sunburst Design_Clifford_E._Cummings经典论文
- 翁金辂教程经典名作Planar Antennas for
- unity3d 警察动画模型
- unity20多种烟雾以及爆炸特效
- 深入理解LINUX网络技术内幕 英文版
- unity博物馆.zip
- burpsuite_community社区版x86系统
- unity3D 新手引导遮罩,支持圆形和矩形
- 兼容unity的System.Drawing.dll
- nc源码含unix、windows版本
- FLAC3D隧道开挖模型
- NCTUns 6.0安装包及其说明(三)
- unity3d枪支武器包FPS第一人称射击游戏
评论
共有 条评论