Voice recording in Sketchware


Hello everyone today in this video I'll show you about Voice Recording in Sketchware.

1. Create a new project, add a linear(V) and set Gravity to CENTER & add two button Button 1 for start Recording & Button 2 for stop Recording


2. Go to onCreate event and add "write string to file path" block for add file permission, a string variable "FilePath" for set recording output path & set your output path here. then paste this code with ASD block.
code: 
}
private MediaRecorder myAudioRecorder;
private void fo4o() {

*Now add a speak to text component for adding voice permission*

3. Now go to button1 onClicked and set media recorder with this code
myAudioRecorder = new MediaRecorder();
myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myAudioRecorder.setOutputFile(FilePath);

and start recording with this code
try {
 myAudioRecorder.prepare();
 myAudioRecorder.start();
} catch (Exception e) {}



4. Now go to on stop button click event to stop recording with this code

try {
 myAudioRecorder.stop();
 myAudioRecorder.release();
 myAudioRecorder = null;
} catch(Exception e) {}

*Save & run your project, this app is ready for recording voice

Youtube tutorial:


3 comments:

  1. After making the project the record file is saved under file but if you record another one the old one lives why can there be a file to keep all of them

    ReplyDelete

Note: Only a member of this blog may post a comment.

Powered by Blogger.