Detecting sudden rises and printing on the console
    4 views (last 30 days)
  
       Show older comments
    
Hi, I'd like to detect the number of claps in a given wav file. Here's my first attempt. I can draw the spectogram but how can I print " There is only one clap " or " There are two claps " on the console according to the sudden rises?? Here is my code, for the file that includes one clap, there exist a single sudden rise and two sudden rises for the file that includes two claps. But how can I detect the sudden rises from the plotting and write it on the console?
   hfile = 'one.wav';
   [stereo1, Fs, nbits, readinfo] = wavread(hfile);
   mono1 = mean(stereo1,2);
   M = round(0.01*Fs); 
   N = 2^nextpow2(4*M);
   w = gausswin(M);
   [S,F,T,P] = spectrogram(mono1,w,120,N,Fs);
   thresh_l=1000;
   thresh_h=10000000;
   % take the segment of P relating to your frequencies of interest
   P2 = P(F>thresh_l&F<thresh_h,:); 
   %show the mean power in that band over time
   m = mean(P2);
   plot(T,m);
0 Comments
Answers (0)
See Also
Categories
				Find more on Programmatic Scenario Authoring in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!