1 | /********************************************************************
|
---|
2 | * *
|
---|
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
---|
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
---|
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
---|
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
---|
7 | * *
|
---|
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
---|
9 | * by the Xiph.Org Foundation https://xiph.org/ *
|
---|
10 | * *
|
---|
11 | ********************************************************************
|
---|
12 |
|
---|
13 | function: bark scale utility
|
---|
14 |
|
---|
15 | ********************************************************************/
|
---|
16 |
|
---|
17 | #include <stdio.h>
|
---|
18 | #include "scales.h"
|
---|
19 | int main(){
|
---|
20 | int i;
|
---|
21 | double rate;
|
---|
22 | for(i=64;i<32000;i*=2){
|
---|
23 | rate=48000.f;
|
---|
24 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
|
---|
25 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
|
---|
26 |
|
---|
27 | rate=44100.f;
|
---|
28 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
|
---|
29 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
|
---|
30 |
|
---|
31 | rate=32000.f;
|
---|
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 |
|
---|
35 | rate=22050.f;
|
---|
36 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
|
---|
37 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
|
---|
38 |
|
---|
39 | rate=16000.f;
|
---|
40 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
|
---|
41 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
|
---|
42 |
|
---|
43 | rate=11025.f;
|
---|
44 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
|
---|
45 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
|
---|
46 |
|
---|
47 | rate=8000.f;
|
---|
48 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n",
|
---|
49 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
|
---|
50 |
|
---|
51 |
|
---|
52 | }
|
---|
53 | {
|
---|
54 | float i;
|
---|
55 | int j;
|
---|
56 | for(i=0.,j=0;i<28;i+=1,j++){
|
---|
57 | fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n",
|
---|
58 | j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.));
|
---|
59 | }
|
---|
60 | }
|
---|
61 | return(0);
|
---|
62 | }
|
---|
63 |
|
---|