播放和寻求在java中音频文件 [英] Play and Seek Audio File in java
本文介绍了播放和寻求在java中音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用这个类来发挥我的Wav文件。
I used this class to play my Wav file.
它非常好,但如何开始在一些位置上我的WAV文件(KB或第二)?
Its very good but How to start my wav file on some position (KB or second)?
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();
}
这是code的一部分。
This is part of the code.
推荐答案
A 剪辑
(1)可以很容易地启动一个声音从任何需要的(以秒为单位) 。举一个例子看到剪辑
code在 JavaSound信息。页。
A Clip
(1) makes it easy to start a sound from wherever is needed (in seconds). For an example see the Clip
code in the JavaSound info. page.
- 尤见。
- Clip.setMicrosecondPosition(长)。的设置在微秒媒体的地位。的
- Clip.setFramePosition(INT)的设置以示例帧的媒体地位。的
- Clip.setLoopPoints(INT,INT)。的设置将在循环中播放的第一个和最后一个示例帧。的
- See especially.
- Clip.setMicrosecondPosition(long). "Sets the media position in microseconds."
- Clip.setFramePosition(int) "Sets the media position in sample frames."
- Clip.setLoopPoints(int,int). "Sets the first and last sample frames that will be played in the loop."
这篇关于播放和寻求在java中音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文