简体   繁体   English

用于Java的所有音频文件

[英]AU audio files for Java

Apparently Java only plays .au audio files and I want to play mp3 files. 显然,Java只播放.au音频文件,而我想播放mp3文件。 I want to convert them to au and do not want to use any third party library to play mp3 directly. 我想将它们转换为au,并且不想使用任何第三方库直接播放mp3。 Can you please let me know how I can prepare my mp3 files to be able to play them in Java. 能否让我知道如何准备mp3文件以便能够在Java中播放它们。 (specifically I'd like to convert mp3 files to au files with a freeware software but don't know any software that is capable of doing that) (特别是我想使用免费软件将mp3文件转换为au文件,但不知道任何能够执行此操作的软件)

Is your target platform Windows only? 您的目标平台仅Windows吗? If so you might want to investigate JMF . 如果是这样,您可能想调查JMF

Otherwise, there's a nice guide here on extending JavaSound to play MP3s using MP3 SPI . 否则,这里有一个很好的指南关于如何扩展JavaSound以使用MP3 SPI播放MP3。

Overall, I'm finding your question is confusing. 总体而言,我发现您的问题令人困惑。 The act of decoding a MP3 file is to convert it to raw audio. 解码MP3文件的行为是将其转换为原始音频。 Once done there is little point in then converting it again to the AU and then using the native Java API to play it - you might as well just play it straight after it's decoded into raw audio. 一旦完成,再将其再次转换为AU,然后使用本机Java API进行播放就没什么意义了-您最好在将其解码为原始音频后直接播放。 Furthermore, if as your question implies you don't want to use third-party libraries at all, then you'll need to write your own MP3 decoder. 此外,如果您的问题暗示您根本不想使用第三方库,那么您需要编写自己的MP3解码器。

Audacity可以将MP3文件转换为AU

我相信使用sox就像这样简单:

sox input.mp3 output.au

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM