public OneOCEAN(OneOCEAN ocean) { this.openness = ocean.openness; this.conscientiousness = ocean.conscientiousness; this.extraversion = ocean.extraversion; this.agreeableness = ocean.agreeableness; this.neuroticism = ocean.neuroticism; }
public void SetTone(OneOCEAN ocean) { float O = ocean.openness; float C = ocean.conscientiousness; float E = ocean.extraversion; float A = ocean.agreeableness; float N = ocean.neuroticism; sp_pitch = (int)(((O + (C + E) / 2 - (A + N) / 2) / 3) * 80f); sp_pitchRange = (int)((O + E) / 2 * 100f); sp_rate = (int)((-O - C + E - A) / 4 * 70f); sp_breathiness = (int)((A + O) / 2 * 50f); sp_glottalTension = (int)((C - O - A) / 3 * 100f); Debug.Log("Setting tone: " + O + " " + C + " " + E + " " + A + " " + N + " "); }
public void SetSaveToneForCase(OneOCEAN oo, string txt, string fname, StreamWriter writer) { int i = -1; if (oo.openness == 1) { i = 0; } else if (oo.openness == -1) { i = 1; } else if (oo.conscientiousness == 1) { i = 2; } else if (oo.conscientiousness == -1) { i = 3; } else if (oo.extraversion == 1) { i = 4; } else if (oo.extraversion == -1) { i = 5; } else if (oo.agreeableness == 1) { i = 6; } else if (oo.agreeableness == -1) { i = 7; } else if (oo.neuroticism == 1) { i = 8; } else if (oo.neuroticism == -1) { i = 9; } switch (i) { case 0: // O+ sp_pitch = 60; sp_pitchRange = 100; sp_rate = 0; sp_breathiness = 20; sp_glottalTension = -40; break; case 1: // O- sp_pitch = -50; sp_pitchRange = -100; sp_rate = 30; sp_breathiness = -40; sp_glottalTension = 70; break; case 2: // C+ sp_pitch = -30; sp_pitchRange = -20; sp_rate = -60; sp_breathiness = 20; sp_glottalTension = -20; break; case 3: // C- sp_pitch = -80; sp_pitchRange = -80; sp_rate = 30; sp_breathiness = 0; sp_glottalTension = -80; break; case 4: // E+ sp_pitch = 80; sp_pitchRange = 100; sp_rate = 40; sp_breathiness = -20; sp_glottalTension = 50; break; case 5: // E- sp_pitch = -10; sp_pitchRange = -20; sp_rate = -30; sp_breathiness = 20; sp_glottalTension = -10; break; case 6: // A+ sp_pitch = -90; sp_pitchRange = 10; sp_rate = -20; sp_breathiness = 50; sp_glottalTension = -40; break; case 7: // A- sp_pitch = 0; sp_pitchRange = -20; sp_rate = 30; sp_breathiness = -60; sp_glottalTension = 60; break; case 8: // N+ sp_pitch = 10; sp_pitchRange = -70; sp_rate = 10; sp_breathiness = -40; sp_glottalTension = 80; break; case 9: // N- sp_pitch = 0; sp_pitchRange = 10; sp_rate = -10; sp_breathiness = 20; sp_glottalTension = -20; break; } /* * sp_pitch = 0; * sp_pitchRange = 0; * sp_rate = 0; * sp_breathiness = 0; * sp_glottalTension = 0; */ string pri = "<speak version=\"1.0\">"; pri += "<voice-transformation type=\"Custom\" pitch=\" " + sp_pitch + " % \" pitch_range =\"" + sp_pitchRange + " % \" rate =\"" + sp_rate + " % \" breathiness =\"" + sp_breathiness + " % \" glottal_tension =\" " + sp_glottalTension + " % \" >"; pri += txt; pri += "</voice-transformation>" + "</speak>"; writer.WriteLine(pri); writer.WriteLine(fname); writer.WriteLine(); }