Growl Hero is a Glut application
written in C++. In the main.cpp file you will find the main loop of the program. It reads all the files (sounds, transcription of the song and images), and
stores it into memory and starts the glut main loop.
The game manly takes place in the Visual.cpp file. Every sample it reads the song and synchronizes it with its transcription (the transcription is found in
a growl hero file .gh) and analyzes the signal and if it is good enough, the score will rise.
Many different objects and structures are used in Growl Hero. Here there is a list of the most relevant ones:
Features: A class to store a signal features. It can contain the Fry scream features, the Growl features, the current features, etc...
class Features {
public:
Features();
void extractFeatures(SAMPLE *buffer, SAMPLE *window);
void computeFlux( SAMPLE * prev, SAMPLE * curr);
void init();
void meanOfFeatures(Features *f);
void setGrowl();
void setFry();
void setRough();
static int getNote(double);
SAMPLE spectrum[GH_BUFFER_SIZE]; // Spectrum of the time domain signal
SAMPLE peak_spectrum[GH_BUFFER_SIZE]; // Peak Spectrum of the time domain signal
SAMPLE harmonic_spectrum[GH_BUFFER_SIZE]; // Harmonic Spectrum of the time domain signal
int nzeros; // Number of zero crossings in the time domain
float ampl; // Amplitude of the time domain signal
double pitch; // Pitch of the buffer (computed using YIN)
int note; // Note extracted from the pitch
float centroid; // Centroid of the spectrum
float mean; // Mean of the spectrum
float variance; // Variance of the spectrum
float std_dev; // Standard Deviation of the spectrum
float skewness; // Skewness of the spectrum
float noisiness;// Noisiness of the spectrum
double flux; // Flux of the current spectrum compared to the previous spectrum
bool empty; // If the features are empty or not
private:
void computeZeros(SAMPLE *buffer);
void computeAmpl(SAMPLE *buffer);
void computePitch(SAMPLE *buffer);
void computeNote();
void computeSpectrum(SAMPLE *buffer);
void computeCentroid(SAMPLE *buffer);
void computeMean(SAMPLE *buffer);
void computeVariance(SAMPLE *buffer);
void computeStdDev(SAMPLE *buffer);
void computeSkewness(SAMPLE *buffer);
void computePeakSpectrum(SAMPLE *buffer, float t);
void computeHarmonicSpectrum(SAMPLE *buffer, float t);
void computeNoisiness();
int countPeaks(SAMPLE *array, int buffer_size);
void meanOfBuffers(SAMPLE *buff1, SAMPLE *buff2);
};
Sound: A class to store read wave files in order to read them, play, stop them at any time. The sounds will be stored in the memory at all
time and the waves will only be read once in the beginning of the application.
class Sound{
public:
Sound(int nsamp); // Creator with the number of samples of the sound
~Sound(); // Destructor
void play(); // play the sound
void stop(); // stop the sound
SAMPLE read(); // read one sample of the sound
SAMPLE *buffer; // the buffer that contains the whole sound
bool playing; // bool to know if the sound is being played
private:
int length; // lenght (in samples) of the sound
int index; // the next index to be read
};
Please, refer to the source code to get more info on this. There you will find loads of explanations to follow the source code.