Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/libvorbis-1.2.0/lib/barkmel.c @ 58

Last change on this file since 58 was 16, checked in by landauf, 17 years ago

added libvorbis

File size: 2.3 KB
Line 
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 http://www.xiph.org/                  *
10 *                                                                  *
11 ********************************************************************
12
13 function: bark scale utility
14 last mod: $Id: barkmel.c 13293 2007-07-24 00:09:47Z xiphmont $
15
16 ********************************************************************/
17
18#include <stdio.h>
19#include "scales.h"
20int main(){
21  int i;
22  double rate;
23  for(i=64;i<32000;i*=2){
24    rate=48000.f;
25    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
26            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
27
28    rate=44100.f;
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
32    rate=32000.f;
33    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
34            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
35
36    rate=22050.f;
37    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
38            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
39
40    rate=16000.f;
41    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
42            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
43
44    rate=11025.f;
45    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
46            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
47
48    rate=8000.f;
49    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n",
50            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
51
52
53  }
54  {
55    float i;
56    int j;
57    for(i=0.,j=0;i<28;i+=1,j++){
58      fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n",
59              j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.));
60    }
61  }
62  return(0);
63}
64
Note: See TracBrowser for help on using the repository browser.