zoukankan      html  css  js  c++  java
  • 讯飞语音识别的录音文件wav存储

    void start(){
    //在小米5的手机上直接向getExternalStorageDirectory写文件会出现文件管理器找不文件的情况,
    这时候就要提前生成这个文件夹,防止存储wav文件失败。

    mkdir();   String path
    = Environment.getExternalStorageDirectory().getAbsolutePath() + "/0/" + wavFileCount + ".wav";   mIat.setParameter(SpeechConstant.ASR_AUDIO_PATH, path);   //开始识别,并设置监听器   mIat.startListening(mRecognizerListener); } private void mkdir() { try {   String rootPath = Environment.getExternalStorageDirectory().getAbsolutePath();   File dirFile = new File(rootPath);   if (!dirFile.exists()) {     dirFile.mkdir();   }   String dir0Path = rootPath + "/0/";   File dir = new File(dir0Path);   if (!dir.exists()) {     dir.mkdir();   } // String wavPath = rootPath + "/0/test.wav"; // File file = new File(wavPath); // if (!file.exists()) { // FileOutputStream fos = new FileOutputStream(wavPath); // fos.write("123".getBytes()); // fos.flush(); // fos.close(); // }   } catch (Exception e) {     e.printStackTrace();   } }
  • 相关阅读:
    2017年度最具商业价值人工智能公司TOP50 榜单发布
    滑动swipe的妙用
    UE3优化
    UE4 框架
    制作HUD
    Component概念
    手游记事
    C++与UnrealScript脚本交互
    unreal Script(US)一些注意事项
    UDK游戏打包详解
  • 原文地址:https://www.cnblogs.com/Oldz/p/13355803.html
Copyright © 2011-2022 走看看