From ab6943aa521bafea8049a7d0009777d0b24d2462 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 24 Nov 2008 15:30:09 +0000 Subject: Remove src/moosynth.c --- src/moosynth.c | 140 --------------------------------------------------------- 1 file changed, 140 deletions(-) delete mode 100644 src/moosynth.c (limited to 'src') diff --git a/src/moosynth.c b/src/moosynth.c deleted file mode 100644 index 6d78415..0000000 --- a/src/moosynth.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * moosynth.c - * - * Work out how to synthesize a cow - * - * (c) 2008 Thomas White - * - * This file is part of OpenMooCow - accelerometer moobox simulator - * - * OpenMooCow is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * OpenMooCow is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with OpenMooCow. If not, see . - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) { - - FILE *fh; - double *data; - fftw_complex *ft; - struct stat statbuf; - fftw_plan plan; - int samples; - int16_t *sdata; - int i, max_fq, c; - double max_am, next_max_am, max_ph; - const int ncomp = 20; - int components[ncomp]; - - if ( argc != 2 ) { - fprintf(stderr, "Syntax: %s \n", argv[0]); - return 1; - } - - /* Determine size of data */ - if ( stat(argv[1], &statbuf) == -1 ) { - fprintf(stderr, "Couldn't stat file '%s'\n", argv[1]); - return 1; - } - samples = statbuf.st_size/2; /* Two bytes per sample, one channel */ - printf("File size: %lli bytes\n", (long long int)statbuf.st_size); - - /* Read the data in */ - fh = fopen(argv[1], "rb"); - if ( fh == NULL ) { - fprintf(stderr, "Couldn't open file '%s'\n", argv[1]); - return 1; - } - sdata = malloc(samples*2); - fread(sdata, 2, samples, fh); - fclose(fh); - - data = fftw_malloc(samples*sizeof(double)); - ft = fftw_malloc(samples*sizeof(fftw_complex)); - - for ( i=0; i max_am) && (am < next_max_am) ) { - max_am = am; - max_fq = i; - max_ph = ph; - } - - } - printf("%2i %6i Hz %14.2f %+7.1f\n", c+1, (44100/samples)*max_fq, max_am, 180*(max_ph/M_PI)); - components[c] = max_fq; - next_max_am = max_am; - - } - - for ( i=0; i