gpt4 book ai didi

java - 在java中播放和查找音频文件

转载 作者:行者123 更新时间:2023-11-30 11:52:17 26 4
gpt4 key购买 nike

我用了this播放我的 Wav 文件的类。

非常好,但是如何在某个位置(KB 或秒)开始我的 wav 文件?

auline.start();
int nBytesRead = 0;
byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];



try {
while (nBytesRead != -1) {
nBytesRead = audioInputStream.read(abData, 0, abData.length);
System.out.println("s");
if (nBytesRead >= 0)
auline.write(abData, 0, nBytesRead);
}
} catch (IOException e) {
return;
} finally {
auline.drain();
auline.close();
}

这是代码的一部分。

最佳答案

Clip(1) 可让您轻松地从需要的任何地方(以秒为单位)开始播放声音。有关示例,请参阅 JavaSound info. page 中的 Clip 代码.

  1. 特别注意。

关于java - 在java中播放和查找音频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6950626/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com