unity3d 百度语音_unity3d语音识别 - CSDN
  • 语音转文字 1.打开麦克风记录 _clipRecord = Microphone.Start(null, false, 30, 16000); 2.将Unity的AudioClip数据转化为PCM格式16bit数据 /// <summary> /// 将Unity的AudioClip数据转化为...

    转自洪流学堂
    语音转文字
    1.打开麦克风记录

    _clipRecord = Microphone.Start(null, false, 30, 16000);

    2.将Unity的AudioClip数据转化为PCM格式16bit数据

    /// <summary>
            /// 将Unity的AudioClip数据转化为PCM格式16bit数据
            /// </summary>
            /// <param name="clip"></param>
            /// <returns></returns>
            public static byte[] ConvertAudioClipToPCM16(AudioClip clip)
            {
                var samples = new float[clip.samples * clip.channels];
                clip.GetData(samples, 0);
                var samples_int16 = new short[samples.Length];
    
                for (var index = 0; index < samples.Length; index++)
                {
                    var f = samples[index];
                    samples_int16[index] = (short) (f * short.MaxValue);
                }
    
                var byteArray = new byte[samples_int16.Length * 2];
                Buffer.BlockCopy(samples_int16, 0, byteArray, 0, byteArray.Length);
    
                return byteArray;
            }

    3.将字节流上传到百度语音uri,得到转换后的文本

     public IEnumerator Recognize(byte[] data, Action<AsrResponse> callback)
            {
                yield return PreAction ();
    
                if (tokenFetchStatus == Base.TokenFetchStatus.Failed) {
                    Debug.LogError("Token fetched failed, please check your APIKey and SecretKey");
                    yield break;
                }
    
                var uri = string.Format("{0}?lan=zh&cuid={1}&token={2}", UrlAsr, SystemInfo.deviceUniqueIdentifier, Token);
    
                var form = new WWWForm();
                form.AddBinaryData("audio", data);
                var www = UnityWebRequest.Post(uri, form);
                www.SetRequestHeader("Content-Type", "audio/pcm;rate=16000");
                yield return www.SendWebRequest();
    
                if (string.IsNullOrEmpty(www.error))
                {
                    Debug.Log(www.downloadHandler.text);
                    callback(JsonUtility.FromJson<AsrResponse>(www.downloadHandler.text));
                }
                else
                    Debug.LogError(www.error);
            }

    文字转语音
    1.文本上传百度语音uri,得到字节流

     public IEnumerator Synthesis(string text, Action<TtsResponse> callback, int speed = 5, int pit = 5, int vol = 5,
                Pronouncer per = Pronouncer.Female)
            {
                yield return PreAction();
    
                if (tokenFetchStatus == Base.TokenFetchStatus.Failed)
                {
                    Debug.LogError("Token was fetched failed. Please check your APIKey and SecretKey");
                    callback(new TtsResponse()
                    {
                        err_no = -1,
                        err_msg = "Token was fetched failed. Please check your APIKey and SecretKey"
                    });
                    yield break;
                }
    
                var param = new Dictionary<string, string>();
                param.Add("tex", text);
                param.Add("tok", Token);
                param.Add("cuid", SystemInfo.deviceUniqueIdentifier);
                param.Add("ctp", "1");
                param.Add("lan", "zh");
                param.Add("spd", Mathf.Clamp(speed, 0, 9).ToString());
                param.Add("pit", Mathf.Clamp(pit, 0, 9).ToString());
                param.Add("vol", Mathf.Clamp(vol, 0, 15).ToString());
                param.Add("per", ((int) per).ToString());
    
                string url = UrlTts;
                int i = 0;
                foreach (var p in param)
                {
                    url += i != 0 ? "&" : "?";
                    url += p.Key + "=" + p.Value;
                    i++;
                }
    
    #if UNITY_STANDALONE || UNITY_EDITOR || UNITY_UWP
                var www = UnityWebRequest.Get(url);
    #else
                var www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG);
    #endif
                Debug.Log(www.url);
                yield return www.SendWebRequest();
    
    
                if (string.IsNullOrEmpty(www.error))
                {
                    var type = www.GetResponseHeader("Content-Type");
                    Debug.Log("response type: " + type);
    
                    if (type == "audio/mp3")
                    {
    #if UNITY_STANDALONE || UNITY_EDITOR || UNITY_UWP
                        var clip = GetAudioClipFromMP3ByteArray(www.downloadHandler.data);
                        var response = new TtsResponse {clip = clip};
    #else
                        var response = new TtsResponse {clip = DownloadHandlerAudioClip.GetContent(www) };
    #endif
                        callback(response);
                    }
                    else
                    {
                        Debug.LogError(www.downloadHandler.text);
                        callback(JsonUtility.FromJson<TtsResponse>(www.downloadHandler.text));
                    }
                }
                else
                    Debug.LogError(www.error);
            }

    2.字节流转化为AudioClip播放

    private AudioClip GetAudioClipFromMP3ByteArray(byte[] mp3Data)
            {
                var mp3MemoryStream = new MemoryStream(mp3Data);
                MP3Sharp.MP3Stream mp3Stream = new MP3Sharp.MP3Stream(mp3MemoryStream);
    
                //Get the converted stream data
                MemoryStream convertedAudioStream = new MemoryStream();
                byte[] buffer = new byte[2048];
                int bytesReturned = -1;
                int totalBytesReturned = 0;
    
                while (bytesReturned != 0)
                {
                    bytesReturned = mp3Stream.Read(buffer, 0, buffer.Length);
                    convertedAudioStream.Write(buffer, 0, bytesReturned);
                    totalBytesReturned += bytesReturned;
                }
    
                Debug.Log("MP3 file has " + mp3Stream.ChannelCount + " channels with a frequency of " +
                          mp3Stream.Frequency);
    
                byte[] convertedAudioData = convertedAudioStream.ToArray();
    
                //bug of mp3sharp that audio with 1 channel has right channel data, to skip them
                byte[] data = new byte[convertedAudioData.Length / 2];
                for (int i = 0; i < data.Length; i += 2)
                {
                    data[i] = convertedAudioData[2 * i];
                    data[i + 1] = convertedAudioData[2 * i + 1];
                }
    
                Wav wav = new Wav(data, mp3Stream.ChannelCount, mp3Stream.Frequency);
    
                AudioClip audioClip = AudioClip.Create("testSound", wav.SampleCount, 1, wav.Frequency, false);
                audioClip.SetData(wav.LeftChannel, 0);
    
                return audioClip;
            }
    展开全文
  • unity 使用百度语音进行语音识别

    千次阅读 2017-10-27 09:23:24
    新建脚本,将下列代码复制进去即可, using LitJson; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using UnityEngine;...public cla

    新建脚本,将下列代码复制进去即可,

    using LitJson;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using UnityEngine;
    using UnityEngine.UI;
    
    public class ToWord : MonoBehaviour {
        private string token= "";                           //access_token
        private string cuid = "11";        //用户标识
        private string format = "wav";                  //语音格式
        private int rate = 8000;                        //采样率
        private int channel = 1;                        //声道数
        private string speech;                          //语音数据,进行base64编码
        private int len;                                //原始语音长度
        private string lan = "zh";                      //语种
        private string grant_Type = "client_credentials";
        private string client_ID = "这里输入百度的appkey,自己到官网申请填入这里";  //百度appkey
        private string client_Secret = "这里输入百度secretkey,自己到官网申请填写";  //百度Secret Key
    
        private string baiduAPI = "http://vop.baidu.com/server_api";
        private string getTokenAPIPath = "https://openapi.baidu.com/oauth/2.0/token";
        private byte[] clipByte;
        /// <summary>
        /// 转换出来的TEXT
        /// </summary>
        public static string audioToString;
        public  AudioSource aud;
        private int audioLength;//录音的长度
    
        public delegate void CallBack(string name);
        public delegate string ds();
        private static ToWord _toWord;
    
        public MicroPhoneManager m;
    
        private void Awake()
        {
            _toWord = this;
            StartCoroutine(GetToken(getTokenAPIPath));
        }
        public static ToWord GetInstance() {
            return _toWord;
        }
        /// <summary>
        /// 获取百度用户令牌
        /// </summary>
        /// <param name="url">获取的url</param>
        /// <returns></returns>
        private IEnumerator GetToken(string url)
        {
            WWWForm getTForm = new WWWForm();
            getTForm.AddField("grant_type", grant_Type);
            getTForm.AddField("client_id", client_ID);
            getTForm.AddField("client_secret", client_Secret);
    
            WWW getTW = new WWW(url, getTForm);
            yield return getTW;
            if (getTW.isDone)
            {
                if (getTW.error == null)
                {
                    token = JsonMapper.ToObject(getTW.text)["access_token"].ToString();
                    Debug.Log("获取百度用户令牌 初始化完成");
                }
                else
                    Debug.Log("error:" + getTW.error);
            }
        }
    
        /// <summary>
        /// 开始录音
        /// </summary>
        public void StartMic(int durationTime)
        {
            if (Microphone.devices.Length == 0) return;
            Microphone.End(null);
            Debug.Log("Start");
            aud.clip = Microphone.Start(null, false, durationTime, rate);
        }
    
        /// <summary>
        /// 结束录音
        /// </summary>
        public void EndMic(CallBack cb,BtnInfo info)
        {
            int lastPos = Microphone.GetPosition(null);
            if (Microphone.IsRecording(null))
                audioLength = lastPos / rate;//录音时长  
            else
                audioLength = 10;
            Debug.Log("录音结束");
            Microphone.End(null);
    
            clipByte = GetClipData();
            len = clipByte.Length;
            speech = Convert.ToBase64String(clipByte);
    
            using (FileStream fs = CreateEmpty(Utils.GetAudioDataPath() + "/" + info.ID + "_1.wav"))
            {
                ConvertAndWrite(fs, aud.clip);
                WriteHeader(fs, aud.clip);
                Debug.Log("保存成功");
            }
            StartCoroutine(GetAudioString(baiduAPI, cb));
        }
    
        void aaa(string str) { }
    
        private void WriteHeader(FileStream stream, AudioClip clip)
        {
            int hz = clip.frequency;
            int channels = clip.channels;
            int samples = clip.samples;
    
            stream.Seek(0, SeekOrigin.Begin);
    
            Byte[] riff = System.Text.Encoding.UTF8.GetBytes("RIFF");
            stream.Write(riff, 0, 4);
    
            Byte[] chunkSize = BitConverter.GetBytes(stream.Length - 8);
            stream.Write(chunkSize, 0, 4);
    
            Byte[] wave = System.Text.Encoding.UTF8.GetBytes("WAVE");
            stream.Write(wave, 0, 4);
    
            Byte[] fmt = System.Text.Encoding.UTF8.GetBytes("fmt ");
            stream.Write(fmt, 0, 4);
    
            Byte[] subChunk1 = BitConverter.GetBytes(16);
            stream.Write(subChunk1, 0, 4);
    
            UInt16 two = 2;
            UInt16 one = 1;
    
            Byte[] audioFormat = BitConverter.GetBytes(one);
            stream.Write(audioFormat, 0, 2);
    
            Byte[] numChannels = BitConverter.GetBytes(channels);
            stream.Write(numChannels, 0, 2);
    
            Byte[] sampleRate = BitConverter.GetBytes(hz);
            stream.Write(sampleRate, 0, 4);
    
            Byte[] byteRate = BitConverter.GetBytes(hz * channels * 2); // sampleRate * bytesPerSample*number of channels, here 44100*2*2  
            stream.Write(byteRate, 0, 4);
    
            UInt16 blockAlign = (ushort)(channels * 2);
            stream.Write(BitConverter.GetBytes(blockAlign), 0, 2);
    
            UInt16 bps = 16;
            Byte[] bitsPerSample = BitConverter.GetBytes(bps);
            stream.Write(bitsPerSample, 0, 2);
    
            Byte[] datastring = System.Text.Encoding.UTF8.GetBytes("data");
            stream.Write(datastring, 0, 4);
    
            Byte[] subChunk2 = BitConverter.GetBytes(samples * channels * 2);
            stream.Write(subChunk2, 0, 4);
    
        }
        private FileStream CreateEmpty(string filepath)
        {
            FileStream fileStream = new FileStream(filepath, FileMode.Create);
            byte emptyByte = new byte();
    
            for (int i = 0; i < 44; i++) //preparing the header  
            {
                fileStream.WriteByte(emptyByte);
            }
    
            return fileStream;
        }
        private void ConvertAndWrite(FileStream fileStream, AudioClip clip)
        {
            float[] samples = new float[clip.samples];
    
            //float[] samples = new float[(int)CurAudioSource.time + 1];
    
            clip.GetData(samples, 0);
    
            Int16[] intData = new Int16[samples.Length];
    
            Byte[] bytesData = new Byte[samples.Length * 2];
    
            int rescaleFactor = 32767; //to convert float to Int16  
    
            for (int i = 0; i < samples.Length; i++)
            {
                intData[i] = (short)(samples[i] * rescaleFactor);
                Byte[] byteArr = new Byte[2];
                byteArr = BitConverter.GetBytes(intData[i]);
                byteArr.CopyTo(bytesData, i * 2);
            }
            fileStream.Write(bytesData, 0, bytesData.Length);
        }
        /// <summary>
        /// 把语音转换为文字
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        private IEnumerator GetAudioString(string url, CallBack cb)
        {
            JsonWriter jw = new JsonWriter();
            jw.WriteObjectStart();
            jw.WritePropertyName("format");
            jw.Write(format);
            jw.WritePropertyName("rate");
            jw.Write(rate);
            jw.WritePropertyName("channel");
            jw.Write(channel);
            jw.WritePropertyName("token");
            jw.Write(token);
            jw.WritePropertyName("cuid");
            jw.Write(cuid);
            jw.WritePropertyName("len");
            jw.Write(len);
            jw.WritePropertyName("speech");
            jw.Write(speech);
            jw.WriteObjectEnd();
            WWWForm w = new WWWForm();
    
    
            WWW getASW = new WWW(url, Encoding.Default.GetBytes(jw.ToString()));
            yield return getASW;
            if (getASW.isDone)
            {
                if (getASW.error == null)
                {
                    JsonData getASWJson = JsonMapper.ToObject(getASW.text);
                    if (getASWJson["err_msg"].ToString() == "success.")
                    {
                        audioToString = getASWJson["result"][0].ToString();
                        if (audioToString.Substring(audioToString.Length - 1) == ",")
                            audioToString = audioToString.Substring(0, audioToString.Length - 1);                               
                    }
                }
                else
                {
                    //Debug.LogError(getASW.error);
                    audioToString = "";
                    Debug.Log("error:" + getASW.error);
                }
                Debug.Log("此次语音文字为:" + audioToString);
                if (cb != null)
                {
                    cb(audioToString);
                }
            }
        }
    
        /// <summary>
        /// 把录音转换为Byte[]
        /// </summary>
        /// <returns></returns>
        public byte[] GetClipData()
        {
            if (aud.clip == null)
            {
                //Debug.LogError("录音数据为空");
                Debug.Log("录音数据为空");
                return null;
            }
    
            float[] samples = new float[aud.clip.samples];
    
            aud.clip.GetData(samples, 0);
    
    
    
            byte[] outData = new byte[samples.Length * 2];
    
            int rescaleFactor = 32767; //to convert float to Int16   
    
            for (int i = 0; i < samples.Length; i++)
            {
                short temshort = (short)(samples[i] * rescaleFactor);
    
                byte[] temdata = System.BitConverter.GetBytes(temshort);
    
                outData[i * 2] = temdata[0];
                outData[i * 2 + 1] = temdata[1];
            }
            if (outData == null || outData.Length <= 0)
            {
                //Debug.LogError("录音数据为空");
                Debug.Log("录音数据为空");
                return null;
            }
    
            //return SubByte(outData, 0, audioLength * 8000 * 2);
            return outData;
        }
        void Start () {
    
        }
    
        private void OnGUI()
        {
            if (GUILayout.Button("Start"))
                StartMic();
    
            if (GUILayout.Button("End"))
                EndMic(null);
    
        }
        public Text debugText;
        private void Update()
        {
            debugText.text = audioToString;
        }
    }

    百度语音是通过http请求的方式来进行识别的,最大的有点是全平台通用,不过识别率没有讯飞的高

    展开全文
  • 基于百度语音Unity语音识别系统

    千次阅读 2018-06-13 13:15:30
    实现U3D VR场景中的语音识别为什么选用百度语音?因为他免费啊那问题就是如何使用百度语音我们首先先需要进入百度语音的官网http://yuyin.baidu.com/然后申请选择创建应用,这个填写无需多言。只需要知道这样就算...

    实现U3D VR场景中的语音识别

    为什么选用百度语音?因为他免费啊


    那问题就是如何使用百度语音

    我们首先先需要进入百度语音的官网http://yuyin.baidu.com/

    然后申请


    选择创建应用,这个填写无需多言。只需要知道这样就算申请完了,还是非常方便的。

    而申请得到的东西主要是两串号码appkey和secretkey。



    这样就可以调用百度语音了。设置响应声音按钮或者操作

    这些就仁者见仁智者见智了



    百度云的产品服务覆盖面还是非常广的,语音识别的sdk基本覆盖了热门语言,如果在别的平台或者用处需要的话下载对应的sdk也ok。

    展开全文
  • Unity3d百度语音识别项目 基于百度语音识别API,C#语言可用,项目较为简单
  • unity 百度语音识别

    2019-02-15 10:47:12
    调用百度接口进行识别:Asr.cs using System; using System.Collections; using UnityEngine; using UnityEngine.Networking; namespace Wit.BaiduAip.Speech {  [Serializable]  public class AsrResponse  { ...

     

    调用百度接口进行识别:Asr.cs

    using System;
    using System.Collections;
    using UnityEngine;
    using UnityEngine.Networking;

    namespace Wit.BaiduAip.Speech
    {
        [Serializable]
        public class AsrResponse
        {
            public int err_no;
            public string err_msg;
            public string sn;
            public string[] result;
        }

        public class Asr : Base
        {
            private const string UrlAsr = "https://vop.baidu.com/server_api";

            public Asr(string apiKey, string secretKey) : base(apiKey, secretKey)
            {
            }

            public IEnumerator Recognize(byte[] data, Action<AsrResponse> callback)
            {
                yield return PreAction ();

                if (tokenFetchStatus == Base.TokenFetchStatus.Failed) {
                    Debug.LogError("Token fetched failed, please check your APIKey and SecretKey");
                    yield break;
                }

                var uri = string.Format("{0}?lan=zh&cuid={1}&token={2}", UrlAsr, SystemInfo.deviceUniqueIdentifier, Token);

                var form = new WWWForm();
                form.AddBinaryData("audio", data);
                var www = UnityWebRequest.Post(uri, form);
                www.SetRequestHeader("Content-Type", "audio/pcm;rate=16000");
                yield return www.SendWebRequest();

                if (string.IsNullOrEmpty(www.error))
                {
                    Debug.Log(www.downloadHandler.text);
                    callback(JsonUtility.FromJson<AsrResponse>(www.downloadHandler.text));
                }
                else
                    Debug.LogError(www.error);
            }

            /// <summary>
            /// 将Unity的AudioClip数据转化为PCM格式16bit数据
            /// </summary>
            /// <param name="clip"></param>
            /// <returns></returns>
            public static byte[] ConvertAudioClipToPCM16(AudioClip clip)
            {
                var samples = new float[clip.samples * clip.channels];
                clip.GetData(samples, 0);
                var samples_int16 = new short[samples.Length];

                for (var index = 0; index < samples.Length; index++)
                {
                    var f = samples[index];
                    samples_int16[index] = (short) (f * short.MaxValue);
                }

                var byteArray = new byte[samples_int16.Length * 2];
                Buffer.BlockCopy(samples_int16, 0, byteArray, 0, byteArray.Length);

                return byteArray;
            }
        }
    }

    调用识别:Demo.cs

    using UnityEngine;
    using UnityEngine.UI;
    using Wit.BaiduAip.Speech;

    public class Demo : MonoBehaviour
    {
        public string APIKey = "ncgm6GHsVUvAc8ylz0ZDeELq";
        public string SecretKey = "Znd0gLLufN5L4kydBhaUGgUSuiGijQjM";
        public Button StartButton;
        public Button StopButton;
        public Text DescriptionText;

        public AudioClip _clipRecord;
        private Asr _asr;

        void Start()
        {
            _asr = new Asr(APIKey, SecretKey);
            StartCoroutine(_asr.GetAccessToken());
            
            DescriptionText.text = "";

            StartButton.onClick.AddListener(OnClickStartButton);
            StopButton.onClick.AddListener(OnClickStopButton);
        }

        private void OnClickStartButton()
        {
            DescriptionText.text = "Listening...";

            _clipRecord = Microphone.Start(null, false, 30, 16000);
        }

        private void OnClickStopButton()
        {
            DescriptionText.text = "Recognizing...";
            Microphone.End(null);
            gameObject.GetComponentInChildren<AudioSource>().clip = _clipRecord;
            gameObject.GetComponentInChildren<AudioSource>().Play();
            Debug.Log("end record");
            var data = Asr.ConvertAudioClipToPCM16(_clipRecord);
            StartCoroutine(_asr.Recognize(data, s =>
            {
                DescriptionText.text = s.result != null && s.result.Length > 0 ? s.result[0] : "未识别到声音";

                StartButton.gameObject.SetActive(true);
            }));
        }
    }

     

    用户解析token的json数据:Base.cs

    using System;
    using System.Collections;
    using UnityEngine;
    using UnityEngine.Networking;

    namespace Wit.BaiduAip.Speech
    {
        /// <summary>
        /// 用户解析token的json数据
        /// </summary>
        [Serializable]
        class TokenResponse
        {
            public string access_token = null;
        }

        public class Base
        {
            protected enum TokenFetchStatus
            {
                NotFetched,
                Fetching,
                Success,
                Failed
            }

            public string SecretKey { get; private set; }

            public string APIKey { get; private set; }

            public string Token { get; private set; }

            protected TokenFetchStatus tokenFetchStatus = TokenFetchStatus.NotFetched;

            public Base (string apiKey, string secretKey)
            {
                APIKey = apiKey;
                SecretKey = secretKey;
            }

            public IEnumerator GetAccessToken ()
            {
                Debug.Log ("Start fetching token...");
                tokenFetchStatus = TokenFetchStatus.Fetching;

                var uri =
                    string.Format (
                        "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id={0}&client_secret={1}",
                        APIKey, SecretKey);
                var www = UnityWebRequest.Get(uri);
                yield return www.SendWebRequest();

                if (string.IsNullOrEmpty (www.error)) {
                    Debug.Log(www.downloadHandler.text);
                    var result = JsonUtility.FromJson<TokenResponse> (www.downloadHandler.text);
                    Token = result.access_token;
                    Debug.Log ("Token has been fetched successfully");
                    tokenFetchStatus = TokenFetchStatus.Success;
                } else {
                    Debug.LogError (www.error);
                    Debug.LogError("Token was fetched failed. Please check your APIKey and SecretKey");
                    tokenFetchStatus = TokenFetchStatus.Failed;
                }
            }

            protected IEnumerator PreAction ()
            {
                if (tokenFetchStatus == TokenFetchStatus.NotFetched) {
                    Debug.Log ("Token has not been fetched, now fetching...");
                    yield return GetAccessToken ();
                }

                if (tokenFetchStatus == TokenFetchStatus.Fetching)
                    Debug.Log ("Token is still being fetched, waiting...");

                while (tokenFetchStatus == TokenFetchStatus.Fetching) {
                    yield return null;
                }
            }
        }
    }

    展开全文
  • unity3d百度在线语音转文字,文字转语音。可以跨平台运行。https://blog.csdn.net/luoyikun/article/details/81212838
  • 之前有过需求要是语音识别,而百度也提供了对应的.dll文件,后来用了一下在识别的时候占用了主线程,会卡顿,又看了看大佬的解决方案,自己也总结了一下。 总共分为四大部:1获取Token、2开始录音、3录音结束、4上传...
  • BaiduVoiceTestUnity3d使用百度的Rest Api实现语音交互,可以将语音转化为文本,也...该平台上由于编译环境的问题接入SDK会出现种种问题,所以只能使用百度语音的RestApi来实现。 使用RestApi就可以不受平台的限制了。
  • using NAudio.Wave; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Text; using UnityEngine;...public class AsrR...
  • using (Stream stream = response.GetResponseStream()) { buffer2 = new byte[stream.Length]; stream.Read(buffer2, 0, buffer2.Length); }stream.Length失败解决方案 1、用unity自带...
  • 通过unity3d与android的交互,对百度语音识别官方的android SDK封装成为可在unity3d上使用的一个插件
  • 百度语音识别的Unity插件,包括语音转文字以及文字转语音,识别度比较高。
  • 本插件是针对百度语音Unity编辑器接入的Demo,可以实现免费版本的百度语音识别API接入,仅供学习交流,免费版的确实没有收费版本的强大,如果正式使用还是使用商用的比较好。
  • Unity3d中使用百度语音识别及语音合成【含源码】

    千次阅读 热门讨论 2020-03-05 23:38:58
    本文首发于“洪流学堂”公众号。 洪流学堂,让你快人几步 源码地址 ...AudioClip的音频数据转换为百度语音识别的PCM16格式 百度语音识别Restful接口的封装以及一个测试场景 ...百度语音合成Restf...
  • 基于Unity3D语音转文字功能的实现

    千次阅读 2017-12-16 23:36:51
    Unity文字转语音功能的实现(注意:只适应与Windows操作系统)
  • 百度AI开放平台是百度推出的一个人工智能服务平台,该平台提供了很多当下热门技术的解决方案,如人脸识别,语音识别,语音智能等。其中人脸识别的SDK支持很多语言,包括Java,PHP,Python,C#,Node.js,Android和...
  • Unity Baidu语音识别+图灵聊天机器人+baidu语音合成 1、在Unity中整合百度识别,图灵聊天机器人,百度语音合成 2、三个独立的,可以根据需要整合成一个语音聊天机器人
  • unity3d使用调用win10语音识别
  • 由于是第三方插件,并且项目中已经有了一个第三方的插件,众所周知,Unity与安卓交互时,安卓端只能有一个Activity继承自UnityPlayerActivity,所以为了不与其他人的sdk冲突,我们便使用不继承UnityPlayerActivity的...
1 2 3 4 5 ... 17
收藏数 335
精华内容 134
关键字:

unity3d 百度语音