Plotting a Time Domain Sound Signal in Real Time whilst the sound is playing

Asked by Alon on 18 Aug 2012
Latest activity Answered by Azzi Abdelmalek on 18 Aug 2012

I have a sound file with a sampling frequency of 8000 Hz named coch.txt.

I want to play the sound (I know can do that with the code sound(coch,8000)) and simultaneously, I want to plot the Time Domain Sound Signal using the code plot(t,coch) %where t is the time vector

However I want the plot to draw itself in real time, alongside the playing of the sound file. I am required to identify where specific words from the sound file occur in the plot, and that will be easy to do if I see the plot drawn in real time whilst the sound is playing over it.

Can anyone help?

0 Comments

Alon

Products

No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek on 18 Aug 2012

i can show you how to plot on real time using "pause(SampleTime)"

    t=0:0.01:2*pi;y=sin(t); % signal to plot with sample time=0.01s
 close
 figure;set(gca,'xlim',[min(t) max(t)],'ylim',[min(y) max(y)])
 ax1=gca;
 for k=1:length(t)
   hold on   
   line(t(k),y(k),'Marker','o','LineStyle','--','Markersize',4,'parent',ax1);
   pause(0.01)                 % wait 0.01 s and then continue 
 end

0 Comments

Azzi Abdelmalek

Contact us