/** * Pour construire une courbe constante * * @author Ecole Polytechnique de Sophia Antipolis * @param s le syntagme associe */ public Courbe(Syntagme s) { this( s, Integer.parseInt(ConfigFile.rechercher("FREQUENCE_INIT")), -1, Integer.parseInt(ConfigFile.rechercher("HAUTEUR_PALIER"))); }
/** * Calcul du point suivant, pour une courbe de type B * * @author Ecole Polytechnique de Sophia Antipolis * @return la valeur ad'hoc */ private int valueB() { double d = (double) (xn - nbPoint); return (int) (frequenceInit + Integer.parseInt(ConfigFile.rechercher("COEFF_HAUTEUR_B")) * hauteurNiveau + coeffk * Math.pow(d, Integer.parseInt(ConfigFile.rechercher("PUISSANCE_B")))); }
/** * Calcul du point suivant, pour une courbe de type E * * @author Ecole Polytechnique de Sophia Antipolis * @return la valeur ad'hoc */ private int valueE() { return (int) (frequenceInit + Integer.parseInt(ConfigFile.rechercher("COEFF_HAUTEUR_E")) * hauteurNiveau - Integer.parseInt(ConfigFile.rechercher("COEFF_H_N-1_E")) * hauteurNiveau * (xn - 1) / (nbPoint - 1)); }
/** * Pour lire un texte court (sans ponctuation) à voix haute * * @param text, chaîne de caractères à lire à voix haute */ public void playShortText(String text) { if (!on) return; an = new Analyser(text, prosodie); Vector<Phoneme> listePhonemes = an.analyserGroupes(); s = new SynthetiseurMbrola( lt.getVoix(), ConfigFile.rechercher("REPERTOIRE_PHO_WAV"), ConfigFile.rechercher("FICHIER_PHO_WAV")); s.play(); sjoue = true; }
/** * Calcul du point suivant, pour une courbe de type C * * @author Ecole Polytechnique de Sophia Antipolis * @return la valeur ad'hoc */ private int valueC() { double r = Math.pow( (double) (xn - 1) / (nbPoint - 1), Integer.parseInt(ConfigFile.rechercher("PUISSANCE_C"))); return (int) (frequenceInit + Integer.parseInt(ConfigFile.rechercher("COEFF_HAUTEUR_C")) * hauteurNiveau - Integer.parseInt(ConfigFile.rechercher("COEFF_H_SQRT_C")) * hauteurNiveau * Math.sqrt(1 - r)); }
// appelé par loopText et playText avec valeur flagloop différente public void play(String text, boolean flagloop) { if (!on) return; an = new Analyser(text, prosodie); Vector<Phoneme> listePhonemes = an.analyserGroupes(); s = new SynthetiseurMbrola( lt.getVoix(), ConfigFile.rechercher("REPERTOIRE_PHO_WAV"), ConfigFile.rechercher("FICHIER_PHO_WAV")); // System.out.println("RAPIDITE: "+ConfigFile.rechercher("RAPIDITE")); if (flagloop) s.loop(); else s.play(); sjoue = true; }
/** * Constructeur par defaut * * @author Ecole Polytechnique de Sophia Antipolis * @param s le syntagme associe a la courbe * @param f la frequence initiale de la courbe * @param n le nombre de points utilise par la courbe * @param h la hauteur entre les 4 niveaux des courbes */ public Courbe(Syntagme s, int f, int n, int h) { synt = s; frequenceInit = f; nbPoint = n; hauteurNiveau = h; if (s.mineur()) coeffk = -(Integer.parseInt(ConfigFile.rechercher("COEFF_K_MINEUR")) * h) / Math.pow(1 - n, 2); else if (s.majeur()) coeffk = -(Integer.parseInt(ConfigFile.rechercher("COEFF_K_MAJEUR")) * h) / Math.pow(1 - n, 2); else coeffk = 0; xn = 0; }
/** * Pour fixer la voix utilisée si la synthèse parle * * @param voix, de 1 à 7 */ public void setVoix(int voix) { int vox; int nbvoix = Integer.parseInt( ConfigFile.rechercher("NBVOIX")); // nombre de voix disponibles dans ressources System.out.println(nbvoix); vox = (voix > nbvoix) ? nbvoix : voix; vox = (voix < 1) ? 1 : voix; lt.setVoix(vox); }
/** * Constructeur pour fixer la voix * * @param voix, de 1 à 7 pour fr1, fr2, ... fr7 */ public SIVOXDevint(int voix) { int vox; int nbvoix = Integer.parseInt(ConfigFile.rechercher("NBVOIX")); // nombre de voix disponibles System.out.println(nbvoix); jk = null; sjoue = false; on = true; prosodie = 3; // la meilleure prosodie vox = (voix > nbvoix) ? nbvoix : voix; vox = (voix < 1) ? 1 : voix; lt.setVoix(vox); }
/** * Pour obtenir la prochaine valeur de la courbe (iterateur) * * @author Ecole Polytechnique de Sophia Antipolis * @return l'entier correspondant */ public int nextValue() { if (xn == -1) { if (synt.finExclam()) return frequenceInit + Integer.parseInt(ConfigFile.rechercher("COEFF_EXCLAMATION")) * hauteurNiveau; else return frequenceInit + hauteurNiveau; } else { xn++; if (synt.mineur()) return valueA(); if (synt.majeur()) return valueB(); if (synt.finInterro()) return valueC(); if (synt.finExclam()) return valueE(); return valueD(); } }