I have a project in which I have to create chorus effect to an audio file. I have tried this code and i don't know weather its right or wroung. Anyway the code is below

delay_in_sampels=0.05*fs;%50 ms delay
sincurve = 1*sin(2*pi*index*f);
y = zeros(length(x):1);
for i =(delay_in_sampels+1):length(x)
    y(i)=(a*x(i)) + b*(x(o));

Now I have been asked to find its impulse response.

  • 1
    $\begingroup$ Is this a homework question? If so, the question should be tagged. $\endgroup$ – Jacob Jun 5 '13 at 14:57
  • 1
    $\begingroup$ Actually i am new to this site or any site like this. and its given me as mini project in signals and systems. $\endgroup$ – Tauseef Jun 18 '13 at 19:46

A chorus effect is achieved by adding a delayed version to the original signal and then modulating the delay. There are typically three parameters that control a chorus

  1. Speed: frequency of the delay modulation
  2. Depth: amplitude of delay modulation
  3. Mix: Ratio of original and delayed signal

There are a few more things to play around with: min delay, modulation shape, number of taps, etc..

There are lots problems with your code:

  1. The speed of your modulation is not 0.25 Hz (which you probably intended) but a quarter of the sample rate, which is way too fast for a chorus
  2. The delay needs to calculated as d[n] = dMax*(1 + sin(modFreq*t)) so it needs to be centered around a medium delay with the modulation going up and down from there
  3. You need a sub sample delay and not just round to the nearest integer
  4. The delayed signal should never be larger than the original one

Finally, there is no impulse response. By definition the chorus is a time variant system and impulse responses can only be defined for time invariant systems.

  • 1
    $\begingroup$ Note that a time-variant systems can indeed be characterized by an impulse response as long as it is linear. This impulse response is, however, a 2-dimensional function. The output signal can be computed by $y(t)=\int_{-\infty}^{\infty}h(t,\tau)x(\tau)d\tau$ where $h(t,\tau)$ is the impulse response of the linear time-variant system. $\endgroup$ – Matt L. Jun 5 '13 at 15:30
  • 1
    $\begingroup$ Thank you very much for your answers.I consulted another teacher in this regard. He told me that the code is fine but now I have to find fourier transform for the input and output. So if you can help me in this. And once again thank you very much. $\endgroup$ – Tauseef Jun 18 '13 at 19:50

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