当前位置: 技术问答>java相关
请问如何用java.sound api 读取 .vox 文件并转换为 .wav格式的??
来源: 互联网 发布时间:2017-04-04
本文导语: 以前看到过一篇文章 写的是可以用以流形式读入,并按.vox的格式解析,然后以.wav的格式写出即可,好像说得很容易,但不知道如何具体操作。。。 | 这个程序是我从网上找的,你看看,可...
以前看到过一篇文章 写的是可以用以流形式读入,并按.vox的格式解析,然后以.wav的格式写出即可,好像说得很容易,但不知道如何具体操作。。。
|
这个程序是我从网上找的,你看看,可以用applet播放.wav文件的
import java.awt.*;
import java.applet.AudioClip;
public class Looper extends javax.swing.JApplet implements Runnable {
AudioClip bgSound;
AudioClip beep;
Thread runner;
public void init() {
bgSound = getAudioClip(getCodeBase(),"雪中莲.wav");
beep = getAudioClip(getCodeBase(), "雪中莲.wav");
}
public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
if (bgSound != null)
bgSound.stop();
runner = null;
}
}
public void run() {
if (bgSound != null)
bgSound.loop();
Thread thisThread = Thread.currentThread();
while (runner == thisThread) {
try {
Thread.sleep(9000);
if (beep != null)
beep.play();
} catch (InterruptedException e) { }
}
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D)screen;
screen2D.drawString("Playing Sounds ...", 10, 10);
}
}
import java.awt.*;
import java.applet.AudioClip;
public class Looper extends javax.swing.JApplet implements Runnable {
AudioClip bgSound;
AudioClip beep;
Thread runner;
public void init() {
bgSound = getAudioClip(getCodeBase(),"雪中莲.wav");
beep = getAudioClip(getCodeBase(), "雪中莲.wav");
}
public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
if (bgSound != null)
bgSound.stop();
runner = null;
}
}
public void run() {
if (bgSound != null)
bgSound.loop();
Thread thisThread = Thread.currentThread();
while (runner == thisThread) {
try {
Thread.sleep(9000);
if (beep != null)
beep.play();
} catch (InterruptedException e) { }
}
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D)screen;
screen2D.drawString("Playing Sounds ...", 10, 10);
}
}
|
up
&
qing jiao
&
qing jiao
|
watch
|
sun