The jar for the first demo: “Circle Sounds”, is here.
The jar for the second demo: “Peaceful Brook” is here. The second demo is introduced at this link.
Jar for third demo: “Shepard Chord Builder” is here. This demo is introduced at this link.
I’m working on an audio library for sound that can readily interact with games. Some of the most important pieces are in place, but as part of building this, I also want to make some jars that illustrate “use cases,” both to have demos to show and to personally get more experience with the usability of and issues around the tools I’m writing.
In this program, five circles (of random colors) are linked to five synth sequences each running at its own rhythm, but all locked onto a common Pulse. Each sequence is played by a different software PM synth. Volume and pan levels are continuously updated as the circles move around the screen. Each circle has a “NoteListener” that causes it to blink: fading up and down with the primary envelope (volume) of selected notes of the sequence, when those notes are played.
The background circle marks the “audible area.” Area can be dragged larger/smaller. Center is the loudest point, beyond the edge is silence. Pan is calculated using the angle from the center (0 = right, 180 = left, 90 & 270 = center).
The pitch and tempo can be altered, independently, via clicking inside rectangles on the bottom right. BOTH pitch and tempo are moved at the same time when clicking the cyan or orange square on either side of the rectangles.
Colored circles can be resized (drag edge) which only affects how much time is spent in the audible area. Circles can be dragged and released (while still moving) to push in a given direction, though they aren’t allowed to go very fast.
Mostly just trying to show some capabilities, and maybe tweak the imaginations of some artists or game designers who could easily go beyond these simple graphics.
99% of the audio code is core Java. There is a single “wrapper” class that links the core code to javax.audio.sampled. I also have a wrapper class for Android. My first tests on Android though were with a phone with a relatively weak cpu, and there were dropouts, even though sound code ran perfectly well in the AndroidStudio emulator on my Linux partition.
It would probably be simple enough to write an OpenAL wrapper as well. I don’t know enough about OpenAL to do so. But all that is needed is a streaming output, and calls to the library mixer for the PCM data for that stream, and a routine to convert the PCM to the appropriate byte format.