private static double computePitchValue(int frameLength, float sampleRate,
			Matrix rowMatrix) {
		/**
		 * computes the pitch of one frame of a speech signal. no logger was
		 * placed here since this is called many times for one audio file
		 */
		try {
			/** find the clipping level */

			/** get the location of A's right boundary in the frame */
			int i13 = (int) Math.floor(frameLength / 3);
			/**
			 * get the location of C's starting point or left boundary in the
			 * frame
			 */
			int i23 = (int) Math.floor(2 * frameLength / 3) - 1;

			int[] tmp1 = rowMatrix.getSubMatrix(0, 0, 0, i13 - 1).pivot();
			int[] tmp2 = rowMatrix.getSubMatrix(0, i23, 0, frameLength - 1)
					.pivot();

			/**
			 * the clipping level is set at the 68% of the smaller value between
			 * between the peak absolute sample values in A and C of this frame
			 */
			double CL = 0.0;
			if (rowMatrix.getElement(tmp1[0], tmp1[1]) > rowMatrix.getElement(
					tmp2[0], i23 + tmp2[1]))
				CL = 0.68 * rowMatrix.getElement(tmp2[0], tmp2[1]);
			else
				CL = 0.68 * rowMatrix.getElement(tmp1[0], tmp1[1]);

			/** non-linear center clipping */
			double[] clip = rowMatrix.getRowCopy(0);
			if (CL > 0) {
				for (int i = 0; i < frameLength; i++) {
					if (clip[i] >= CL)
						clip[i] = clip[i] - CL;
					else if (clip[i] <= -CL)
						clip[i] = clip[i] + CL;
				}
			}

			/**
			 * compute the autocorrelation function at 0 delay for appropriate
			 * normalization. basically RR describes the frequency content of
			 * the speech signal
			 */

			double[] RR = xcorr(clip);
			/** find the position value of autocorrelation peak */
			double LF = Math.floor(sampleRate / 500);
			double HF = Math.floor(sampleRate / 75);

			/**
			 * find the max autocorrelation / autocorrelation peak in the range
			 * 60 to 320 (inclusive)
			 */
			Matrix Rxx = Matrix.rowMatrix(RR).getSubMatrix(0,
					frameLength + (int) LF - 1, 0, frameLength + (int) HF - 1);
			RR = null;
			RR = Rxx.maximumElement();

			/** p is f0 */
			double p = 0.0;
			p = RR[2] + LF;
			p = sampleRate / p;

			/**
			 * compare peak value with voiced/unvoiced threshold to
			 * differentiate silence from speech signal based on energy
			 */
			double energy = norm2(clip);
			double sil = 0.40 * energy;

			/**
			 * if it's above the silence value and between 60 to 320, it's
			 * voiced
			 */
			if ((RR[0] > sil) && (p > 60) && (p <= 320)) {
				return p;
			}
			/** otherwise, it's unvoiced */
			return 0;
		} catch (Exception e) {
			LOGGER.error("Error in computing pitch. Return -1 to signal error",
					e);
			return -1;
		}
	}