Search code examples
matlabsignal-processingspeech-recognitionpitchpitch-tracking

find Pitch-synchronous windowing based on pitch tracking


As seen in comment link a pitch by Talkin’s Robust Algorithm for Pitch Tracking in voicebox (function name is "fxrapt") is extracted.

http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/doc/voicebox/fxrapt.html

However, I need to find pitch pulses in the LP error signal by detecting the maximum amplitude within each pitch period. For each pitch pulse, a Hamming window of two pitch periods long. if T(i-1), T(i), T(i+1) denote the locations of three successive pitch pulses. How can I design a analysis window for the pitch pulse at spans from T(i-1) to T(i+1), as illustrated in bellow link Figure ?

enter image description here

I am looking for MATLAB code for it. I will really appreciate, if anyone can help me. Thanks.


Solution

  • Steps:

    • Apply the pitch track to find the period at each frame, not use overalp in your pitch track, you need do it synchronous and linearly.
    • At every time that you find the Period = P search the maximun absolute amplitude on the signal between the range 1 to P*2

    these two steps can be done like this:

    while ( (k+Step-1) <= Nsamples )
    
        frame = x(k:k+steps-1);
    
        P=PITCHTRACK_FUNCTION_HERE
    
        [v, l] = max(abs(frame(1:P*2)));
    
       if count == 1
    
          marks(count) = l;
    
       else
    
         marks(count) = l+k-1;
    
      count = count +1;
    
      k=k+Step;
    
    end
    
    • you now have all marks referring to your entire signal, then walk around the vector marks to aplly a Hamming window of two pitch periods long !

      test=zeros(length(x),1);
      
      for p=2:length(marks)-2
      
         last=marks(p-1);
      
         next=marks(p+1);
      
      
         test(last:next)=test(last:next) + x(last:next) .*  hamming(length(x(last:next)));
      
      
      
       end
      

    PS:

    x = your signal

    Nsamples = length(x)

    k = begins with 1

    Step = 256 or 512 or 1024 or 2048