This MATLAB code records a 5 second audio from the microphone and analyses wheteher it contains a speech signal or not. If there is speech signal, an approximate length of the signal is also displayed.
The program is based on "An Algorithm for Determining the Endpoints for Isolated Utterances" by L.R. Rabiner and M.R. Sambur, The Bell System Technical Journal, February 1975. An e-copy of it is available at http://www3.alcatel-lucent.com/bstj/vol54-1975/articles/bstj54-2-297.pdf
It also uses ideas and supporting codes from various threads on MATLAB Central (http://www.mathworks.in/matlabcentral/)
A video demonstration is available at http://youtu.be/ghcERMLTZdM