I want to extract the first 0.5 seconds of an audio file and make that portion of the signal as 0. I read the audio file and plotted it successfully but I'm having trouble figuring out how to extract the first 0.5 seconds. Should I use a loop? My code so far, is given below. [x,fs]= audioread('C:\Users\prashantram.s\Desktop\hello.wav'); [m,n]=size(x); dt=1/fs; t=dt*(0:m-1); figure(1); plot(t,x);
Kshitij Singh answered .
2025-11-20
idx = t<0.5 ; x = x(idx) ;