There are certainly many things to improve in your code and I would be willing to help you step-by-step to do that. But first to your most pressing problem: Why is the playback of your notes so irregular?
From guessing, how your code might work, I would say that the problem is the 's' section in your display loop. The s-commands are responsible for the correct timing of the notes. But when you are just displaying the next 15 notes you definitely do not want wait in-between notes, but do the display as quickly as possible. So in the first s-section:
else if(s[n-1]=='s'&&stopSong==true)
{
c--;
notesChar.pop_back();
std::string NotesStr(notesChar.begin(),notesChar.end());
int Noteid=atoi(NotesStr.c_str());
XSleep(Noteid);
}
you want to remove the XSleep statement. Actually you could also remove the two lines above it.
Try that and tell us, if that brings the improvement your are looking for. Then we start to attend to the many other improvements that could be made to your code.