BowlerKernel
AudioStatus.java
Go to the documentation of this file.
1 package com.neuronrobotics.bowlerstudio;
2 
3 import java.util.EnumSet;
4 import java.util.HashMap;
5 import java.util.Map;
6 import java.util.Set;
15 public enum AudioStatus {
16  /*
17  * Closed mouth for the “P”, “B”, and “M” sounds. This is almost identical to
18  * the Ⓧ shape, but there is ever-so-slight pressure between the lips.
19  */
21  /*
22  * Slightly open mouth with clenched teeth. This mouth shape is used for most
23  * consonants (“K”, “S”, “T”, etc.). It’s also used for some vowels such as the
24  * “EE” sound in bee.
25  */
27  /*
28  * Open mouth. This mouth shape is used for vowels like “EH” as in men and “AE”
29  * as in bat. It’s also used for some consonants, depending on context.
30  *
31  * This shape is also used as an in-between when animating from Ⓐ or Ⓑ to Ⓓ. So
32  * make sure the animations ⒶⒸⒹ and ⒷⒸⒹ look smooth!
33  */
35  /*
36  * Wide open mouth. This mouth shapes is used for vowels like “AA” as in father.
37  */
39  /*
40  * Slightly rounded mouth. This mouth shape is used for vowels like “AO” as in
41  * off and “ER” as in bird.
42  *
43  * This shape is also used as an in-between when animating from Ⓒ or Ⓓ to Ⓕ.
44  * Make sure the mouth isn’t wider open than for Ⓒ. Both ⒸⒺⒻ and ⒹⒺⒻ should
45  * result in smooth animation.
46  */
48  /*
49  * Puckered lips. This mouth shape is used for “UW” as in you, “OW” as in show,
50  * and “W” as in way.
51  */
53  /*
54  * Upper teeth touching the lower lip for “F” as in for and “V” as in very.
55  *
56  * This extended mouth shape is optional. If your art style is detailed enough,
57  * it greatly improves the overall look of the animation. If you decide not to
58  * use it, you can specify so using the extendedShapes option.
59  */
61  /*
62  * This shape is used for long “L” sounds, with the tongue raised behind the
63  * upper teeth. The mouth should be at least far open as in Ⓒ, but not quite as
64  * far as in Ⓓ.
65  *
66  * This extended mouth shape is optional. Depending on your art style and the
67  * angle of the head, the tongue may not be visible at all. In this case, there
68  * is no point in drawing this extra shape. If you decide not to use it, you can
69  * specify so using the extendedShapes option.
70  */
71  H_L_SOUNDS('H'),
72  /*
73  * Idle position. This mouth shape is used for pauses in speech. This should be
74  * the same mouth drawing you use when your character is walking around without
75  * talking. It is almost identical to Ⓐ, but with slightly less pressure between
76  * the lips: For Ⓧ, the lips should be closed but relaxed.
77  *
78  * This extended mouth shape is optional. Whether there should be any visible
79  * difference between the rest position Ⓧ and the closed talking mouth Ⓐ depends
80  * on your art style and personal taste. If you decide not to use it, you can
81  * specify so using the extendedShapes option.
82  */
83  X_NO_SOUND('X'),
84 
85  // User defined visemes
91 
92  private static final Map<Character, AudioStatus> lookup = new HashMap<>();
93  private static Map<String, AudioStatus> ArpabetToBlair;
94 
95  static {
96  for (AudioStatus s : EnumSet.allOf(AudioStatus.class))
97  lookup.put(s.parsed, s);
98  ArpabetToBlair = new HashMap<>();
99  ArpabetToBlair.put("-", AudioStatus.X_NO_SOUND);
100  ArpabetToBlair.put("aa", AudioStatus.D_AA_SOUNDS);
101  ArpabetToBlair.put("ae", AudioStatus.D_AA_SOUNDS);
102  ArpabetToBlair.put("ah", AudioStatus.D_AA_SOUNDS);
103  ArpabetToBlair.put("ao", AudioStatus.D_AA_SOUNDS);
104  ArpabetToBlair.put("aw", AudioStatus.D_AA_SOUNDS);
105  ArpabetToBlair.put("ax", AudioStatus.D_AA_SOUNDS);
106  ArpabetToBlair.put("ay", AudioStatus.C_EH_AE_SOUNDS);
107  ArpabetToBlair.put("b", AudioStatus.A_PBM_SOUNDS);
108  ArpabetToBlair.put("bl", AudioStatus.A_PBM_SOUNDS);
109  ArpabetToBlair.put("ch", AudioStatus.B_KST_SOUNDS);
110  ArpabetToBlair.put("d", AudioStatus.B_KST_SOUNDS);
111  ArpabetToBlair.put("dx", AudioStatus.B_KST_SOUNDS);
112  ArpabetToBlair.put("dh", AudioStatus.B_KST_SOUNDS);
113  ArpabetToBlair.put("eh", AudioStatus.D_AA_SOUNDS);
114  ArpabetToBlair.put("em", AudioStatus.D_AA_SOUNDS);
115  ArpabetToBlair.put("el", AudioStatus.D_AA_SOUNDS);
116  ArpabetToBlair.put("en", AudioStatus.D_AA_SOUNDS);
117  ArpabetToBlair.put("eng", AudioStatus.D_AA_SOUNDS);
118  ArpabetToBlair.put("er", AudioStatus.D_AA_SOUNDS);
119  ArpabetToBlair.put("ey", AudioStatus.C_EH_AE_SOUNDS);
120  ArpabetToBlair.put("f", AudioStatus.G_F_V_SOUNDS);
121  ArpabetToBlair.put("g", AudioStatus.B_KST_SOUNDS);
122  ArpabetToBlair.put("hh", AudioStatus.B_KST_SOUNDS);
123  ArpabetToBlair.put("ih", AudioStatus.D_AA_SOUNDS);
124  ArpabetToBlair.put("iy", AudioStatus.C_EH_AE_SOUNDS);
125  ArpabetToBlair.put("jh", AudioStatus.B_KST_SOUNDS);
126  ArpabetToBlair.put("k", AudioStatus.B_KST_SOUNDS);
127  ArpabetToBlair.put("l", AudioStatus.H_L_SOUNDS);
128  ArpabetToBlair.put("m", AudioStatus.A_PBM_SOUNDS);
129  ArpabetToBlair.put("n", AudioStatus.B_KST_SOUNDS);
130  ArpabetToBlair.put("ng", AudioStatus.B_KST_SOUNDS);
131  ArpabetToBlair.put("nx", AudioStatus.B_KST_SOUNDS);
132  ArpabetToBlair.put("ow", AudioStatus.F_UW_OW_W_SOUNDS);
133  ArpabetToBlair.put("oy", AudioStatus.F_UW_OW_W_SOUNDS);
134  ArpabetToBlair.put("p", AudioStatus.A_PBM_SOUNDS);
135  ArpabetToBlair.put("q", AudioStatus.F_UW_OW_W_SOUNDS);
136  ArpabetToBlair.put("r", AudioStatus.B_KST_SOUNDS);
137  ArpabetToBlair.put("s", AudioStatus.B_KST_SOUNDS);
138  ArpabetToBlair.put("sh", AudioStatus.B_KST_SOUNDS);
139  ArpabetToBlair.put("t", AudioStatus.B_KST_SOUNDS);
140  ArpabetToBlair.put("th", AudioStatus.B_KST_SOUNDS);
141  ArpabetToBlair.put("uh", AudioStatus.D_AA_SOUNDS);
142  ArpabetToBlair.put("uw", AudioStatus.F_UW_OW_W_SOUNDS);
143  ArpabetToBlair.put("v", AudioStatus.G_F_V_SOUNDS);
144  ArpabetToBlair.put("w", AudioStatus.F_UW_OW_W_SOUNDS);
145  ArpabetToBlair.put("y", AudioStatus.B_KST_SOUNDS);
146  ArpabetToBlair.put("z", AudioStatus.B_KST_SOUNDS);
147  ArpabetToBlair.put("zh", AudioStatus.B_KST_SOUNDS);
148 
149 
150  //rhubarb docs
156 
157 
158  //fn opinion
163 
167 
171  }
172  public final char parsed;
173 
174  public static AudioStatus get(char code) {
175  return lookup.get(code);
176  }
177  public static AudioStatus get(String code) {
178  return lookup.get((char)code.getBytes()[0]);
179  }
180  public static AudioStatus getFromPhoneme(String code) {
181  return ArpabetToBlair.get(code);
182  }
183  public static Set<String> getPhonemes() {
184  return ArpabetToBlair.keySet();
185  }
186 
187  public double mouthOpenVector() {
188  switch(this) {
189  case B_KST_SOUNDS:
190  return 0.3;
191  case C_EH_AE_SOUNDS:
192  return 0.6;
193  case D_AA_SOUNDS:
194  return 1;
195  case E_AO_ER_SOUNDS:
196  return 0.6;
197  case F_UW_OW_W_SOUNDS:
198  return 0.2;
199  case G_F_V_SOUNDS:
200  return 0.1;
201  case H_L_SOUNDS:
202  return 0.9;
203  case A_PBM_SOUNDS:
204  return 0.05;
205  case X_NO_SOUND:
206  default:
207  break;
208  }
209  return 0;
210  }
211 
212  public boolean isOpen() {
213  switch(this) {
214  case B_KST_SOUNDS:
215  case C_EH_AE_SOUNDS:
216  case D_AA_SOUNDS:
217  case E_AO_ER_SOUNDS:
218  case H_L_SOUNDS:
219  return true;
220 
221  }
222  return false;
223  }
224 
225  AudioStatus(char self) {
226  parsed = self;
227  }
228 }
static AudioStatus get(char code)
static Map< String, AudioStatus > ArpabetToBlair
static AudioStatus getFromPhoneme(String code)