Variable speed sound looping

To use this demo, first load a .wav file via the menubar "Load" command. The program will ask you for permission before allowing navigation on your computer.

The file must have the following format in order to load: 16-bit encoding, 44100fps, stereo, little-endian. If you have a question about the format of your sound file, please check its properties. This can be done, in Windows, for example, with a right click.

Once a file has been loaded, hold down the cursor to hear the playback. Drag along the vertical to change the volume and along the horizontal to change the playback rate. In a game, the changes in volume and rate (such as a Doppler shift, or the revving of an engine) could be handled programatically, by sending game state values to the VariSpeedPlayer object.

The yellow "overlap" field allows different ways to deal with the point where the file loops. Default is end-to-end (overlap = 0). Often (usually?), end-to-end data is discontinuous and the transition creates an audible click. With "overlap", a number of frames from both the beginning and end of the sound file are combined in order to create a smoother transition. For example, an overlap of 4410 would mean that data from the first 1/10th second and the last 1/10th second of the sound file are combined. If the mode is "AB Roll" both ends are cross-faded from 0 db. If "Merge tracks" is selected, the data from the two ends is summed without any rolloff. This latter mode is most useful if the sound file starts and ends in silence (i.e., has built-in fades). NOTE: there is a possibility when using "Merge tracks" setting of exceeding the allowed volume range and causing aliasing to occur.

If you don't have a .wav sound to play with, you can download these resources that are used with the game Hexara: Gong, BackgroundPad. You are on your own for figuring out how to download these to your computer! The BackgroundPad, by the way, has a gap in it that can be eliminated by setting the overlap to 20000 frames.

Feedback can be made at this link at Java-Gaming.org.