Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

55 lines
2.3KB

  1. /*
  2. CHORUS and FLANGE effects
  3. Both effects use a delay line to hold previous samples. This allows
  4. the current sample to be combined in some way with a sample that
  5. occurred in the past. An obvious effect this would allow would be
  6. an echo where the current sample is combined with a sample from,
  7. say, 250 milliseconds ago. The chorus and flange effects do this
  8. as well but they combine samples from only about 50ms (or less) ago.
  9. CHORUS EFFECT
  10. This combines one or more samples up to about 50ms ago. In this
  11. library, the additional samples are evenly spread through the
  12. supplied delay line.
  13. E.G. If the number of voices is specified as 2 then the effect
  14. combines the current sample and the oldest sample (the last one in
  15. the delay line). If the number of voices is 3 then the effect
  16. combines the most recent sample, the oldest sample and the sample
  17. in the middle of the delay line.
  18. For two voices the effect can be represented as:
  19. result = (sample(0) + sample(dt))/2
  20. where sample(0) represents the current sample and sample(dt) is
  21. the sample in the delay line from dt milliseconds ago.
  22. FLANGE EFFECT
  23. This combines only one sample from the delay line but the position
  24. of that sample varies sinusoidally.
  25. In this case the effect can be represented as:
  26. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))
  27. The value of the sine function is always a number from -1 to +1
  28. and so the result of depth*(sinFe) is always a number from
  29. -depth to +depth. Thus, the delayed sample will be selected from
  30. the range (dt-depth) to (dt+depth). This selection will vary
  31. at whatever rate is specified as the frequency of the effect Fe.
  32. Try these settings:
  33. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)
  34. and
  35. int s_idx = 2*FLANGE_DELAY_LENGTH/4;
  36. int s_depth = FLANGE_DELAY_LENGTH/4;
  37. double s_freq = 3;
  38. The flange effect can also produce a chorus effect if a longer
  39. delay line is used with a slower rate, for example try:
  40. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)
  41. and
  42. int s_idx = 3*FLANGE_DELAY_LENGTH/4;
  43. int s_depth = FLANGE_DELAY_LENGTH/8;
  44. double s_freq = .0625;
  45. When trying out these effects with recorded music as input, it is
  46. best to use those where there is a solo voice which is clearly
  47. "in front" of the accompaniment. Tracks which already contain
  48. flange or chorus effects don't work well.
  49. */