DPF Plugin examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
964B

  1. package body Blep is
  2. function BLEP_Saw(Phase : Float; Pitch : Float) return Float is
  3. T : Float := modulo(Phase,1.0);
  4. begin
  5. return Naive_Saw(Phase, Pitch)+T-(T*T/2.0)-0.5;
  6. end BLEP_Saw;
  7. function Naive_Saw(Phase : Float; Frequency: Float) return Float is
  8. begin
  9. return Modulo((Phase*Frequency),1.0);
  10. end Naive_Saw;
  11. function modulo (Dividend : Float; Divisor : Float) return Float is
  12. Fraction : Float;
  13. Int_Part : Integer;
  14. begin
  15. Int_Part := Integer(Dividend);
  16. Fraction := Dividend - Float(Int_Part);
  17. return Float((Int_Part mod Integer(Divisor))) + Fraction;
  18. end modulo;
  19. function Sinc (Phase : Float) return Float is
  20. begin
  21. if Phase = 0.0 then
  22. return 1.0;
  23. else
  24. return Sin(Phase)/Phase;
  25. end if;
  26. end Sinc;
  27. function Hamming (N : Float; Size : Float) return Float is
  28. begin
  29. return 0.54 - 0.46*Cos(2.0*Pi*N/(Size - 1.0));
  30. end Hamming;
  31. end Blep;