+
+# Implement the different note names for the various languages
+def pitch_generic (pitch, notenames, accidentals):
+ str = notenames[pitch.step]
+ if pitch.alteration < 0:
+ str += accidentals[0] * (-pitch.alteration)
+ elif pitch.alteration > 0:
+ str += accidentals[3] * (pitch.alteration)
+ return str
+
+def pitch_general (pitch):
+ str = pitch_generic (pitch, ['c', 'd', 'e', 'f', 'g', 'a', 'b'], ['es', 'eh', 'ih', 'is'])
+ return str.replace ('aes', 'as').replace ('ees', 'es')
+
+def pitch_nederlands (pitch):
+ return pitch_general (pitch)
+
+def pitch_english (pitch):
+ str = pitch_generic (pitch, ['c', 'd', 'e', 'f', 'g', 'a', 'b'], ['f', 'qf', 'qs', 's'])
+ return str.replace ('aes', 'as').replace ('ees', 'es')
+
+def pitch_deutsch (pitch):
+ str = pitch_generic (pitch, ['c', 'd', 'e', 'f', 'g', 'a', 'h'], ['es', 'eh', 'ih', 'is'])
+ return str.replace ('hes', 'b').replace ('aes', 'as').replace ('ees', 'es')
+
+def pitch_norsk (pitch):
+ return pitch_deutsch (pitch)
+
+def pitch_svenska (pitch):
+ str = pitch_generic (pitch, ['c', 'd', 'e', 'f', 'g', 'a', 'h'], ['ess', '', '', 'iss'])
+ return str.replace ('hess', 'b').replace ('aes', 'as').replace ('ees', 'es')
+
+def pitch_italiano (pitch):
+ str = pitch_generic (pitch, ['do', 're', 'mi', 'fa', 'sol', 'la', 'si'], ['b', 'sb', 'sd', 'd'])
+ return str
+
+def pitch_catalan (pitch):
+ return pitch_italiano (pitch)
+
+def pitch_espanol (pitch):
+ str = pitch_generic (pitch, ['do', 're', 'mi', 'fa', 'sol', 'la', 'si'], ['b', '', '', 's'])
+ return str
+
+def pitch_vlaams (pitch):
+ str = pitch_generic (pitch, ['do', 're', 'mi', 'fa', 'sol', 'la', 'si'], ['b', '', '', 'k'])
+ return str
+
+def set_pitch_language (language):
+ global pitch_generating_function
+ function_dict = {
+ "nederlands": pitch_nederlands,
+ "english": pitch_english,
+ "deutsch": pitch_deutsch,
+ "norsk": pitch_norsk,
+ "svenska": pitch_svenska,
+ "italiano": pitch_italiano,
+ "catalan": pitch_catalan,
+ "espanol": pitch_espanol,
+ "vlaams": pitch_vlaams}
+ pitch_generating_function = function_dict.get (language, pitch_general)
+
+# global variable to hold the formatting function.
+pitch_generating_function = pitch_general
+
+