简体   繁体   中英

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. I have been wondering if it's possible to do the following things with Java's Sound API:

  • extract the values of individual frequencies an audio file consists of. (ex: amplitude for frequency range 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?

Thanks.

..I'm planning to create a custom audio compression format .. would creating an audio compression program be possible using Java's Sound API?

Quote from the JavaSound info. 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. 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.


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. 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.

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. (Basically, I just had to track whenever the value crossed 0, and for how long.)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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