Appendix A

 

 

 

Small portion of text-data representation of above spectrogram.
Point Freq Amp Phase
 
                                                        2 215 10 -2.034

                                                        3 301 41 -0.785

                                                        4 388 41 -1.460

                                                        5 474 186 1.768

                                                        6 560 279 -1.465

                                                        7 646 166 1.862

                                                        8 732 39 0.175

                                                        9 818 10 -1.107

                                                        10 904 19 -2.521

                                                        11 991 6 0.785

                                                        12 1077 12 0.381

                                                        13 1163 11 -2.214

                                                        14 1249 4 3.142
 
                                                        15 1335 12 1.190

                                                        16 1421 4 -0.785

                                                        17 1507 20 -0.785

                                                        18 1593 41 2.751

                                                        19 1680 88 0.000

                                                        20 1766 99 2.980

                                                        21 1852 52 -0.043

                                                        22 1938 32 -1.429

23 2024 23 2.634
 
 


 
 
Appendix B
 Program written in sh which splits text file into four smaller files containing amplitude, frequency, phase, or time.
 

#!/bin/sh

#

# File:

# filesplit <an executable shell script written in sh>

#

# Description:

# This program takes a file with four different columns containing

# the Point, Frequency, Amplitude, and Phase respectively. This program

# was designed for use in conjuncture with spectrogram.c. It was written

# by Nick Tobkin and Evan Brown for the Lovington High School New Mexico

# Supercomputer Challenge - 1998 through 1999.

#

# Syntax:

# [me@localhost](~)> /path/to/sh filesplit

#

# $ SCC: filesplit.sh, v 2.1 03/04/1999 11:51:25 tobkin Exp $

#

 

echo "\nWelcome to Filesplit!\n\n"

echo "Enter the name of the file to split: \c"

read FILE

 

if [ ! -f "$FILE" ]

then

echo "Sorry, $FILE does not exist.\n"

exit 0

fi

 

echo "\nEnter the name of the file to contain the amplitude points: \c "

read AMP

 

echo "\nEnter the name of the file to contain the frequency points: \c"

read FREQ

 

echo "\nEnter the name of the file to contain the phase values: \c"

read PHASE

 

echo "\nEnter the name of the file to contain the points values: \c"

read POINTS

 

echo "\n\n*- Please wait while the numbers are split up. -*\n"

echo "Reading amplitude points into file $AMP..."

cat $FILE | awk '{ print $2 }' > $AMP

echo "done.\n"

 

echo "Reading frequency points into file $FREQ..."

cat $FILE | awk '{ print $4 }' > $FREQ

echo "done.\n"

 

echo "Reading phase values into file $PHASE..."

cat $FILE | awk '{ print $1 }' > $PHASE

echo "done.\n"

echo "Reading points into file $POINTS..."

cat $FILE | awk '{ print $3 }' > $POINTS

echo "done.\n\n"

echo "Job Complete...\n"

echo "Now run the spectrogram program.\n"

 

exit 1

 

# EOF

 

 

 


 

 
 
Appendix C
Source from voice-identification program.

/*

* File:

* spectrogram.c

*

* Description:

* This program takes three different files with the amplitude, the

* the frequency, and the phase points/values and uses them in an FFT to

* compare the voice with others in a database. This program was designed

* and written by Nick Tobkin and Evan Brown for the Lovington High School

* New Mexico Supercomputer Challenge - 1998 through 1999.

*

* Compilation:

* [me@localhost](~)> gcc -o spectrogram spectrogram.c -lm

*

* Syntax:

* [me@localhost](~)> ./spectrogram

*

* $ SCC: spectrogram.c, v 2.1 02/17/1999 01:14:35 tobkin Exp $

*

*

*/

 

#include <stdio.h>

#include <string.h>

#include <math.h>

 

