public byte[] scanForSpeech(byte[] dataBuffer) {
		ByteArrayOutputStream speechData = new ByteArrayOutputStream();
		boolean isSpeech = false;
		int tailIndex = 0;
		for (int headIndex = 9; headIndex < dataBuffer.length; headIndex= headIndex+10) {
			// process this segment
			byte[] currentBuffer = Arrays.copyOfRange(dataBuffer, tailIndex, headIndex);
			int energy = this.sumEnergyInSingleSegment(currentBuffer);
			// check if we currently detect speech
			if (false == isSpeech) {
				if (this.getITL() < energy) {
					try {
						speechData.write(currentBuffer);
					} catch (IOException e) {
						System.out.println("Failed to write data to ByteArrayOutputStream");
						e.printStackTrace();
					}
					isSpeech = true;
				}
			} else {
				// check the buffer for the end of current word
				if (energy > this.getITU()){
					try {
						speechData.write(currentBuffer);
					} catch (IOException e) {
						System.out.println("Failed to write data to ByteArrayOutputStream");
						e.printStackTrace();
					}
				}
				else {
					isSpeech = false;
				}
			}
			tailIndex = headIndex;
		}
		
		return speechData.toByteArray();
	}