Saturday, January 24, 2009

You gotta know when to fold 'em

I've decided to cut my losses and abandon production of "Rap Hero." I think having the player type in rap lyrics then having a robotic voice echo them back is an interesting concept but it'd take a lot of work to get the game to the point where the average user would want to play it.

I still think hearing a robotic speech synthesis voice rap is funny, but it's hard to make a game around it. I was planning on doing something with regular expressions to determine if the player's lyrics rhyme, but I got frustrated before I got around to it.

The most frustrating part is that all the speech synthesis engines I found were for Linux. For me, I have to put a lot more effort into getting what I want than I do on Windows. Having years and years more experience with Windows might be the reason for that.

Here's my code if you're interested in playing that game (you're going to have to compile it yourself [yay linux!]). You need eSpeak and its library installed.

//============================================================================
// Name : eSpeak1.cpp
// Author :
// Version :
// Copyright :
// Description :
//============================================================================

#include
#include "espeak/speak_lib.h"
#include
using namespace std;

int main() {

const int SONG_LENGTH = 2;

string buffer_string;
string song[2];
//string blanks = "________";
string whole_song;
bool quit = false;
//char garabage;

// string myString = "We used poisonous gases. We poisoned their asses.";
//int synth_flags = espeakCHARS_AUTO | espeakPHONEMES;

espeak_Initialize(AUDIO_OUTPUT_SYNCH_PLAYBACK, 100, NULL, 0);

//espeak_SetSynthCallBack(SynthCallback);

//espeak_Synth(myString.c_str(), myString.length(), 0, POS_SENTENCE , 0, 0, NULL, NULL);

espeak_Synchronize();

song[0] = "Yo! Yo! I got a taste for expensive things \n like fast cars and ";

song[1] = "Pull my sleeve to flash my rolex \n all the fly honeys call me ";



cout << "**** Welcome to Rap Hero! *****\n";
cout << "A line of lyrics will appear on the screen. \n";
cout << "You need to type in the end of the next line to make it rhyme with the previous. \n";
cout << "At the end, your rap will be played back so you can hear it. \n \n \n \n";
//cin >> garabage;


for( int i = 0; i < SONG_LENGTH; i++)
{
cout << song[i];
cout << "\n";
getline(cin, buffer_string);
//song[i] += buffer_string;
//cout << song[1];
whole_song += song[i];
whole_song += buffer_string;
whole_song += "\n";
}



cout << whole_song;

espeak_Synth(whole_song.c_str(), whole_song.length(), 0, POS_SENTENCE , 0, 0, NULL, NULL);

//cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}

No comments:

Post a Comment