Hi I'm trying to separate sound from music using wfilters and heard each part separately using its name scale3 function

function s = scale3(q,n)
   p = length(q);
    if p==n 
       s = q;
      s = resample(q,n,p);

the program

 s = wavread('K:\Khaleel_3aaza (1).wav'); % whatever here
 [l,h] = wfilters('sym2','d');

 -> p = scale3(z.x(25000:40000),45000);

And the function in the program I apply with wfilters and filter works well until approximately 20,000 but the values ​​of the file that I'm working it the larger, and the music begins approximately 3,000 when I ues more than 30000 or more give me this error

??? Error using ==> upfirdnmex
  Filter length is too large - reduce problem complexity.

 Error in ==> upfirdn at 86
 Y = upfirdnmex(x,h,p,q,Lx,Lh,hCols,nChans);

 Error in ==> resample at 106
  y = upfirdn(x,h,p,q);

 Error in ==> scale3 at 6
  s = resample(q,n,p);

  Error in ==> Untitled2 at 7
  p = scale3(z.x(25000:40000),45000);

I don't understand what that means ? ang how I can fix it thank you for help


Matlab's resample() is a "rational" sample rate converter, i.e. it upsamples by n, low-pass filters and then downsamples by p. This works best, if n and p are relatively small integers. If the numbers are large and mutually prime, the up-sampled vector gets huge. In your case that would be 15001*45000 = 675,040,000 samples.

The easiest work around would be to change the input length from 15001 to 15000 (i.e. p = scale3(z.x(25001:40000),45000);). That reduces it to a trivial upsampling by 3.

If that's not possible, you need to find an "irrational" sample rate converter that's typically done with polyphase filter interpolation. Not sure whether there is one in the standard Matlab distribution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.