Coder Social home page Coder Social logo

zhaozhenshun / flutter_baidu_speech_plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soragui/flutter_baidu_speech_plugin

0.0 1.0 0.0 8.61 MB

Flutter baidu speech recognition plugin for ios and android

Home Page: https://soragui.com/flutter_baidu_speech_plugin/

License: GNU Lesser General Public License v3.0

Ruby 4.45% C++ 5.54% Objective-C 53.40% Java 12.55% Dart 13.11% Objective-C++ 10.95%

flutter_baidu_speech_plugin's Introduction

Flutter Baidu Speech Recognition Plugin

pub

A speech recognition plugin for flutter using BaiduSDK.See the changelog for more information about the function.

Getting Started

Add this to your package's pubspec.yaml file:

dependencies:
    baidu_speech_recognition: 0.1.4

Basic Usage

import 'package:baidu_speech_recognition/baidu_speech_recognition.dart';

BaiduSpeechRecognition _speechRecognition = BaiduSpeechRecognition();

// initialize 
_speechRecognition.init().then((value) => print(value));
 
// start long speech recognition 
 _speechRecognition.startLongSpeech().then((value) => print(value)); 

 // start speech recognition 60s long
 _speechRecognition.start().then((value) => print(value));  

// cancel recognition 
 _speechRecognition.cancel().then((value) => print(value));
  

The Callback Listener

You can add a listener :

_speechRecognitoin.speechRecognitionEvents
      .listen((String value) {
        // TODO do somethig with the value
      }

The return value is a JSON String :

{
  "type": "The recognition result type",
  "value": "The result"
}

the type have the following value:

type desc
ready ready to speaking...
start detect start speaking...
stop stop speaking. and return the last result
cancel cancel the last recognition
finish return the last recognition
lfinish long speech return
end end speaking...
meter return volume meter level

For iOS developer

Go to 百度ASR download SDK for iOS,then copy BDSClientLib and BDSClientResource to the same directory of you flutter project,the file structure like this:

----------------
  |
  |--Your FLutter Projcet/
  |
  |--BDSClientLib/
  |
  |--BDSCLientResource/

Then open your iOS projcet on Xcode and add the baidu speech SDK library and some resource.

Add BDSClientLib/libBaiduSpeechSDK.a to you project group as "create groups",

Add BDSClientResource/ASR/BDSClientResources to your project group as "create folder references",

Add BDSClientResource/ASR/BDSClientEASRResources to your project group as "create groups".

Add the following framework to your project:

Framework Desc
libc++.tbd For c/c++ func support
libz.1.2.5.tbd For gzip support
libsqlite3.0.tbd For sqlite support
libiconv.2.4.0.tbd Some utility

Finally add Microphone Usage privacy to your info.plist file.

Project Setting

Open you project with xcode and go to Pods, select the baidu_speech_recognition TARGETS, then select the Build Settings Tab, Change Mach-O Type to Static Library.Then go to the Build Phases, make sure all the Headers are Public.

If you have any problem or Error Please make a issue.

For Android developer

First become a baidu Developer

The Follow the guide to add some permission and file you need

flutter_baidu_speech_plugin's People

Contributors

soragui avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.