using Short-Time Energy and zero crossing rate
Audio processing FFT of chunks of audio
This will give you the short term energy as a function of time and frequency.

The zero crossing in itself is easy to code (the example is conceptual, but very inefficient)

x0 = x(1); 
for i = 2:length(x)
  x1 = x(i);
  if (x0 &gt; 0 &amp;&amp; x1 &lt; 0) || (x0 &lt; 0 &amp;&amp; x1 &gt; 0)
     % you have a zero crossing
     doSomethingWithAZeroCrossing(i);
  end
  x0 = x1; 
end


However, zero crossings are fairly sensitive to benign and typically irrelevant changes in the audio signal, so zero crossings have only limited usefulness. In particular


even small amounts of noise can generate lots of extra zero
crossings and "jitter" the existing ones
Fluctuations in DC offset or very low frequency noise (like an Air conditioner or a heating fan picked up my a microphone) move the zero crossings all over the place