dcbias.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. $Log$
  3. Revision 1.15 2004/06/26 03:50:14 markster
  4. Merge source cleanups (bug #1911)
  5. Revision 1.14 2003/02/12 13:59:14 matteo
  6. mer feb 12 14:56:57 CET 2003
  7. Revision 1.1.1.1 2003/02/12 13:59:14 matteo
  8. mer feb 12 14:56:57 CET 2003
  9. Revision 1.2 2000/01/05 08:20:39 markster
  10. Some OSS fixes and a few lpc changes to make it actually work
  11. * Revision 1.1 1996/08/19 22:40:23 jaf
  12. * Initial revision
  13. *
  14. */
  15. /* -- translated by f2c (version 19951025).
  16. You must link the resulting object file with the libraries:
  17. -lf2c -lm (in that order)
  18. */
  19. #include "f2c.h"
  20. #ifdef P_R_O_T_O_T_Y_P_E_S
  21. extern int dcbias_(integer *len, real *speech, real *sigout);
  22. #endif
  23. /* ********************************************************************* */
  24. /* DCBIAS Version 50 */
  25. /* $Log$
  26. * Revision 1.15 2004/06/26 03:50:14 markster
  27. * Merge source cleanups (bug #1911)
  28. *
  29. * Revision 1.14 2003/02/12 13:59:14 matteo
  30. * mer feb 12 14:56:57 CET 2003
  31. *
  32. * Revision 1.1.1.1 2003/02/12 13:59:14 matteo
  33. * mer feb 12 14:56:57 CET 2003
  34. *
  35. * Revision 1.2 2000/01/05 08:20:39 markster
  36. * Some OSS fixes and a few lpc changes to make it actually work
  37. *
  38. * Revision 1.1 1996/08/19 22:40:23 jaf
  39. * Initial revision
  40. * */
  41. /* Revision 1.3 1996/03/18 21:19:22 jaf */
  42. /* Just added a few comments about which array indices of the arguments */
  43. /* are used, and mentioning that this subroutine has no local state. */
  44. /* Revision 1.2 1996/03/13 16:44:53 jaf */
  45. /* Comments added explaining that none of the local variables of this */
  46. /* subroutine need to be saved from one invocation to the next. */
  47. /* Revision 1.1 1996/02/07 14:44:21 jaf */
  48. /* Initial revision */
  49. /* ********************************************************************* */
  50. /* Calculate and remove DC bias from buffer. */
  51. /* Input: */
  52. /* LEN - Length of speech buffers */
  53. /* SPEECH - Input speech buffer */
  54. /* Indices 1 through LEN read. */
  55. /* Output: */
  56. /* SIGOUT - Output speech buffer */
  57. /* Indices 1 through LEN written */
  58. /* This subroutine has no local state. */
  59. /* Subroutine */ int dcbias_(integer *len, real *speech, real *sigout)
  60. {
  61. /* System generated locals */
  62. integer i__1;
  63. /* Local variables */
  64. real bias;
  65. integer i__;
  66. /* Arguments */
  67. /* Local variables that need not be saved */
  68. /* Parameter adjustments */
  69. --sigout;
  70. --speech;
  71. /* Function Body */
  72. bias = 0.f;
  73. i__1 = *len;
  74. for (i__ = 1; i__ <= i__1; ++i__) {
  75. bias += speech[i__];
  76. }
  77. bias /= *len;
  78. i__1 = *len;
  79. for (i__ = 1; i__ <= i__1; ++i__) {
  80. sigout[i__] = speech[i__] - bias;
  81. }
  82. return 0;
  83. } /* dcbias_ */