Blame lib/barkmel.c

Packit 06404a
/********************************************************************
Packit 06404a
 *                                                                  *
Packit 06404a
 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
Packit 06404a
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
Packit 06404a
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
Packit 06404a
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
Packit 06404a
 *                                                                  *
Packit 06404a
 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
Packit 06404a
 * by the Xiph.Org Foundation http://www.xiph.org/                  *
Packit 06404a
 *                                                                  *
Packit 06404a
 ********************************************************************
Packit 06404a
Packit 06404a
 function: bark scale utility
Packit 06404a
 last mod: $Id: barkmel.c 19454 2015-03-02 22:39:28Z xiphmont $
Packit 06404a
Packit 06404a
 ********************************************************************/
Packit 06404a
Packit 06404a
#include <stdio.h>
Packit 06404a
#include "scales.h"
Packit 06404a
int main(){
Packit 06404a
  int i;
Packit 06404a
  double rate;
Packit 06404a
  for(i=64;i<32000;i*=2){
Packit 06404a
    rate=48000.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
    rate=44100.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
    rate=32000.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
    rate=22050.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
    rate=16000.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
    rate=11025.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
    rate=8000.f;
Packit 06404a
    fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n",
Packit 06404a
            rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2));
Packit 06404a
Packit 06404a
Packit 06404a
  }
Packit 06404a
  {
Packit 06404a
    float i;
Packit 06404a
    int j;
Packit 06404a
    for(i=0.,j=0;i<28;i+=1,j++){
Packit 06404a
      fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n",
Packit 06404a
              j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.));
Packit 06404a
    }
Packit 06404a
  }
Packit 06404a
  return(0);
Packit 06404a
}
Packit 06404a