2
0

tprede.c 988 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. tpre_de.c
  3. David Rowe
  4. Sep 24 2012
  5. Unit test to generate the combined impulse response of pre & de-emphasis filters.
  6. pl("../unittest/out48.raw",1,3000)
  7. pl("../unittest/out8.raw",1,3000)
  8. Listening to it also shows up anything nasty:
  9. $ play -s -2 -r 48000 out48.raw
  10. $ play -s -2 -r 8000 out8.raw
  11. */
  12. #include <assert.h>
  13. #include <math.h>
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include "lpc.h"
  17. #define N 10
  18. #define F 10
  19. int main() {
  20. FILE *fprede;
  21. float Sn[N], Sn_pre[N], Sn_de[N];
  22. float pre_mem = 0.0, de_mem = 0.0;
  23. int i, f;
  24. fprede = fopen("prede.txt", "wt");
  25. assert(fprede != NULL);
  26. for(i=0; i<N; i++)
  27. Sn[i] = 0.0;
  28. Sn[0]= 1.0;
  29. for(f=0; f<F; f++) {
  30. pre_emp(Sn_pre, Sn, &pre_mem, N);
  31. de_emp(Sn_de, Sn_pre, &de_mem, N);
  32. for(i=0; i<N; i++) {
  33. fprintf(fprede, "%f\n", Sn_de[i]);
  34. }
  35. Sn[0] = 0.0;
  36. }
  37. fclose(fprede);
  38. return 0;
  39. }