int main(void) {

 

/* Declaring some local variables. */

FILE *ampfile, *freqfile, *phasefile, *pointsfile, *nickbase, *evanbase;

char amp[15], freq[15], phase[15], points[15];

int i=0;

int ampval[120999], freqval[120999], pointsval[120999];

float phaseval[120999];

float num, total, average, nickssum, evanssum;

 

 

/* Lots of printf()'s for the banner when the program is started. */

printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

printf(" ______ \n");

printf(" / _____) _ \n");

printf("( (____ ____ _____ ____ _| |_ ____ ___ ____ ____ _____ ____ \n");

printf(" \\____ \\| _ \\| ___ |/ ___|_ _)/ ___) _ \\ / _ |/ ___|____ | \\ \n");

printf(" _____) ) |_| | ____( (___ | |_| | | |_| ( (_| | | / ___ | | | | \n");

printf("(______/| __/|_____)\\____) \\__)_| \\___/ \\___ |_| \\_____|_|_|_| \n");

printf(" |_| (_____| \n");

printf("\n\n Version 2.1 \n\n\n");

printf("Welcome to the voice analyzer program. \n\n");

printf("Instructions: \n");

printf("1. Make sure that the unknown voice has the amplitude, \n");

printf(" frequency, and phase values in different files. \n");

printf(" * Use the filesplit program for this task * \n");

printf("2. All of the values must be in the corresponding order \n");

printf(" in the files. \n\n\n");

 

 

/* The next 11 lines read the name of the various files into variables. */

printf("Name of the file containing the amplitude values of the voice: ");

scanf("%s",amp);

printf("\nName of the file containing the frequency values of the voice: ");

scanf("%s",freq);

 

printf("\nName of the file containing the phase values of the voice: ");

scanf("%s",phase);

 

printf("\nName of the file containing the point values of the voice: ");

scanf("%s",points);

 

 

/* These 4 if statements are used to find out if the file exists. */

if ((ampfile = fopen(amp,"r"))==NULL) {

printf("Cannot open the amplitude file.\n");

printf("(Maybe you mispelled the name of the file?)\n\n");

exit(2);

}

if ((freqfile = fopen(freq,"r"))==NULL) {

printf("Cannot open the frequency file.\n");

printf("(Maybe you mispelled the name of the file?)\n\n");

exit(2);

}

if ((phasefile = fopen(phase,"r"))==NULL) {

printf("Cannot open the phase file.\n");

printf("(Maybe you mispelled the name of the file?)\n\n");

exit(2);

}

 

if ((pointsfile = fopen(points,"r"))==NULL) {

printf("Cannot open the points file.\n");

printf("(Maybe you mispelled the name of the file?)\n\n");

exit(2);

}

 

 

/* The next four 'for' statements are used to read the contents */

/* of the files into arrays. */ for (i=0;i<121000;i++) {

fscanf(ampfile, "%d", &ampval[i]);

}

 

for (i=0;i<121000;i++) {

fscanf(freqfile, "%d", &freqval[i]);

}

 

for (i=0;i<121000;i++) {

fscanf(phasefile, "%g", &phaseval[i]);

}

 

for (i=0;i<121000;i++) {

fscanf(pointsfile, "%d", &pointsval[i]);

}

 

i=0;

total=0;

num=0;

 

 

/* This is the FFT equation to try and find the sumation of the voice. */

for (i=0;i<121000;i++) {

num = (ampval[i] * (cos (2 * 3.14159 * phaseval[i] * freqval[i] * pointsval[i])) + (ampval[i] * (sin (2 * 3.14159 * phaseval[i] * freqval[i] * pointsval[i])))); total = (total + num);

}

 

average = (total / 121000);

 

printf("\n\n*------------------------------------------------*");

printf("\n The sumation of the voice is: %g\n",average);

printf("*------------------------------------------------*\n\n");

 

if ((nickbase = fopen("nick.txt","r"))==NULL) {

printf("Cannot open Nick's file.\n");

exit(2);

}

if ((evanbase = fopen("evan.txt","r"))==NULL) {

printf("Cannot open Evan's file.\n");

exit(2);

}

nickssum = 0;

evanssum = 0;

 

fscanf(nickbase, "%g", &nickssum);

fscanf(evanbase, "%g", &evanssum);

 

if ((nickssum - (.00002568 * average)) <= average &&

average <= (nickssum + (.00002568* average))) { printf("The voice is Nick's.\n");

}

if ((evanssum - (.00002568 * average)) <= average &&

average <= (evanssum + (.00002568 * average))) { printf("The voice is Evan's.\n");

}

 

fclose(nickbase);

fclose(evanbase);

fclose(ampfile);

fclose(freqfile);

fclose(phasefile);

fclose(pointsfile);

 

return 0;

 

}

 

 

 

/* EOF */