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
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?