{"id":19786815,"url":"https://github.com/generaloss/jpize-audio","last_synced_at":"2026-05-11T09:09:18.206Z","repository":{"id":257657385,"uuid":"858936624","full_name":"generaloss/jpize-audio","owner":"generaloss","description":"OpenAL Audio Library","archived":false,"fork":false,"pushed_at":"2025-02-21T13:19:41.000Z","size":27557,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-21T14:26:11.206Z","etag":null,"topics":["audio-effect","audio-library","audio-player","audio-recorder","audio-streaming","openal","openal-soft","openalex"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/generaloss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-17T19:38:59.000Z","updated_at":"2025-02-21T13:19:45.000Z","dependencies_parsed_at":"2024-09-18T00:36:47.105Z","dependency_job_id":"c36dfd0e-d227-4477-a44e-05a58e3b614a","html_url":"https://github.com/generaloss/jpize-audio","commit_stats":null,"previous_names":["generaloss/jpize-audio"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generaloss%2Fjpize-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generaloss%2Fjpize-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generaloss%2Fjpize-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generaloss%2Fjpize-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generaloss","download_url":"https://codeload.github.com/generaloss/jpize-audio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241119804,"owners_count":19912962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio-effect","audio-library","audio-player","audio-recorder","audio-streaming","openal","openal-soft","openalex"],"created_at":"2024-11-12T06:19:30.672Z","updated_at":"2026-05-11T09:09:18.201Z","avatar_url":"https://github.com/generaloss.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Audio Module](https://github.com/generaloss/jpize-audio)\n![logo](logo.svg)\n\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.generaloss/jpize-audio.svg)](https://mvnrepository.com/artifact/io.github.generaloss/jpize-audio)\n\n---\n\nAllows loading audio files (ogg, mp3, wav) and playing them with OpenAL.\n\nProvides most OpenAL extensions.\n\nJava version: 17 +\n\n---\n\n## Examples\n\n#### Simple sound example\n``` java\npublic static void main(String[] args) {\n    AlDevices.openDevice();\n    \n    AlSound sound = new AlSound(\"/sound.mp3\");\n    sound.setGain(0.5);\n    sound.play();\n    \n    TimeUtils.waitFor(sound::isStopped);\n    \n    AlDevices.dispose();\n}\n```\n\n#### Open devices\n``` java\n// device attributes (optional)\nAlAttributes attributes = new AlAttributes()\n    .setFormatChannels(AlFormatChannels)\n    .setFormatType(AlFormatType)\n    .setFrequency(int)\n    .setMonoSources(int)\n    .setOutputLimiter(boolean)\n    .setOutputMode(AlOutputMode)\n    .setRefresh(int)\n    .setStereoSources(int)\n    .setSync(boolean);\n\n// open speaker device\nAlDevice device = AlDevices.openDevice(String specifier, attributes);\nAlDevice device = AlDevices.openDevice(String specifier); // no custom attributes\nAlDevice device = AlDevices.openDevice(attributes);       // default specifier\nAlDevice device = AlDevices.openDevice();                 // default specifier \u0026 no attributes\n\n// open capture device\nAlCaptureDevice device = AlDevices.openCaptureDevice(String specifier, int frequency, AlFormat format, int samples);\nAlCaptureDevice device = AlDevices.openCaptureDevice(int frequency, AlFormat format, int samples); // default specifier\n\n// close devices\nAlDevices.dispose();\n```\n\n``` java\n// open all devices\nfor(String specifier: AlDevices.getDeviceSpecifiers()){\n    AlDevices.openDevice(specifier);\n    System.out.println(\"Opened device: \" + specifier);\n}\n// open all capture devices\nfor(String specifier: AlDevices.getCaptureDeviceSpecifiers()){\n    AlDevices.openCaptureDevice(specifier, 44100, AlFormat.MONO16, 128);\n    System.out.println(\"Opened capture device: \" + specifier);\n}\n// make current\nAlDevices.getDevice(\"Your Device Specifier\").makeContextCurrent();\nSystem.out.println(AlDevices.getCurrentDevice()); // \"Your Device Specifier\"\n```\n\n#### Music\nThe AlMusic class does not load the entire file (which can take a long time), \nit loads the file piece by piece as it plays.\n``` java\nAlMusic music = new AlMusic(String internalPath);\nAlMusic music = new AlMusic(Resource res);\nAlMusic music = new AlMusic(int buffersNum, int bufferSize);\nAlMusic music = new AlMusic().load(...);\n\n// play\nmusic.setGain(0.5);\nmusic.play();\n\nvoid loop() {\n    sound.update(); // need to be updated in loop\n}\n\n// free resources\nmusic.dispose();\n```\n\n#### Sound\nThe AlSound class loads the file into a buffer and plays it.\n``` java\nAlSound sound = new AlSound(String internalPath);\nAlSound sound = new AlSound(Resource resource);\nAlSound sound = new AlSound(ByteBuffer data, AlFormat format, int frequency);\nAlSound sound = new AlSound(ByteBuffer data, int bits, int channels, int frequency);\nAlSound sound = new AlSound().load(...);\n\n// play\nsound.setGain(0.5); // there are many more methods inherited from AlSource\nsound.play();\n\n// free sound\nsound.dispose();\n```\n\n#### Buffers \u0026 Sources\n``` java\nAlBuffer buffer = new AlBuffer()\n    .load(\"/sound.mp3\");\n\nAlSource source = new AlSource()\n    .setBuffer(buffer)\n    .setGain(0.5)\n    .play();\n    \n// free resources\nbuffer.dispose();\nsource.dispose();\n```\n\n#### Sources Pool\n``` java\nAlSourcePool pool = new AlSourcePool(int count);\n\n// play with a specific gain \u0026 pitch\npool.play(AlBuffer buffer, double gain, double pitch);\npool.play(AlBuffer buffer, double gain);\npool.play(AlBuffer buffer);\n\n// find free source\nAlSource source = pool.findFreeSource();\nif(source != null) {\n    // play with a gain and more\n    source.setBuffer(AlBuffer buffer);\n    source.setGain(double gain);\n    source.play();\n}\n\n// free sources\npool.dispose();\n```\n\n#### Effects\n\n``` java\n// create echo effect\nAleEcho effect = new AleEcho() // or any other effect\n    .setDelay(0.207F);\n    \n// create effect slot\nAlEffectSlot effectSlot = new AlEffectSlot()\n    .setEffect(effect);\n\n// play\nAlSource source; // or any AlSource inheritor (AlSound, AlMusic, AlSpeaker, ...)\nsource.setAuxSendFilter(effectSlot, 0, null);\nsource.play();\n\n// free resources\neffect.dispose();\neffectSlot.dispose();\n```\n\n#### Filters\n\n``` java\n// create filter\nAlfHighpass filter = new AlfHighpass() // or any other filter\n    .setGainLF(0.3F);\n\nAlSource source; // or any AlSource inheritor (AlSound, AlMusic, AlSpeaker, ...)\nsource.setDirectFilter(filter);\nsource.play();\n\n// free resources\nfilter.dispose();\n```\n\n#### Speaker\n``` java\nAlSpeaker speaker = new AlSpeaker(int buffersNum, AlFormat format, int sampleRate);\nAlSpeaker speaker = new AlSpeaker(int buffersNum);\n\n// setup\nspeaker.setFormat(AlFormat format);\nspeaker.setSampleRate(int sampleRate);\n\n// play samples\nspeaker.play(byte[] data);\n\n// free resources\nspeaker.dispose();\n```\n\n#### Queued Speaker\n``` java\nAlSpeakerQueued speaker = new AlSpeakerQueued(int buffersNum, int bufferSize, AlFormat format, int sampleRate) { ... }\nAlSpeakerQueued speaker = new AlSpeakerQueued(int buffersNum, int bufferSize);\n\n// queue samples to play\nspeaker.play();\nspeaker.queueData(byte[] data);\n\nvoid loop() {\n    speaker.update(); // need to be updated in loop\n}\n\n// free resources\nspeaker.dispose();\n```\n\n\n---\n\n## Used libs:\n* *[lwjgl3](https://github.com/LWJGL/lwjgl3)*\n* *[joribs](https://github.com/ymnk/jorbis)*\n* *[jlayer](https://github.com/umjammer/jlayer)*\n* *[jpize-utils](https://github.com/generaloss/jpize-utils)*\n\n---\n\n## Bugs and Feedback\nFor bugs, questions and discussions please use the [GitHub Issues](https://github.com/generaloss/jpize-audio/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeneraloss%2Fjpize-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeneraloss%2Fjpize-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeneraloss%2Fjpize-audio/lists"}