[A long time ago, I started making a puzzle game called Hexara. That thread is now locked and I don’t have the admin rights to unlock it. Would it be possible to have it unlocked? This post could be moved to that thread.]

http://www.java-gaming.org/user-generated-content/members/27722/hexaragamesoundtester.jar
There’s going to be a seminar on composing music for games at the SF Conservatory of Music and I’m hoping to have a working jar with the game and score for their Nov. 16th deadline (seminar is a week after that). The sound here is all procedural, no wav or ogg files involved.
This “tester” was made for profiling a newly upgraded procedural sound engine. My goal is to keep the cpu usage under 5% even when the sound is most active.
OPERATION:
The “in/out” tells the audio mixer whether or not to even bother reading the track.
The subtracks of the chimes synth (its polyphony–the number of chimes that can play at the same time), can also be tweaked. Changing that number (have to hit enter to complete) requires the mixer be programmatically stopped and restarted which results in an audible pause.
The “Tension Level” is going to be linked to the number of “scrolls” that are completed in the puzzle. Completion of a scroll triggers a gong. When all the scrolls are solved the “gong completion” cue plays.
An increase in “tension” (as more scrolls complete) has the following effects:
(1) increases the density of the chimes,
(2) makes their volume/timbre a little brighter,
(3) makes the flanger modulation on the drone tone sweep more quickly.
Am considering other things to change (e.g., add new or slightly more discordant pitches to be played by the windchime).
This stuff hasn’t been fully implemented in Hexara itself yet. First tests show that it can still stutter, but only very occasionally. The Java2D graphics badly need a rewrite and I suspect doing so will reduce cpu enough to clear that up.
I think it might be worthwhile putting a bunch of volume/pan/timbre controls in this “tester” to help with the design and with making sure the volumes don’t overload (currently possible). But my first priority was to just make sure I had a way of testing the cpu usage.
RESULTS OF PROFILING / QUESTIONS:
Profiling, using JVisualVM, or even just using Windows Task Manager, gives somewhat inconsistent cpu % readings. This morning, I ran it full out (at Tension 5, all tracks on, completion cue playing) and it stayed below 5% the entire time. ;D But while running the same file at other times, the cpu sometimes spikes at 15-20%, . These spikes are weird though in that they don’t consistently follow the duration of the ‘completion cue’. For example, it can hit a high and drop back down below 5% for a majority of the time the cue is playing, and the spike can come in the middle or the end of the cue (as the notes are fading away).
Is the cpu usage a reasonable gauge? I finally figured out that some usage is caused by my cursor interacting with the Swing controls (about 5-6%). Also, it seems if FASTFIND or some other program starts running in the background, that increases the likelihood of the program’s tendency to spike. What is that about? Can it be dealt with?
My computer is circa 2004, so maybe this is all moot for new computers. However, I do want this engine to be able to run on Android, so keeping the cpu usage low is important.