Hi! This is Kyrixen, if you choosed this lib thank you very much! The description below is AI generated (ChatGPT) because im not a good writer :D
A lightweight, cross-platform audio library for Java 8+ with IcedTea compatibility.
- ✅ Pure Java 8 - no native dependencies
- ✅ IcedTea fix - works on default Linux OpenJDK
- ✅ Cross-platform - Windows, Linux, macOS
- ✅ Multiple sources - Files, classpath resources, InputStreams
- ✅ Automatic format conversion - handles 8-bit, mono, unsigned PCM
- ✅ Volume control - linear 0.0 to 1.0
- ✅ Memory safe - proper cleanup methods
Drop KyrixenAudio.jar into your project and add to classpath.
File → Project Structure → Libraries → + → Java → Select KyrixenAudio.jar
mvn install:install-file -Dfile=KyrixenAudio.jar -DgroupId=org.kyrixen -DartifactId=dreg-audio -Dversion=1.0 -Dpackaging=jarimport org.kyrixen.audio.Sound;
public class MyGame {
public static void main(String[] args) {
// Load from file
Sound music = new Sound(new File("music/background.wav"));
music.loop();
music.setVolume(0.5f);
// Load from JAR resource
Sound jump = new Sound("/assets/sounds/jump.wav");
jump.play();
// Cleanup on exit
Sound.cleanup();
}
}// From file system
Sound sfx = new Sound(new File("sounds/explosion.wav"));
// From classpath (inside JAR)
Sound sfx = new Sound("/assets/sounds/explosion.wav");
// From InputStream
Sound sfx = new Sound(stream, "soundName");sound.play(); // Play once
sound.loop(); // Loop continuously
sound.stop(); // Stop playback
sound.reset(); // Reset to beginning
sound.close(); // Release resourcessound.setVolume(1.0f); // 100% (max)
sound.setVolume(0.5f); // 50%
sound.setVolume(0.0f); // 0% (mute)// Close all loaded sounds
Sound.cleanup();| Format | Support | Notes |
|---|---|---|
| WAV PCM 16-bit signed | ✅ Native | Best performance |
| WAV PCM 8-bit | ✅ Converted | Auto-converted to 16-bit |
| WAV PCM unsigned | ✅ Converted | Auto-converted to signed |
| WAV Mono | ✅ Converted | Auto-converted to stereo |
| MP3 | ❌ No | Convert to WAV first |
This library automatically detects and works around IcedTea PulseAudio bugs. No action needed.
Your audio file uses an unsupported encoding. Convert it:
ffmpeg -i input.wav -acodec pcm_s16le -ar 44100 -ac 2 output.wavCall Sound.cleanup() when switching levels or exiting.
git clone https://github.com/Kyrixen/KyrixenAudio.git
cd KyrixenAudio
# IntelliJ
# Open project, Build → Build Artifacts
# Or command line
javac -d out src/io/kyrixen/audio/*.java
jar cvf KyrixenAudio.jar -C out orgMIT License - free for personal and commercial use.
Created for the DREG game project.