examples/test_wav/test_wav.c

Go to the documentation of this file.
00001 /*
00002    libit - Library for basic source and channel coding functions
00003    Copyright (C) 2005-2005 Vivien Chappelier, Herve Jegou
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 /** @file test_wav.c Test program for wav file */
00021 
00022 #include <it/io.h>
00023 #include <it/mat.h>
00024 
00025 int main ()
00026 {
00027   const char *filename_in = "../data/test.wav";
00028   const char *filename_out = "out.wav";
00029   const char *filename_reverse = "reverse.wav";
00030 
00031   int  depth, srate, channels, length;
00032   imat m;
00033 
00034   if (!wav_info (filename_in, &channels, &srate, &depth, &length)) {
00035     fprintf (stderr, "unable to open file %s\n", filename_in);
00036     return (1);
00037   }
00038   printf
00039     ("file name = %s\nchannels = %d\nsampling rate = %d\ndepth = %d\nlength = %d samples/channel\n",
00040      filename_in, channels, srate, depth, length);
00041 
00042   m = imat_wav_read (filename_in);
00043 
00044   imat_wav_write (filename_out, m, srate, depth);
00045 
00046   /* the same thing with satanic voices ;) */
00047   ivec_reverse (m[0]);
00048 
00049   imat_wav_write (filename_reverse, m, srate, depth);
00050 
00051   imat_delete (m);
00052   return 0;
00053 }

Hosted by
Copyright (C) 2005-2006 Hervé Jégou
Vivien Chappelier
Francois Cayre
libit logo courtesy of Jonathan Delhumeau