资源简介
百度语音合成,并播放!

代码片段和文件信息
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个文件信息
相关资源
- PID_AutoTune_v0.rar
- XE7UP1Kg13_Unis.exe
- Uninstall_Cortana_WINCLIENT.CN.rar
- VisualStudioUninstaller vs卸载工具
- UNIX/LINUX编程实践教程的源码
- DXperienceUniversal 10.1.6(2010年8月13日版
- 使用 SoundPool 同时播放多个音频
- UNICODE GBK双向码表二进制文件
- ubuntu9.10 可加载内核模块和字符设备驱
- Unity3D登录界面工程
- 常用编码(UnicodeUTF-8GBK)转换工具
- unity3d反编译工具
- Junit4单元测试
- 中文转化unicoder码的方法
- 经典的Viterbi算法
- UnObSiDium.rar
- Ubuntu安装时磁盘分区图文教程
- Fundamentals of Data Structure in C
- 302 Found
- Furan-BDOPV Donor-Acceptor Polymers with Plana
-
UnityWebPla
yer及UnityWebPla yerFull -
UnityWebPla
yerFull - Effects of the cultured Cordyceps exopolysacch
- In vitro screening of lactobacilli with antago
- Effect of dietary nitrate dosage on gas produc
- 通过大型强子对撞机逐光散射的小曲
- SunnyUI.Net
- 小程序反编译文件wxappUnpacker.rar
- HslCommunication 7.0.1 免费版本 免费使用
-
Macromedia Flash MX Actionsc
ript for Fun an
评论
共有 条评论