Why doeas my voice capture midlet generates echo? please help

This midlet is for recording voice but it generates an echo of the voice while recording.. and i can't understand why. is there anyone who has any idea? i'd really appreciate any help.. it is required for my term project..
package com.apress.chapter8;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.RecordControl;
public class SaveCapturedAudioMIDlet extends MIDlet
implements CommandListener {
// the display items
private Display display = null;
private Alert alert = null;
private Command exitCommand = null;
// players and controls
private Player capturePlayer = null;
private RecordControl rControl = null;
private boolean error = false;
public SaveCapturedAudioMIDlet() {
// create the display
display = Display.getDisplay(this);
alert = new Alert("Message");
alert.setTimeout(Alert.FOREVER);
alert.setString("Capturing for 10 seconds. Say something intelligent!");
exitCommand = new Command("Exit", Command.EXIT, 1);
alert.addCommand(exitCommand);
alert.setCommandListener(this);
try {
// create the capture player
capturePlayer = Manager.createPlayer("capture://audio");
if (capturePlayer != null) {
// if created, realize it
capturePlayer.realize();
// and grab the RecordControl
rControl = (RecordControl)capturePlayer.getControl(
"javax.microedition.media.control.RecordControl");
// set the alert as the current item
display.setCurrent(alert);
// if it is null throw exception
if(rControl == null) throw new Exception("No RecordControl available");
// and set the destination for this captured data
rControl.setRecordLocation("file:///test.wav");
} else {
throw new Exception("Capture Audio Player is not available");
} catch(Exception e) {
error(e);
public void startApp() {
if(error) return;
try {   
// first start the corresponding recording player
capturePlayer.start();
// and then start the RecordControl
rControl.startRecord();
// now record for 10 seconds
Thread.sleep(10000);
// stop recording after time is up
rControl.stopRecord();
// commit the recording
rControl.commit();
// stop the Player instance
capturePlayer.stop();
// and close it to release the microphone
capturePlayer.close();
// finally, create a Player instance to playback
// check your device documentation to find out the root.
// The following will work on devices that have the root
// specified as shown
// and start it
} catch(Exception e) {
error(e);
public void pauseApp() {
public void destroyApp(boolean unconditional) {
if(capturePlayer != null) capturePlayer.close();
public void commandAction(Command cmd, Displayable disp) {
if(cmd == exitCommand) {
destroyApp(true);
notifyDestroyed();
// general purpose error method, displays on screen as well to output
private void error(Exception e) {
alert.setString(e.getMessage());
alert.setTitle("Error");
display.setCurrent(alert);
e.printStackTrace();
error = true;
}

hi, i am trying to make a karaoke player with j2me and i want it to be able to record the user's voice while playing the background song.. how can i synchronize these two? what can i do to make it more efficient?

Similar Messages

Maybe you are looking for

  • SoundFonts - small problem. Please help me because this is very important to

    Hello everyone. I have just upgraded from a SoundBlaster Audigy, to a SoundBlaster X-Fi Music edition. I have a collection of soundfonts which I used to use on my Audigy. They worked fine. Now that I'm using the X-Fi, they all work well, apart from o

  • How do you play videos from iPhone that are in iPhoto they show up as pictures not videos

    made a video on iphone and synced to iphoto on imac. I can view the video on my mac but they do not sync to my ipad or to apple tv. do the videos need to be converted? should be seemless if the video is recorded on an apple device.

  • Update equipment with serial number

    Hi all. Some how the BAPI_EQUI_CHANGE doesn't update the serial number of an existing equipment. DATA_SPECIFIC-SERIALNO is filled with the new number. DATA_SPECIFICX-SERIALNO = 'X'. and I'm activating t he BAPI_TRANSACTION_COMMIT after that. I get it

  • Single sided copying help

    Just got a new printer/copier/scanner, etc....     All my printing from my desktop files or the internet come out correctly one sided pages.  As soon as I go into my service that uses Adobe Acrobat the pages come out two sided, in other words if i tr

  • My contacts in my iphone disappear

    I have Iphone 4s and all my contcts are gone, how can I recover them?