Sun、音频播放器和声音 I/O [英] Sun, Audio-player and Sound I/O

查看:27
本文介绍了Sun、音频播放器和声音 I/O的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个关于 Sun、音频播放器和声音输入/输出的问题

为什么 sun.audio.AudioPlayer 包不是 Java API 的一部分?这里有一些信息:http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6b14/sun/audio/AudioPlayer.java 但它仍然是我的默认 JDK 构建的一部分使用.

我曾尝试使用 JMF,并花了半天的时间用它四处乱搞,但无济于事.我设法将 jmf.jar 导入 Eclipse 我尝试了一个演示脚本,但它仍然像没有人一样吐出错误.考虑到它现在被放弃了?!?然而,Java 确实提供了一个相对较新版本的链接:http://www.oracle.com/technetwork/java/javase/download-142937.html 我有点担心但是页面底部怎么写着false,,,,,,,"?>

您认为用于音频 I/O 和操作的最佳软件包是什么?

我只想从事一个项目,我认为 MP3 播放器是一个不错的起点,因为我可以做一些摆动.然而,从我所读到的内容来看,这似乎相当困难,Java 并不是很热衷于制作 mp3 和音频处理包.

解决方案

sun.audio is undocumented

像其他 sun.* 包一样,它没有记录,可能会消失.

Java 媒体框架很旧

这是一个可选包,不是 SE 的一部分,并且已经很长时间没有更新了.Oracle 有一个页面,它仍然可用,但是,谁知道会发生什么.

javax.sound 是 SE 的一部分

这是当前的 Java 声音实现,它是 SE 的一部分,可以找到它的教程 此处.如果您想在 Java 中使用音频,这是您应该学习的内容,因为它是官方的、有效的、有时会更新并且文档齐全.

javax.sound 不播放 mp3

这是为什么?尽管在文件系统中无处不在,mp3 仍有许可和专利问题的历史.Mp3 是一个雷区,这可能是 Sun/Oracle 没有努力支持它的原因.(如果这就是原因,我不怪他们.)

如果你真的想播放 mp3,网上有一些第三方解码器.推荐一个是没有意义的,因为他们都会读mp3.

<小时>

JavaFX 可以播放 mp3

使用 javafx.scene.media.MediaPlayer.请参阅javafx.scene.媒体/支持的媒体类型.JavaFX 是 Java 8(和 Java 7 的新版本)的 JRE/JDK 的一部分,并将(可能)最终取代几个 SE API,如 javax.soundjavax.swing.

I have a few questions related to Sun, Audio-player and Sound Input/Output

Why is the sun.audio.AudioPlayer package not part of the Java API? Some info is here instead: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6b14/sun/audio/AudioPlayer.java Yet it is still part of the default JDK build I am using.

I have tried using JMF and spent half the day screw balling around with it, to no real avail. I managed to import the jmf.jar into Eclipse I tried a demo script and it still spat out errors like nobody business. Considering its abandoned now?!? Java does however provide a link for a relatively new version: http://www.oracle.com/technetwork/java/javase/download-142937.html I am a little concerned however how at the bottom of the page the following is written "false,,,,,,,"?

Whats the best package to use for audio I/O and manipulation in your opinion?

I just want to work on a project and I though an MP3 player would be a nice place to start as I can do a little swing. However it seems to be rather difficult as from what I have read Java is not really very keen on making mp3 and audio manipulation packages.

解决方案

sun.audio is undocumented

Like other sun.* packages, it is undocumented and it might disappear.

Java Media Framework is old

It's an optional package, not part of the SE and hasn't been updated in a long time. Oracle has a page on it and it's still available but, well, who knows what will happen to it.

javax.sound is part of the SE

This is the current Java sound implementation, it is part of the SE and the tutorial for it can be found here. If you want to use audio in Java this is what you should learn because it's official, it works, it gets updated sometimes and it is well-documented.

javax.sound does not play mp3

Why is that? Despite being ubiquitous in file systems, mp3 has a history of licensing and patent issues. Mp3 is a minefield and this may be why Sun/Oracle has not put effort in to supporting it. (If this is why, I don't blame them.)

If you really want to play mp3 there are some third-party decoders floating around on the web. There is no point in recommending one because all of them will read mp3.


JavaFX does play mp3

Use a javafx.scene.media.MediaPlayer. See javafx.scene.media/Supported Media Types. JavaFX is part of the JRE/JDK as of Java 8 (and new versions of Java 7) and will (probably) eventually supersede several SE APIs like javax.sound and javax.swing.

这篇关于Sun、音频播放器和声音 I/O的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