barkmel.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
  5. * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH *
  6. * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  7. * *
  8. * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
  9. * by Monty <monty@xiph.org> and the XIPHOPHORUS Company *
  10. * http://www.xiph.org/ *
  11. * *
  12. ********************************************************************
  13. function: bark scale utility
  14. last mod: $Id: barkmel.c,v 1.1.14.1 2000/11/04 06:21:42 xiphmont Exp $
  15. ********************************************************************/
  16. #include <stdio.h>
  17. #include "scales.h"
  18. int main(){
  19. int i;
  20. double rate;
  21. for(i=64;i<32000;i*=2){
  22. rate=48000.;
  23. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
  24. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  25. rate=44100.;
  26. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
  27. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  28. rate=32000.;
  29. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
  30. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  31. rate=22050.;
  32. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
  33. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  34. rate=16000.;
  35. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
  36. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  37. rate=11025.;
  38. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
  39. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  40. rate=8000.;
  41. fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n",
  42. rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
  43. }
  44. for(i=0;i<28;i++){
  45. fprintf(stderr,"bark=%d %gHz\n",
  46. i,fromBARK(i));
  47. }
  48. return(0);
  49. }