分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
Note:这种方法只用于学习,没有任何实际意义。
如果需要实现录音,可以使用原生的接口,Android就去找Android,IOS就去找IOS。最方便的方式是接入语音SDK,比如百度语音SDK。
目标实现录音功能、保存为wav、播放、保存为int16[]发送网络数据流、接收Int16[]播放数据流
MicroPhoneInput类
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using UnityEngine;using System.Collections;[RequireComponent (typeof(AudioSource))]public class MicroPhoneInput : MonoBehaviour { private static MicroPhoneInput m_instance; public float sensitivity=100; public float loudness=0; private static string[] micArray=null; const int HEADER_SIZE = 44; const int RECORD_TIME = 10; // Use this for initialization void Start () { } public static MicroPhoneInput getInstance() { if (m_instance == null) { micArray = Microphone.devices; if (micArray.Length == 0) { Debug.LogError ("Microphone.devices is null"); } foreach (