简体   繁体   English

关于Java Sound API的一些问题

[英]Some Questions About the Java Sound API

I'm relatively new here and to the usage of Java's Sound API and audio programming altogether. 在这里,以及Java的Sound API和音频编程的使用,我还是一个新手。 I have been wondering if it's possible to do the following things with Java's Sound API: 我一直在想,是否可以使用Java的Sound API进行以下操作:

  • extract the values of individual frequencies an audio file consists of. 提取音频文件所包含的各个频率的值。 (ex: amplitude for frequency range 20Hz-20kHz) (例如:频率范围20Hz-20kHz的振幅)
  • based on those values, perform manipulations, then write a new modified audio file. 根据这些值,执行操作,然后编写新的修改后的音频文件。

If you're wondering why I'm asking these, I'm planning to create a custom audio compression format with the use of a swarm-based optimization algorithm. 如果您想知道为什么要问这些问题,我打算使用基于群的优化算法来创建自定义音频压缩格式。 So for those who can give a more straightforward answer: would creating an audio compression program be possible using Java's Sound API? 因此,对于那些可以给出更直接答案的人:使用Java的Sound API可以创建音频压缩程序吗?

Thanks. 谢谢。

..I'm planning to create a custom audio compression format .. would creating an audio compression program be possible using Java's Sound API? ..我打算创建自定义音频压缩格式。.使用Java的Sound API可以创建音频压缩程序吗?

Quote from the JavaSound info. 引用JavaSound信息。 page here at SO. 此处的页面。

Service Provider Interface 服务提供商接口

The Java Sound API uses a Service Provider Interface to identify encoders & decoders for sound formats and sequence types. Java Sound API使用服务提供者接口来标识声音格式和序列类型的编码器和解码器。 This way, adding support for a new format or type is as simple as providing a decoder and/or encoder for it, adding an SPI file to the manifest of the Jar it is in, then adding the Jar to the run-time class-path of the application. 这样,添加对新格式或新类型的支持非常简单,只需为其提供解码器和/或编码器,即可将SPI文件添加到其所在的Jar清单中,然后将Jar添加至运行时类-应用程序的路径。


So if you can provide the encoder/decoder, then yes. 因此,如果您可以提供编码器/解码器,则可以。

You can certainly read the waveforms. 您当然可以读取波形。 IE, for a 44.1 kHz file, you could read 44,100 different sample values per second. IE,对于44.1 kHz的文件,您每秒可以读取44,100个不同的采样值。 I don't know that the Java Sound API will calculate audio frequencies for you, but if you're already going to be performing manipulations, you can probably calculate whatever you need yourself. 我不知道Java Sound API会为您计算音频频率,但是如果您已经在执行操作,则可能可以计算所需的任何内容。

A few years back, I had used something along these lines to decode a suspect SMPTE time code signal, printing out the various bits and fields. 几年前,我沿这些路线使用了一些东西来解码可疑的SMPTE时间码信号,并打印出各个位和字段。 (Basically, I just had to track whenever the value crossed 0, and for how long.) (基本上,我只需要跟踪值何时越过0以及持续多长时间。)

In short, yes, creating an audio compression program would certainly be possible - though I know many people who would be surprised at the choice to do this in Java. 简而言之,是的,创建音频压缩程序当然是可能的-尽管我知道很多人会对使用Java进行选择感到惊讶。

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

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