0
我的目标是播放短语“This is a test”的双重音(双),它是一个WAV音频文件。到目前为止,我成功地生成了一个随机的短语序列,例如“Test is this a”,但我需要使它只能成对发言,所以“This is”...“是...”每个单词之间暂停100米,每对之间暂停400毫秒。这是我迄今为止...在Sound Arrays中随机播放单词
public void playDoublets(int numDoublets) throws InterruptedException {
ArrayList<Sound> list = new ArrayList();
for (int i =0; i < numWords; i++){
list.add(new Sound(myWordArray[i]));
}
Collections.shuffle(list);
for (int i = 0; i < numWords; i++){
list.get(i).blockingPlay();
Thread.sleep(400);
}
}
numDoublets是程序有多少双剧本,但我不知道我会在代码中实现它上面。所有这些代码到目前为止只是打印出所有4个单词,但不是成对的。
非常棒的解决方案,但在这个任务中,我不允许创建接口,我必须使用他们提供给我的类/方法。如果您需要更多信息,请告诉我, – TheDkmariolink