Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bowbahdoe/java-audio-stack
Repackaged and modularized com.googlecode.soundlibs libraries
https://github.com/bowbahdoe/java-audio-stack
Last synced: 7 days ago
JSON representation
Repackaged and modularized com.googlecode.soundlibs libraries
- Host: GitHub
- URL: https://github.com/bowbahdoe/java-audio-stack
- Owner: bowbahdoe
- License: lgpl-3.0
- Created: 2023-10-19T14:09:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-19T14:13:22.000Z (7 months ago)
- Last Synced: 2024-04-19T15:32:18.983Z (7 months ago)
- Language: Java
- Homepage:
- Size: 471 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java Audio Stack
Apologies for the repo name. I know it's pretty generic, but in my defense the other
repo which does something similar is just called [soundlibs](https://github.com/pdudits/soundlibs)
so there is some precedent.## Usage
Most people will just want to include the artifacts for `mp3spi` and/or `vorbisspi`.
```xml
dev.mccue
mp3spi
2024.04.19```
```xml
dev.mccue
vorbisspi
2024.04.19```
From there, load up an audio file. [There are a bunch of old tutorials online for that](https://odoepner.wordpress.com/2013/07/19/play-mp3-or-ogg-using-javax-sound-sampled-mp3spi-vorbisspi/).
If you are using the module system, all the modules here are under `dev.mccue`, so
you would do the following.```java
module example {
requires dev.mccue.mp3spi;
requires dev.mccue.vorbisspi;
}
```## What is this
There are two audio libraries that pop up as dependencies relatively often. `mp3spi` and `vorbisspi`.
These provide the ability for the [Java Sound API](https://www.oracle.com/java/technologies/java-sound-api.html)
to play MP3 and OGG files.The history of those libraries is a bit fuzzy to me, but from what I know at this point
* They were originally made as part of the "tritonus" project, which was an open source implementation
of the Java sound APIs for linux.
* At some point later they were bundled up and published to maven central under the group [com.googlecode.soundlibs](https://central.sonatype.com/search?q=g%3Acom.googlecode.soundlibs)
and those artifacts are still managed by the folks under the [soundlibs](https://github.com/pdudits/soundlibs) repo.This is, for better or worse, just a repackaging of those libraries.
I *did* make some changes that you might consider important.
* Any usages of the security manager have been removed. This is deprecated for removal so there is potentially a future
Java version where bytecode that references security manager classes is problematic.
* I removed calls to `new Integer` and other methods that have been deprecated for removal
* I split the `jlayer` dependency that underlies `mp3spi` into three submodules. This means the core of
`jlayer-decoder` which parses MP3 files is available without a dependence on `java.desktop`. This was already
done by the [libGDX](https://github.com/libgdx/jlayer-gdx) people - I assume for a similar desire.
* I split `jorbis` into `jogg` and `jorbis`.
* Everything now has a proper module-info. If everything in your dependency tree has a module-info you can
use `jlink` and `jpackage` to bundle up your app without extra configuration.
* Everything has been repackaged. This solves [some of the issues](https://github.com/pdudits/soundlibs/issues/14)
that the original repo faces with respect to modularization. It also means that if you end up with both this
and the original libraries in your project it isn't the end of the world.
* Minimum compatibility has been bumped to Java 17. If you care about the module system at all,
chances are you are making an app on a newer JDK too.Best I can tell, there isn't much merit to using the [tritonus](https://www.tritonus.org/)
implementation of the [Java Sound API](https://www.oracle.com/java/technologies/java-sound-api.html) now that the JDK
is open source. I assume that providing an open source version was the original raison d'être. So I did not repackage
the `tritonus-all` dependency.Both `mp3spi` and `vorbisspi` depend on a set of classes that came from `tritonus-share`, so it was easiest to make
that its own module.The graph of dependencies for the original set of libraries looks like this.
```mermaid
graph TD
Z[java.desktop]
A[mp3spi]
Z --> A
D --> A
C --> AB[vorbisspi]
E --> B
C --> B
Z --> BC[tritonus-share]
Z --> CD[jlayer]
Z --> D
E[jorbis]
```With the changes in this the graph looks like this.
```mermaid
graph TD
desktop[java.desktop]
trit[tritonus-share]
desktop --> tritjc[jlayer-converter]
jd --> jcjd[jlayer-decoder]
jp[jlayer-player]
desktop --> jp
jd --> jp
jc --> jp
j[jlayer]
jc --> j
jd --> j
jp --> jjorbis[jorbis]
jogg --> jorbisjogg[jogg]
mp3spi[mp3spi]
desktop --> mp3spi
jd --> mp3spi
trit --> mp3spivorbisspi[vorbisspi]
desktop --> vorbisspi
jorbis --> vorbisspi
jogg --> vorbisspi
trit --> vorbisspi
```Which is a lot more confusing to look at, but the big difference is
that `jlayer-player`, `jlayer-converter`, and `jlayer` no longer are part of `mp3spi`, only `jlayer-decoder` is. Take those out and it is a lot more familiar.```mermaid
graph TD
desktop[java.desktop]trit[tritonus-share]
desktop --> tritjd[jlayer-decoder]
jorbis[jorbis]
jogg --> jorbisjogg[jogg]
mp3spi[mp3spi]
desktop --> mp3spi
jd --> mp3spi
trit --> mp3spivorbisspi[vorbisspi]
desktop --> vorbisspi
jorbis --> vorbisspi
jogg --> vorbisspi
trit --> vorbisspi
```## Misc.
[Original JLayer Site](https://web.archive.org/web/20210108055829/http://www.javazoom.net/javalayer/javalayer.html)
[Original JLayer Javadocs](https://web.archive.org/web/20200129011439/http://www.javazoom.net/javalayer/docs/docs1.0/index.html)Coordinates for constituent modules. Most won't have a need to touch these.
```xml
dev.mccue
jlayer
2024.04.19```
```java
module example {
requires dev.mccue.jlayer;
}
```----
```xml
dev.mccue
jlayer-decoder
2024.04.19```
```java
module example {
requires dev.mccue.jlayer.decoder;
}
```----
```xml
dev.mccue
jlayer-converter
2024.04.19```
```java
module example {
requires dev.mccue.jlayer.converter;
}
```----
```xml
dev.mccue
jlayer-player
2024.04.19```
```java
module example {
requires dev.mccue.jlayer.player;
}
```----
```xmldev.mccue
jogg
2024.04.19```
```java
module example {
requires dev.mccue.jogg;
}
```----
```xmldev.mccue
jorbis
2024.04.19```
```java
module example {
requires dev.mccue.jorbis;
}
```----
```xmldev.mccue
tritonus-share
2024.04.19```
```java
module example {
requires dev.mccue.tritonus.share;
}
```