examples/SFExamples/oggvorbiscodec94/src/libvorbis/lib/barkmel.c

00001 /********************************************************************
00002  *                                                                  *
00003  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
00004  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
00005  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
00006  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
00007  *                                                                  *
00008  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
00009  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
00010  *                                                                  *
00011  ********************************************************************
00012 
00013  function: bark scale utility
00014  last mod: $Id: barkmel.c 7187 2004-07-20 07:24:27Z xiphmont $
00015 
00016  ********************************************************************/
00017 
00018 #include <stdio.h>
00019 #include "scales.h"
00020 int main(){
00021   int i;
00022   double rate;
00023   for(i=64;i<32000;i*=2){
00024     rate=48000.f;
00025     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
00026             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00027 
00028     rate=44100.f;
00029     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
00030             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00031 
00032     rate=32000.f;
00033     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
00034             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00035 
00036     rate=22050.f;
00037     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
00038             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00039 
00040     rate=16000.f;
00041     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
00042             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00043 
00044     rate=11025.f;
00045     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
00046             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00047 
00048     rate=8000.f;
00049     fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n",
00050             rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
00051 
00052 
00053   }
00054   {
00055     float i;
00056     int j;
00057     for(i=0.,j=0;i<28;i+=1,j++){
00058       fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n",
00059               j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.));
00060     }
00061   }
00062   return(0);
00063 }
00064 

Generated by  doxygen 1.6.2