Changeset 2351
- Timestamp:
- 11/14/07 21:57:07 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/CapturePlayback.java
r2350 r2351 66 66 import speechrecorder.Prompts; 67 67 import speechrecorder.LabelLocalizer; 68 import java.util.regex.Matcher; 69 import java.util.regex.Pattern; 70 // !!!!!! 68 71 69 72 70 /** … … 78 76 79 77 final int bufSize = 16384; 80 // !!!!!!81 78 public static int BUFFER_SIZE = 10240; 82 79 public static final String fileType = "wav"; 83 public static final int samplingRate = 48000; 84 // public static final int samplingRate = 44100; // jre 1.4.2 only supports max of 44100 80 public static final int samplingRate = 48000;// jre 1.4.2 only supports max of 44100 85 81 public static final int samplingRateFormat = 16; 86 82 public static final int numberChannels = 1; … … 104 100 AudioFormat format = new AudioFormat(samplingRate, samplingRateFormat, numberChannels, true, false); 105 101 106 // !!!!!!107 102 Capture capture = new Capture(); 108 103 Playback playback = new Playback(); … … 112 107 AudioInputStream audioInputStream; 113 108 SamplingGraph samplingGraph; 114 109 // !!!!!! 115 110 JButton playB; 116 111 JButton captB; … … 364 359 365 360 if (prompt1 == null || prompt1.length() == 0) { 366 Prompts prompts = new Prompts(10 );361 Prompts prompts = new Prompts(10, "Dutch"); 367 362 String [][] promptArray = prompts.getPrompts(); 368 363 this.promptID1 = promptArray[0][0]; Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/Prompts.java
r2324 r2351 5 5 6 6 class Prompts { 7 String [] DefaultpromptList = { 7 String [] promptList; 8 String [] englishPromptList = { 8 9 "rp-01 When the sunlight strikes raindrops in the air,", 9 10 "rp-02 they act as a prism and form a rainbow.", … … 1225 1226 "b0538 At the best, they were necessary accessories." , 1226 1227 "b0539 You were making them talk shop, Ruth charged him." 1227 1228 1228 }; 1229 String [] dutchPromptList = { 1230 "nl001 De aanbesteding die algemeen bekend wordt gemaakt", 1231 "nl002 Alle ondernemers mogen inschrijven.", 1232 "nl003 Nederlands is een prachtige taal.", 1233 "nl004 De bestuurlijke en de strafrechtelijke handhaving staan naast elkaar.", 1234 "nl005 Zij hebben elk een eigen functie.", 1235 "nl006 Wilt u contant betalen of pinnen?", 1236 "nl007 Die kennis is ook nodig op de terechtzitting.", 1237 "nl008 Waarom brengt het openbaar ministerie juist deze zaak aan.", 1238 "nl009 Waarom is juist deze straf nodig?", 1239 "nl010 Dat genre schilderijen vind ik mooi.", 1240 "nl011 Onze bijdrage was een druppel op een gloeiende plaat.", 1241 "nl012 Peter lijkt goed op dreef te zijn.", 1242 "nl013 Met deze circulaire is rekening gehouden.", 1243 "nl014 Er waren uiteenlopende standpunten.", 1244 "nl015 De storm heeft een enorme ravage aangericht.", 1245 "nl016 Hiermee is voldaan aan de wens van het bedrijfsleven.", 1246 "nl017 Er is geen bindende regeling tot stand gebracht", 1247 "nl018 Ik heb de opdracht aanvaard.", 1248 "nl019 Het oog van de meester maakt het paard vet.", 1249 "nl020 Er wordt al jaren gewerkt aan de harmonisatie van de methoden.", 1250 "nl021 Victor was in gepeins verzonken.", 1251 "nl022 Willem liegt altijd of het gedrukt staat.", 1252 "nl023 Dat geldt voor bepaalde buitenlandse instellingen", 1253 "nl024 Ze kwam geruisloos binnen.", 1254 "nl025 Alle instellingen in de intramurale gezondheidszorg,", 1255 }; 1229 1256 String [][] promptSubset; 1230 1257 1231 public Prompts(int NumberofPrompts) { 1258 public Prompts(int NumberofPrompts, String Language) { 1259 if (Language == "English") { 1260 promptList = englishPromptList; 1261 } else if (Language == "Dutch") { 1262 promptList = dutchPromptList; 1263 } else { 1264 promptList = englishPromptList; 1265 } 1266 1232 1267 promptSubset = new String [2][NumberofPrompts]; 1233 1268 1234 1269 Random randomGenerator = new Random(); 1235 int arrayLength = DefaultpromptList.length - 1;1270 int arrayLength = promptList.length - 1; 1236 1271 int nextPrompt = randomGenerator.nextInt(arrayLength); 1237 1272 for (int idx=0;idx<NumberofPrompts; idx++) { … … 1254 1289 StringBuffer prompt = new StringBuffer(); 1255 1290 1256 StringTokenizer st = new StringTokenizer( DefaultpromptList[nextPrompt]);1291 StringTokenizer st = new StringTokenizer(promptList[nextPrompt]); 1257 1292 String [] words= new String [st.countTokens()]; 1258 1293 int i = 0;