我正在用Java 做辫子。如果倒带时间,声音会向后播放。如何向后播放WAV文件?也许有像这样的流previous()?在Braid网站上,您可以看到我的意思。
previous()
更新: _ 解决! 看到我自己的帖子。_
!!!!!!
我自己解决了这个问题(14岁!!), 我写了这个课:
import java.io.IOException; import javax.sound.sampled.AudioInputStream; /** * * @author Martijn */ public class FrameBuffer { private byte[][] frames; private int frameSize; public FrameBuffer(AudioInputStream stream) throws IOException { readFrames(stream); } public byte[] getFrame(int i) { return frames[i]; } public int numberFrames() { return frames.length; } public int frameSize() { return frameSize; } private void readFrames(AudioInputStream stream) throws IOException { frameSize = stream.getFormat().getFrameSize(); frames = new byte[stream.available() / frameSize][frameSize]; int i = 0; for (; i < frames.length; i++) { byte[] frame = new byte[frameSize]; int numBytes = stream.read(frame, 0, frameSize); if (numBytes == -1) { break; } frames[i] = frame; } System.out.println("FrameSize = " + frameSize); System.out.println("Number frames = " + frames.length); System.out.println("Number frames read = " + i); } }
然后:
FrameBuffer frameStream = new FrameBuffer(austream); //austream is the audiostream int frame = frameStream.numberFrames() - 1; while (frame >= 0) { auline.write(frameStream.getFrame(frame), 0, frameStream.frameSize()); frame--; }