0
$\begingroup$

I want to create a sine chorus effect function in MATLAB where the inputs and the outputs will be: y=chorus(x, f_sine, delay, depth, mix, fs). What I'm trying to do is shown in this picture

enter image description here

where $M$ is my $M$ sample delay operator and its given: Μ(n)=delay+depth(0.5+0.5sin(2π*f_sine *n/fs)) and the other parameters are:

  • FF = feedforward
  • FB = feedbackward
  • BL = blend.

What I was thinking to do is:

for n=1:length(x);
M(n)=delay+depth*(0.5+0.5*sin(2*pi*f_sine*n/fs)); 
xh=x(n)+FB*xh(n-M(n));
y(n)=FF*xh(n-M(n))+BL*xh(n);
end;

Regardless of whether it is correct my code or not, my question is that $M(n)$ could be a real number and therefore $n-M(n)$ could be a real number too. So $x_h(n-M(n))$ can't be calculated...(I have a discrete signal, I want an integer inside $x_h$). I dont know if what I'm trying to say its absolutely true (if it's not explain me why), but if it is, how I can fix this problem?

$\endgroup$
3
$\begingroup$

You have indeed found the key problem of building a good chorus: you need a fractional delay. Your delay moves fairly slowly with time and it's going to take on non-integer values.

The trick is the split the actual delay in an integer part and a fractional part. So if your delay 37.83 samples, you apply a 37 tap delay from your delay line plus a 0.83 tap fractional delay. Fractional delays are typically done with polyphase FIR filters. I suggest You can google it or come back with another question.

Some good reading is this http://ieeexplore.ieee.org/document/482137/ with Matlab code here http://legacy.spa.aalto.fi/software/fdtools/ . Unfortunately the IEEE paper is not free. You can also try this https://hub.hku.hk/bitstream/10722/46311/1/71706.pdf?accept=1 instead

| improve this answer | |
$\endgroup$
  • $\begingroup$ Could you please tell me which m-file has relationship with my problem? because it has 22 files and i cant undertand which one refers to my problem. $\endgroup$ – Gensdimi Dec 28 '16 at 14:31
  • $\begingroup$ Sorry, I don't remember which file does what. If I recall correctly the paper goes through many different ways of designing fractional delay filters and discusses the pros and cons for each. There is no "best" solution, it all depends on your specific requirements in terms of fidelity, computational resources, real time, etc. I suggest you read the paper. $\endgroup$ – Hilmar Dec 28 '16 at 15:42
  • $\begingroup$ @Gensdimi: Have a look at this answer for a link to the paper and the corresponding Matlab toolbox. $\endgroup$ – Matt L. Dec 29 '16 at 17:07

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.