public String Listen(String valide, String stop, int time){
	
	TextToSpeech tts = new TextToSpeech();
	Microphone mic = new Microphone(AudioFileFormat.Type.WAVE);
	while (true)
	{
	try{
        Thread.sleep(2000);	
		tts.playSynth("Please, Speak now..."); 
			Thread.sleep(50);
			mic.open();
			mic.captureAudioToFile(filename);
			System.out.println("Listening...");		
			Thread.sleep(time);
			mic.close();
			new Thread(new RecognizeThread()).start();
			Thread.sleep(5000);
		
        if (valide.contains(data))
        {
        	tts.playSynth("The word accepted: " + data);
        	return data;
        }
        else if (stop.contains(data))
        {
        	tts.playSynth("recognition stopped!!");
        	System.out.println("Exiting...");
        	break;
        }
        else {
        	tts.playSynth("Didn't get that.");
        }
       }
    catch(Exception e){
        e.printStackTrace();
    }
	
	
	}
	return "wrong";
	}