summaryrefslogtreecommitdiffhomepage
path: root/lib/barkmel.c
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-09-29 22:52:49 +0200
committerAki <please@ignore.pl>2021-09-29 22:52:49 +0200
commit74f4b1bc3b627ba4c7e03498234d88cacdfbe97b (patch)
tree197b5978d6e38f44069ea92583098a1da04aa635 /lib/barkmel.c
downloadstarshatter-74f4b1bc3b627ba4c7e03498234d88cacdfbe97b.zip
starshatter-74f4b1bc3b627ba4c7e03498234d88cacdfbe97b.tar.gz
starshatter-74f4b1bc3b627ba4c7e03498234d88cacdfbe97b.tar.bz2
Squashed 'vorbis/' content from commit d22c3ab5f
git-subtree-dir: vorbis git-subtree-split: d22c3ab5f633460abc2532feee60ca0892134cbf
Diffstat (limited to 'lib/barkmel.c')
-rw-r--r--lib/barkmel.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/barkmel.c b/lib/barkmel.c
new file mode 100644
index 0000000..4b19935
--- /dev/null
+++ b/lib/barkmel.c
@@ -0,0 +1,63 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
+ * *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: bark scale utility
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include "scales.h"
+int main(){
+ int i;
+ double rate;
+ for(i=64;i<32000;i*=2){
+ rate=48000.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+ rate=44100.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+ rate=32000.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+ rate=22050.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+ rate=16000.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+ rate=11025.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+ rate=8000.f;
+ fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n",
+ rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
+
+
+ }
+ {
+ float i;
+ int j;
+ for(i=0.,j=0;i<28;i+=1,j++){
+ fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n",
+ j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.));
+ }
+ }
+ return(0);
+}
+