background preloader

Audio Processing

Facebook Twitter

Android; How to implement voice recognition, a nice easy tutorial… I’ve spent the past few months working on an android application that involves an element of OCR capability, its been quite a painful journey so this is my attempt to reflect on these experiences and hopefully help others who follow in my path. From Wikipedia : In geometry, the tesseract, also called an 8-cell or regular octachoron or cubic prism, is the four-dimensional analog of the cube. First off, lets just cover the basics. OCR stands for Optical Character Recognition, which is the process of taking an image, and being able to interpret the image and obtain textual data from it. For example, you take a photograph of a road sign, this would be an image file such as a JPEG. You can clearly see that the road sign says “Slow down”, however to a computer program, its just an image file. Whilst those guys have made a fantastic effort in their tutorials, I still needed to do further tasks to get an OCR demo off the ground, so hopefully this post will be a good supplement to their work.

VoiceRecognition.java. Welcome to code samples for Android developers.

VoiceRecognition.java

Here you can browse sample code and learn how to build different components for your applications. Use the categories on the left to browse the available samples. Each sample is a fully functioning Android app. You can browse the resources, source files and see the overall project structure. You can copy and paste the code you need, and if you want to share a link to a specific line you can double-click it to the get the URL. Import Samples from GitHub Android Studio provides easy access to import Android code samples from GitHub and is the recommended method to retrieve Android code samples. To import a code sample into Android Studio: In the Android Studio menu, select File > Import Sample to open the Import Sample wizard.

Note: When starting Android Studio, you can also select Import an Android code sample in the Welcome to Android Studio wizard to import a sample project from GitHub as a new project. Download Samples. MediaRecorder. Class Overview Used to record audio and video.

MediaRecorder

The recording control is based on a simple state machine (see below). A common case of using MediaRecorder to record audio works as follows: MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(PATH_NAME); recorder.prepare(); recorder.start(); // Recording is now started ... recorder.stop(); recorder.reset(); // You can reuse the object by going back to setAudioSource() step recorder.release(); // Now the object cannot be reused Note: Currently, MediaRecorder does not work on the emulator. Developer Guides For more information about how to use MediaRecorder for recording video, read the Camera developer guide.

Summary Constants public static final int MEDIA_ERROR_SERVER_DIED Media server died. Constant Value: 100 (0x00000064) Constant Value: 1 (0x00000001)