// Tor's Speech Recognition reference code... // // Copyright (C) 2001 // Tor Aamodt // University of Toronto // // For use with the "Float-to-Fixed Conversion Tool" // available from http://www.float-to-fixed.com // Achieves 100% recognition accuracy with the following inputs: // http://www.eecg.utoronto.ca/~aamodt/ece341/speech-recognition/train_test.dsp.gz // #ifdef GCCmod #include "traps.h" #else #ifndef WORKSTATION #define WORKSTATION #endif #endif #ifdef WORKSTATION #ifdef WIN32 #include "StdAfx.h" #endif #include #include #include #pragma warning(disable : 4005) #endif #define NSAMPLES_PER_INTERVAL 250 #define NSAMPLES 4000 #define NDIM 80 #define NWORDS 5 float Buffer[NSAMPLES]; float word[NDIM]; float dic[NWORDS][NDIM]; void initialize(); void get_sample(); void analyze( float *, float * ); int lookup( float[][NDIM], float * ); void control( int, int ); float euclidean( float *a, float *b, int length ); float filter1( float x ); float filter2( float x ); float filter3( float x ); float filter4( float x ); float filter5( float x ); void main() { int i, j; #ifdef WORKSTATION float max; #endif initialize(); // open files (if testing on workstation), // initialize interrupts (if on UltraGizmo board) for( i=0; i max ) max = dic[i][j]; } printf("word %d max = %f\n", i, max ); #endif } for( i=0; i