src/Convert-pitch.cpp
string Convert::kernToScientificPitch(const string& kerndata,
		string flat, string sharp, string separator) {
	vector<string> subtokens = Convert::splitString(kerndata);
	string output;

	for (int i=0; i<(int)subtokens.size(); i++) {
		char diatonic   = Convert::kernToDiatonicUC(subtokens[i]);
		int accidental = Convert::kernToAccidentalCount(subtokens[i]);
		int octave     = Convert::kernToOctaveNumber(subtokens[i]);
		if ((i > 0) && (i < (int)subtokens.size()-1)) {
			output += " ";
		}
		output += diatonic;
		for (int j=0; j<abs(accidental); j++) {
			output += (accidental < 0 ? flat : sharp);
		}
		output += separator;
		output += to_string(octave);
	}

	return output;
}
//////////////////////////////
//
// Convert::kernToScientificPitch -- Convert a **kern pitch to
//   ScientificPitch notation, which is the diatonic letter name,
//   followed by a possible accidental, then an optional separator
//   string, and finally the octave number.  A string representing a
//   chord can be given to this function, and the output will return
//   a list of the pitches in the chord, separated by a space.
// default value: flat      = "b"
// default value: sharp     = "#"
// default value: separator = ""
//
:kernToScientificPitch -- Convert a **kern pitch to
ScientificPitch notation, which is the diatonic letter name,
followed by a possible accidental, then an optional separator
string, and finally the octave number.  A string representing a
chord can be given to this function, and the output will return
a list of the pitches in the chord, separated by a space.
: kernToScientificPitch -- Convert a ** kern pitch to ScientificPitch notation which is the diatonic letter name followed by a possible accidental then an optional separator string and finally the octave number . A string representing a chord can be given to this function and the output will return a list of the pitches in the chord separated by a space .
string Convert::kernToScientificPitch(const string& kerndata,
		string flat, string sharp, string separator) {
	vector<string> subtokens = Convert::splitString(kerndata);
	string output;
	for (int i=0; i<(int)subtokens.size(); i++) {
		char diatonic   = Convert::kernToDiatonicUC(subtokens[i]);
		int accidental = Convert::kernToAccidentalCount(subtokens[i]);
		int octave     = Convert::kernToOctaveNumber(subtokens[i]);
		if ((i > 0) && (i < (int)subtokens.size()-1)) {
			output += " ";
		}
		output += diatonic;
		for (int j=0; j<abs(accidental); j++) {
			output += (accidental < 0 ? flat : sharp);
		}
		output += separator;
		output += to_string(octave);
	}
	return output;
}
string Convert :: kernToScientificPitch ( const string & kerndata , string flat , string sharp , string separator ) { vector < string > subtokens = Convert :: splitString ( kerndata ) ; string output ; for ( int i = 0 ; i < ( int ) subtokens . size ( ) ; i ++ ) { char diatonic = Convert :: kernToDiatonicUC ( subtokens [ i ] ) ; int accidental = Convert :: kernToAccidentalCount ( subtokens [ i ] ) ; int octave = Convert :: kernToOctaveNumber ( subtokens [ i ] ) ; if ( ( i > 0 ) && ( i < ( int ) subtokens . size ( ) - 1 ) ) { output += " " ; } output += diatonic ; for ( int j = 0 ; j < abs ( accidental ) ; j ++ ) { output += ( accidental < 0 ? flat : sharp ) ; } output += separator ; output += to_string ( octave ) ; } return output ; }
Convert::kernToScientificPitch -- Convert a **kern pitch to
ScientificPitch notation, which is the diatonic letter name,
followed by a possible accidental, then an optional separator
string, and finally the octave number.
Convert :: kernToScientificPitch -- Convert a ** kern pitch to ScientificPitch notation which is the diatonic letter name followed by a possible accidental then an optional separator string and finally the octave number .